[-] BO : Partial refund - part 4

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10626 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny
2011-11-23 22:42:17 +00:00
parent 005913ce3b
commit f5aadafc92
9 changed files with 34 additions and 15 deletions
@@ -46,4 +46,4 @@
<p>{l s='If you don\'t select the "Free shipping", the normal shipping cost will be applied'}</p>
</div>
</td>
</tr>
</tr>
@@ -63,6 +63,7 @@
<td align="center" class="total_product">
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
</td>
<td colspan="2" style="display: none;" class="add_product_fields">&nbsp;</th>
<td align="center" class="cancelCheck standard_refund_fields" style="background-color:rgb(232, 237, 194);display:none">
<input type="hidden" name="totalQtyReturn" id="totalQtyReturn" value="{$product['product_quantity_return']}" />
<input type="hidden" name="totalQty" id="totalQty" value="{$product['product_quantity']}" />
+8 -6
View File
@@ -504,7 +504,9 @@
{if ($order->hasBeenDelivered())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
<th style="width: 3%; text-align: center">{l s='Stock'}</th>
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
<th colspan="2" style="width: 13%; display: none;" class="standard_refund_fields"><img src="../img/admin/delete.gif" alt="{l s='Products'}" />
<th colspan="2" style="display: none;" class="add_product_fields">&nbsp;</th>
<th colspan="2" style="display: none;" class="edit_product_fields">&nbsp;</th>
<th colspan="2" style="display: none;" class="standard_refund_fields"><img src="../img/admin/delete.gif" alt="{l s='Products'}" />
{if ($order->hasBeenDelivered())}
{l s='Return'}
{elseif ($order->hasBeenPaid())}
@@ -551,29 +553,29 @@
<tr id="total_products">
<td width="150px;">{l s='Products'}</td>
<td align="right">{displayPrice price=$order->total_products_wt currency=$currency->id}</td>
<td class="partial_refund_fields" style="background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
</tr>
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td>{l s='Discounts'}</td>
<td align="right">-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
</tr>
<tr id="total_wrapping" {if $order->total_wrapping_tax_incl == 0}style="display: none;"{/if}>
<td>{l s='Wrapping'}</td>
<td align="right">{displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
</tr>
<tr id="total_shipping">
<td>{l s='Shipping'}</td>
<td align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="background-color:rgb(232, 237, 194);"><input type="text" size="3" name="partialRefundShippingCost" /> &euro;</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"><input type="text" size="3" name="partialRefundShippingCost" /> &euro;</td>
</tr>
<tr style="font-size: 20px" id="total_order">
<td>{l s='Total'}</td>
<td align="right">
{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}
</td>
<td class="partial_refund_fields" style="background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
</tr>
</table>
</div>
+6
View File
@@ -48,6 +48,9 @@ class OrderSlipCore extends ObjectModel
/** @var integer */
public $shipping_cost_amount;
/** @var integer */
public $partial;
/** @var string Object creation date */
public $date_add;
@@ -72,6 +75,7 @@ class OrderSlipCore extends ObjectModel
$fields['amount'] = (int)($this->amount);
$fields['shipping_cost'] = (int)($this->shipping_cost);
$fields['shipping_cost_amount'] = (float)($this->shipping_cost_amount);
$fields['partial'] = (int)($this->partial);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
return $fields;
@@ -179,6 +183,7 @@ class OrderSlipCore extends ObjectModel
$orderSlip->id_order = (int)($order->id);
$orderSlip->shipping_cost = (int)($shipping_cost);
$orderSlip->conversion_rate = $currency->conversion_rate;
$orderSlip->partial = 0;
if (!$orderSlip->add())
return false;
@@ -196,6 +201,7 @@ class OrderSlipCore extends ObjectModel
$orderSlip->shipping_cost = false;
$orderSlip->shipping_cost_amount = (float)($shipping_cost_amount);
$orderSlip->conversion_rate = $currency->conversion_rate;
$orderSlip->partial = 1;
if (!$orderSlip->add())
return false;
+7 -5
View File
@@ -106,9 +106,9 @@ class AdminOrdersControllerCore extends AdminController
if ($this->display == 'view')
{
$order = new Order((int)Tools::getValue('id_order'));
if ($order->hasBeenDelivered()) $type = $this->l('Return');
elseif ($order->hasBeenPaid()) $type = $this->l('Refund');
else $type = $this->l('Cancel');
if ($order->hasBeenDelivered()) $type = $this->l('Return products');
elseif ($order->hasBeenPaid()) $type = $this->l('Standard refund');
else $type = $this->l('Cancel products');
$this->toolbar_btn['new'] = array(
'short' => 'Create',
@@ -119,7 +119,7 @@ class AdminOrdersControllerCore extends AdminController
$this->toolbar_btn['standard_refund'] = array(
'short' => 'Create',
'href' => '',
'desc' => $type.' '.$this->l('refund'),
'desc' => $type,
'class' => 'process-icon-new standard_refund'
);
$this->toolbar_btn['partial_refund'] = array(
@@ -345,8 +345,10 @@ class AdminOrdersControllerCore extends AdminController
$order_detail_list[$id_order_detail] = $amount_detail;
}
$shipping_cost_amount = (float)(Tools::getValue('partialRefundShippingCost'));
if ($shipping_cost_amount > 0)
$amount += $shipping_cost_amount;
if ($shipping_cost_amount > 0 OR $amount > 0)
if ($amount > 0)
{
if (!OrderSlip::createPartialOrderSlip($order, $amount, $shipping_cost_amount, $order_detail_list))
$this->_errors[] = Tools::displayError('Cannot generate partial credit slip');
+1
View File
@@ -1205,6 +1205,7 @@ CREATE TABLE `PREFIX_order_slip` (
`shipping_cost` tinyint(3) unsigned NOT NULL default '0',
`amount` DECIMAL(10,2) NOT NULL,
`shipping_cost_amount` DECIMAL(10,2) NOT NULL,
`partial` TINYINT(1) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_order_slip`),
+1
View File
@@ -625,4 +625,5 @@ CREATE TABLE `PREFIX_order_carrier` (
ALTER TABLE `PREFIX_order_slip` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `shipping_cost`;
ALTER TABLE `PREFIX_order_slip` ADD COLUMN `shipping_cost_amount` DECIMAL(10,2) NOT NULL AFTER `amount`;
ALTER TABLE `PREFIX_order_slip` ADD COLUMN `partial` TINYINT(1) NOT NULL AFTER `shipping_cost_amount`;
ALTER TABLE `PREFIX_order_slip_detail` ADD COLUMN `amount` DECIMAL(10,2) NOT NULL AFTER `product_quantity`;
+8 -2
View File
@@ -29,6 +29,9 @@ var current_product = null;
$(document).ready(function() {
$('.add_product').click(function() {
$('.cancel_product_change_link:visible').trigger('click');
$('.add_product_fields').show();
$('.edit_product_fields').hide();
$('.standard_refund_fields').hide();
$('tr#new_product').slideDown('fast', function () {
$('tr#new_product td').fadeIn('fast');
});
@@ -263,6 +266,9 @@ $(document).ready(function() {
});
$('.edit_product_change_link').click(function() {
$('.add_product_fields').hide();
$('.standard_refund_fields').hide();
$('.edit_product_fields').show();
$('.cancel_product_change_link:visible').trigger('click');
closeAddProduct();
@@ -307,7 +313,7 @@ $(document).ready(function() {
$('.cancel_product_change_link').click(function() {
current_product = null;
$('.edit_product_fields').show();
$(this).parent().parent().css('background-color', '#FFF');
$(this).parent().parent().find('td .product_price_show').show();
@@ -324,7 +330,7 @@ $(document).ready(function() {
$(this).parent().children('.edit_product_change_link').show();
$(this).parent().children('input[name=submitProductChange]').hide();
$(this).parent().children('.cancel_product_change_link').hide();
$('.standard_refund_fields').hide();
return false;
});
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>homeslider</name>
<displayName><![CDATA[Image slider for your homepage]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Adds an image slider to your homepage.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>