diff --git a/classes/pdf/HTMLTemplate.php b/classes/pdf/HTMLTemplate.php index bffb28ec6..f76c5f5cb 100755 --- a/classes/pdf/HTMLTemplate.php +++ b/classes/pdf/HTMLTemplate.php @@ -43,13 +43,17 @@ abstract class HTMLTemplateCore */ public function getHeader() { + $shop_name = ''; + if (Validate::isLoadedObject($this->shop)) + $shop_name = $this->shop->name; + $this->smarty->assign(array( 'logo_path' => $this->getLogo(), 'img_ps_dir' => 'http://'.Tools::getMediaServer(_PS_IMG_)._PS_IMG_, 'img_update_time' => Configuration::get('PS_IMG_UPDATE_TIME'), 'title' => $this->title, 'date' => $this->date, - 'shop_name' => $this->shop->name + 'shop_name' => $shop_name )); return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/header.tpl'); @@ -61,14 +65,8 @@ abstract class HTMLTemplateCore */ public function getFooter() { - $shop_address = ''; - if (Validate::isLoadedObject($this->shop)) - { - $shop_address_obj = $this->shop->getAddress(); - if (isset($shop_address_obj) && $shop_address_obj instanceof Address) - $shop_address = AddressFormat::generateAddress($shop_address_obj, array(), ' - ', ' '); - } - + $shop_address = $this->getShopAddress(); + $this->smarty->assign(array( 'available_in_your_account' => $this->available_in_your_account, 'shop_address' => $shop_address, @@ -80,7 +78,25 @@ abstract class HTMLTemplateCore return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/footer.tpl'); } - /** + /** + * Returns the shop address + * @return string + */ + protected function getShopAddress() + { + $shop_address = ''; + if (Validate::isLoadedObject($this->shop)) + { + $shop_address_obj = $this->shop->getAddress(); + if (isset($shop_address_obj) && $shop_address_obj instanceof Address) + $shop_address = AddressFormat::generateAddress($shop_address_obj, array(), ' - ', ' ');return $shop_address; + return $shop_address; + } + + return $shop_address; + } + + /** * Returns the invoice logo */ protected function getLogo() @@ -130,6 +146,8 @@ abstract class HTMLTemplateCore abstract public function getBulkFilename(); + + /** * Translatation method * @param string $string diff --git a/classes/pdf/HTMLTemplateSupplyOrderForm.php b/classes/pdf/HTMLTemplateSupplyOrderForm.php index 14c8b4bc9..d7932f9df 100644 --- a/classes/pdf/HTMLTemplateSupplyOrderForm.php +++ b/classes/pdf/HTMLTemplateSupplyOrderForm.php @@ -121,15 +121,11 @@ class HTMLTemplateSupplyOrderFormCore extends HTMLTemplate public function getFooter() { $this->address = $this->address_warehouse; - $shop_address = ''; - if (isset($this->address) && $this->address instanceof Address) - $shop_address = AddressFormat::generateAddress($this->address, array(), ' - ', ' '); - $free_text = self::l('DE: Discount excluded '); $free_text .= self::l(' DI: Discount included'); $this->smarty->assign(array( - 'shop_address' => $shop_address, + 'shop_address' => $this->getShopAddress(), 'shop_fax' => Configuration::get('PS_SHOP_FAX'), 'shop_phone' => Configuration::get('PS_SHOP_PHONE'), 'shop_details' => Configuration::get('PS_SHOP_DETAILS'),