// Normalization

This commit is contained in:
mDeflotte
2012-06-27 15:04:43 +00:00
parent 3b70ebc49a
commit e44314c64e
2 changed files with 26 additions and 26 deletions

View File

@@ -110,12 +110,12 @@ abstract class HTMLTemplateCore
*/
protected function getLogo()
{
$logo = '';
$logo = '';
// TCPDF check if the document root is present in the image path, if not it will add it.
// In our case, _PS_ROOT_DIR_ could be different from document_root if we use symlinks, that's why
// we don't use _PS_ROOT_DIR_ and we let TCPDF add the document root.
$physical_uri = Context::getContext()->shop->physical_uri.'img/';
$physical_uri = Context::getContext()->shop->physical_uri.'img/';
if (Configuration::get('PS_LOGO_INVOICE') != false && file_exists($physical_uri.Configuration::get('PS_LOGO_INVOICE')))
$logo = $physical_uri.Configuration::get('PS_LOGO_INVOICE');
@@ -159,26 +159,26 @@ abstract class HTMLTemplateCore
*/
abstract public function getBulkFilename();
/**
* If the template is not present in the theme directory, it will return the default template
* in _PS_PDF_DIR_ directory
*
* @param $template_name
* @return string
*/
protected function getTemplate($template_name)
{
$template = false;
$default_template = _PS_PDF_DIR_.'/'.$template_name.'.tpl';
$overriden_template = _PS_THEME_DIR_.'/pdf/'.$template_name.'.tpl';
/**
* If the template is not present in the theme directory, it will return the default template
* in _PS_PDF_DIR_ directory
*
* @param $template_name
* @return string
*/
protected function getTemplate($template_name)
{
$template = false;
$default_template = _PS_PDF_DIR_.'/'.$template_name.'.tpl';
$overriden_template = _PS_THEME_DIR_.'/pdf/'.$template_name.'.tpl';
if (file_exists($overriden_template))
$template = $overriden_template;
else if (file_exists($default_template))
$template = $default_template;
if (file_exists($overriden_template))
$template = $overriden_template;
else if (file_exists($default_template))
$template = $default_template;
return $template;
}
return $template;
}
/**

View File

@@ -97,7 +97,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown(),
'shipping_tax_breakdown' => $this->order_invoice->getShippingTaxesBreakdown($this->order),
'ecotax_tax_breakdown' => $this->order_invoice->getEcoTaxTaxesBreakdown(),
'wrapping_tax_breakdown' => $this->order_invoice->getWrappingTaxesBreakdown(),
'wrapping_tax_breakdown' => $this->order_invoice->getWrappingTaxesBreakdown(),
'order' => $this->order,
'order_invoice' => $this->order_invoice
));
@@ -113,12 +113,12 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
{
$file = Configuration::get('PS_INVOICE_MODEL');
// try to fetch the iso template
$template = $this->getTemplate($file.'.'.$iso_country);
// try to fetch the iso template
$template = $this->getTemplate($file.'.'.$iso_country);
// else use the default one
if (!$template)
$template = $this->getTemplate($file);
// else use the default one
if (!$template)
$template = $this->getTemplate($file);
return $template;
}