Skip to content

Commit

Permalink
[-] PDF: Order slip Tax detail computation fix. #PSCSX-6408
Browse files Browse the repository at this point in the history
  • Loading branch information
xGouley committed Aug 18, 2015
1 parent b218400 commit 1902360
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions classes/order/Order.php
Expand Up @@ -2228,7 +2228,16 @@ public function setWsCurrentState($state)
return true;
}

public function getProductTaxesDetails()

/**
* By default this function was made for invoice, to compute tax amounts and balance delta (because of computation made on round values).
* If you provide $limitToOrderDetails, only these item will be taken into account. This option is usefull for order slip for example,
* where only sublist of the order is refunded.
*
* @param $limitToOrderDetails Optional array of OrderDetails to take into account. False by default to take all OrderDetails from the current Order.
* @return array A list of tax rows applied to the given OrderDetails (or all OrderDetails linked to the current Order).
*/
public function getProductTaxesDetails($limitToOrderDetails = false)
{
$round_type = $this->round_type;
if ($round_type == 0) {
Expand Down Expand Up @@ -2278,7 +2287,7 @@ public function getProductTaxesDetails()
$breakdown = array();

// Get order_details
$order_details = $this->getOrderDetailList();
$order_details = $limitToOrderDetails ?: $this->getOrderDetailList();

$order_ecotax_tax = 0;

Expand Down
2 changes: 1 addition & 1 deletion classes/pdf/HTMLTemplateOrderSlip.php
Expand Up @@ -273,7 +273,7 @@ public function getProductTaxesBreakdown()
// - 'total_amount'
$breakdown = array();

$details = $this->order->getProductTaxesDetails();
$details = $this->order->getProductTaxesDetails($this->order->products);

foreach ($details as $row) {
$rate = sprintf('%.3f', $row['tax_rate']);
Expand Down

1 comment on commit 1902360

@Nobodaddy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 'fix' should be cancelled immediately. I've got a notice that it gets in the way of the option to display separate taxes for shipping provided by Advancedeucompliance.
Anyway, it seems there must be other bugs because the shipping tax display in invoice only works properly when you replace the classes directory 'order' of 1.6.1.1 master with the previous of 1.6.1.0. I didn't check which changes in detail are responsible for the fact that the combined shipping tax is computed properly whereas the indicated shipping tax rate is the carrier's tax rate but not the product based tax rate.

Please sign in to comment.