// Code Review Invoices V&V
This commit is contained in:
@@ -31,19 +31,19 @@
|
||||
class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
{
|
||||
public $order;
|
||||
|
||||
public $available_in_your_account = false;
|
||||
public $available_in_your_account = false;
|
||||
|
||||
public function __construct(OrderInvoice $order_invoice, $smarty)
|
||||
{
|
||||
$this->order_invoice = $order_invoice;
|
||||
$this->order = new Order($this->order_invoice->id_order);
|
||||
$this->order = new Order((int)$this->order_invoice->id_order);
|
||||
$this->smarty = $smarty;
|
||||
|
||||
// header informations
|
||||
$this->date = Tools::displayDate($order_invoice->date_add, (int)$this->order->id_lang);
|
||||
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', Context::getContext()->language->id).sprintf('%06d', $order_invoice->number);
|
||||
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
$this->title = HTMLTemplateInvoice::l('Invoice ').' #'.Configuration::get('PS_INVOICE_PREFIX', $id_lang).sprintf('%06d', $order_invoice->number);
|
||||
// footer informations
|
||||
$this->shop = new Shop((int)$this->order->id_shop);
|
||||
}
|
||||
@@ -61,11 +61,11 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
|
||||
if ($this->order->id_address_delivery != $this->order->id_address_invoice)
|
||||
{
|
||||
$delivery_address = new Address((int)$this->order->id_address_delivery);
|
||||
$formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
|
||||
$delivery_address = new Address((int)$this->order->id_address_delivery);
|
||||
$formatted_delivery_address = AddressFormat::generateAddress($delivery_address, array(), '<br />', ' ');
|
||||
}
|
||||
|
||||
$customer = new Customer($this->order->id_customer);
|
||||
$customer = new Customer((int)$this->order->id_customer);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'order' => $this->order,
|
||||
@@ -73,7 +73,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
'delivery_address' => $formatted_delivery_address,
|
||||
'invoice_address' => $formatted_invoice_address,
|
||||
'tax_excluded_display' => Group::getPriceDisplayMethod($customer->id_default_group),
|
||||
'tax_tab' => $this->getTaxTabContent(),
|
||||
'tax_tab' => $this->getTaxTabContent(),
|
||||
'customer' => $customer
|
||||
));
|
||||
|
||||
@@ -83,12 +83,12 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
/**
|
||||
* Returns the tax tab content
|
||||
*/
|
||||
public function getTaxTabContent()
|
||||
{
|
||||
public function getTaxTabContent()
|
||||
{
|
||||
$invoice_address = new Address((int)$this->order->id_address_invoice);
|
||||
$tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT')
|
||||
&& !empty($invoiceAddress->vat_number)
|
||||
&& $invoiceAddress->id_country != Configuration::get('VATNUMBER_COUNTRY');
|
||||
&& !empty($invoice_address->vat_number)
|
||||
&& $invoice_address->id_country != Configuration::get('VATNUMBER_COUNTRY');
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'tax_exempt' => $tax_exempt,
|
||||
@@ -101,7 +101,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
));
|
||||
|
||||
return $this->smarty->fetch(_PS_THEME_DIR_.'/pdf/invoice.tax-tab.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the invoice template associated to the country iso_code
|
||||
@@ -123,18 +123,18 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
* Returns the template filename when using bulk rendering
|
||||
* @return string filename
|
||||
*/
|
||||
public function getBulkFilename()
|
||||
{
|
||||
return 'invoices.pdf';
|
||||
}
|
||||
public function getBulkFilename()
|
||||
{
|
||||
return 'invoices.pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the template filename
|
||||
* @return string filename
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
return Configuration::get('PS_INVOICE_PREFIX').sprintf('%06d', $this->order_invoice->number).'.pdf';
|
||||
}
|
||||
public function getFilename()
|
||||
{
|
||||
return Configuration::get('PS_INVOICE_PREFIX').sprintf('%06d', $this->order_invoice->number).'.pdf';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user