[*] BO : Partial refund now handle quantity
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11624 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -95,7 +95,10 @@
|
|||||||
0/{$productQuantity}
|
0/{$productQuantity}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td class="partial_refund_fields current-edit" style="text-align:right;display:none"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> €</td>
|
<td class="partial_refund_fields current-edit" style="text-align:left;display:none">
|
||||||
|
<div style="width:40%;margin-top:5px;float:left">{l s='Quantity:'}</div> <div style="width:60%;margin-top:2px;float:left"><input type="text" size="3" name="partialRefundProductQuantity[{$k}]" value="0" /> 0/{$productQuantity-$product['product_quantity_refunded']}</div>
|
||||||
|
<div style="width:40%;margin-top:5px;float:left">{l s='Amount:'}</div> <div style="width:60%;margin-top:2px;float:left"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> €</div>
|
||||||
|
</td>
|
||||||
{if ($can_edit && !$order->hasBeenDelivered())}
|
{if ($can_edit && !$order->hasBeenDelivered())}
|
||||||
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
|
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
|
||||||
{if sizeof($invoices_collection)}
|
{if sizeof($invoices_collection)}
|
||||||
|
|||||||
@@ -206,8 +206,29 @@ class OrderSlipCore extends ObjectModel
|
|||||||
|
|
||||||
public function addPartialSlipDetail($order_detail_list)
|
public function addPartialSlipDetail($order_detail_list)
|
||||||
{
|
{
|
||||||
foreach ($order_detail_list as $id_order_detail => $amount)
|
foreach ($order_detail_list as $id_order_detail => $tab)
|
||||||
Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_slip_detail', array('id_order_slip' => (int)($this->id), 'id_order_detail' => (int)($id_order_detail), 'product_quantity' => 0, 'amount' => (float)($amount)), 'INSERT');
|
{
|
||||||
|
$tab['amount_tax_excl'] = $tab['amount_tax_incl'] = $tab['amount'];
|
||||||
|
$id_tax = (int)Db::getInstance()->getValue('SELECT `id_tax` FROM `'._DB_PREFIX_.'order_detail_tax` WHERE `id_order_detail` = '.(int)$id_order_detail);
|
||||||
|
if ($id_tax > 0)
|
||||||
|
{
|
||||||
|
$rate = (float)Db::getInstance()->getValue('SELECT `rate` FROM `'._DB_PREFIX_.'tax` WHERE `id_tax` = '.(int)$id_tax);
|
||||||
|
if ($rate > 0)
|
||||||
|
{
|
||||||
|
$rate = 1 + ($rate / 100);
|
||||||
|
$tab['amount_tax_excl'] = $tab['amount_tax_excl'] / $rate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$insertOrderSlip = array(
|
||||||
|
'id_order_slip' => (int)($this->id),
|
||||||
|
'id_order_detail' => (int)($id_order_detail),
|
||||||
|
'product_quantity' => (int)($tab['quantity']),
|
||||||
|
'amount_tax_excl' => (float)($tab['amount_tax_excl']),
|
||||||
|
'amount_tax_incl' => (float)($tab['amount_tax_incl']),
|
||||||
|
);
|
||||||
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'order_slip_detail', $insertOrderSlip, 'INSERT');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -338,7 +338,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
if (isset($amount_detail) && !empty($amount_detail))
|
if (isset($amount_detail) && !empty($amount_detail))
|
||||||
{
|
{
|
||||||
$amount += $amount_detail;
|
$amount += $amount_detail;
|
||||||
$order_detail_list[$id_order_detail] = $amount_detail;
|
$order_detail_list[$id_order_detail]['quantity'] = (int)$_POST['partialRefundProductQuantity'][$id_order_detail];
|
||||||
|
$order_detail_list[$id_order_detail]['amount'] = (float)$amount_detail;
|
||||||
}
|
}
|
||||||
$shipping_cost_amount = (float)(Tools::getValue('partialRefundShippingCost'));
|
$shipping_cost_amount = (float)(Tools::getValue('partialRefundShippingCost'));
|
||||||
if ($shipping_cost_amount > 0)
|
if ($shipping_cost_amount > 0)
|
||||||
|
|||||||
@@ -1234,7 +1234,8 @@ CREATE TABLE `PREFIX_order_slip_detail` (
|
|||||||
`id_order_slip` int(10) unsigned NOT NULL,
|
`id_order_slip` int(10) unsigned NOT NULL,
|
||||||
`id_order_detail` int(10) unsigned NOT NULL,
|
`id_order_detail` int(10) unsigned NOT NULL,
|
||||||
`product_quantity` int(10) unsigned NOT NULL default '0',
|
`product_quantity` int(10) unsigned NOT NULL default '0',
|
||||||
`amount` DECIMAL(10,2) NOT NULL,
|
`amount_tax_excl` DECIMAL(10,2) default NULL,
|
||||||
|
`amount_tax_incl` DECIMAL(10,2) default NULL,
|
||||||
PRIMARY KEY (`id_order_slip`,`id_order_detail`)
|
PRIMARY KEY (`id_order_slip`,`id_order_detail`)
|
||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|||||||
@@ -410,4 +410,8 @@ SET `position` = (
|
|||||||
FROM `PREFIX_tab`
|
FROM `PREFIX_tab`
|
||||||
WHERE `id_parent` = 0
|
WHERE `id_parent` = 0
|
||||||
)
|
)
|
||||||
WHERE `class_name` = 'AdminAccounting';
|
WHERE `class_name` = 'AdminAccounting';
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `PREFIX_order_slip_detail` CHANGE `amount` `amount_tax_excl` DECIMAL( 10, 2 ) default NULL;
|
||||||
|
ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount_tax_incl` DECIMAL(10,2) default NULL AFTER `amount_tax_excl`;
|
||||||
|
|||||||
Reference in New Issue
Block a user