Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3535 from xGouley/PSCSX-6245
[-] PDF: smarty warning for Order slip. #PSCSX-6245
  • Loading branch information
Jérôme Nadaud committed Aug 3, 2015
2 parents 38bd291 + 7e7ada8 commit 094519a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions classes/pdf/HTMLTemplateInvoice.php
Expand Up @@ -30,6 +30,7 @@
class HTMLTemplateInvoiceCore extends HTMLTemplate
{
public $order;
public $order_invoice;
public $available_in_your_account = false;

/**
Expand Down
14 changes: 14 additions & 0 deletions classes/pdf/HTMLTemplateOrderSlip.php
Expand Up @@ -142,6 +142,18 @@ public function getContent()

$this->order->total_paid_tax_incl += $this->order->total_shipping_tax_incl;
$this->order->total_paid_tax_excl += $this->order->total_shipping_tax_excl;

$total_cart_rule = 0;
if ($this->order_slip->order_slip_type == 1 && is_array($cart_rules = $this->order->getCartRules($this->order_invoice->id))) {
foreach($cart_rules as $cart_rule) {
if ($tax_excluded_display) {
$total_cart_rule += $cart_rule['value_tax_excl'];
} else {
$total_cart_rule += $cart_rule['value'];
}
}
}

$this->smarty->assign(array(
'order' => $this->order,
'order_slip' => $this->order_slip,
Expand All @@ -152,6 +164,7 @@ public function getContent()
'invoice_address' => $formatted_invoice_address,
'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
'tax_excluded_display' => $tax_excluded_display,
'total_cart_rule' => $total_cart_rule
));

$tpls = array(
Expand Down Expand Up @@ -209,6 +222,7 @@ public function getTaxTabContent()
'ecotax_tax_breakdown' => $this->order_slip->getEcoTaxTaxesBreakdown(),
'is_order_slip' => true,
'tax_breakdowns' => $this->getTaxBreakdown(),
'display_tax_bases_in_breakdowns' => false
));

return $this->smarty->fetch($this->getTemplate('invoice.tax-tab'));
Expand Down
3 changes: 0 additions & 3 deletions pdf/order-slip.product-tab.tpl
Expand Up @@ -97,17 +97,14 @@
{/foreach}
{/if}

{assign var=total_cart_rule value=0}
{if is_array($cart_rules) && count($cart_rules)}
{foreach $cart_rules as $cart_rule}
<tr class="discount">
<td class="white left" colspan="3">{$cart_rule.name}</td>
<td class="white right">
{if $tax_excluded_display}
{$total_cart_rule = $total_cart_rule + $cart_rule.value_tax_excl}
+ {$cart_rule.value_tax_excl}
{else}
{$total_cart_rule = $total_cart_rule + $cart_rule.value}
+ {$cart_rule.value}
{/if}
</td>
Expand Down

0 comments on commit 094519a

Please sign in to comment.