diff --git a/admin-dev/themes/template/orders/_product_line.tpl b/admin-dev/themes/template/orders/_product_line.tpl index 2fe4c0a05..c4cc8332c 100755 --- a/admin-dev/themes/template/orders/_product_line.tpl +++ b/admin-dev/themes/template/orders/_product_line.tpl @@ -64,7 +64,7 @@ {displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}   - + @@ -74,7 +74,7 @@ -- {/if} - + {if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])} {elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))} @@ -95,7 +95,7 @@ 0/{$productQuantity} {/if} - € + € {if ($can_edit && !$order->hasBeenDelivered())} {if sizeof($invoices_collection)} diff --git a/admin-dev/themes/template/orders/view.tpl b/admin-dev/themes/template/orders/view.tpl index 5cb6d7afc..d679933e7 100755 --- a/admin-dev/themes/template/orders/view.tpl +++ b/admin-dev/themes/template/orders/view.tpl @@ -224,6 +224,7 @@ Date Document Number + @@ -232,6 +233,21 @@ {dateFormat date=$document->date_add} Invoice #{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->number} + {l s='Edit'} + + + +
+

+ + +

+

+ + +

+
+ {foreachelse} @@ -602,29 +618,29 @@ {l s='Products'} {displayPrice price=$order->total_products_wt currency=$currency->id} -   +   total_discounts_tax_incl == 0}style="display: none;"{/if}> {l s='Discounts'} -{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id} -   +   total_wrapping_tax_incl == 0}style="display: none;"{/if}> {l s='Wrapping'} {displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id} -   +   {l s='Shipping'} {displayPrice price=$order->total_shipping_tax_incl currency=$currency->id} - € + € {l s='Total'} {displayPrice price=$order->total_paid_tax_incl currency=$currency->id} -   +   diff --git a/classes/order/OrderInvoice.php b/classes/order/OrderInvoice.php index 074cd3404..1a2a34028 100644 --- a/classes/order/OrderInvoice.php +++ b/classes/order/OrderInvoice.php @@ -63,6 +63,9 @@ class OrderInvoiceCore extends ObjectModel /** @var float */ public $total_wrapping_tax_incl; + /** @var string note */ + public $note; + /** @var intger */ public $date_add; @@ -85,6 +88,7 @@ class OrderInvoiceCore extends ObjectModel 'total_shipping_tax_incl' =>array('type' => self::TYPE_FLOAT), 'total_wrapping_tax_excl' =>array('type' => self::TYPE_FLOAT), 'total_wrapping_tax_incl' =>array('type' => self::TYPE_FLOAT), + 'note' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 65000), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), ), ); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index ebd367a71..b26832788 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -588,6 +588,26 @@ class AdminOrdersControllerCore extends AdminController else $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } + elseif (Tools::isSubmit('submitEditNote')) { + $id_order_invoice = (int)Tools::getValue('id_order_invoice'); + $note = Tools::getValue('note'); + $order_invoice = new OrderInvoice($id_order_invoice); + if (Validate::isLoadedObject($order_invoice) && Validate::isCleanHtml($note)) + { + if ($this->tabAccess['edit'] === '1') + { + $order_invoice->note = $note; + if ($order_invoice->save()) + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order_invoice->id_order.'&vieworder&conf=4&token='.$this->token); + else + $this->_errors[] = Tools::displayError('Unable to save invoice note.'); + } + else + $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); + } + else + $this->_errors[] = Tools::displayError('Unable to load invoice for edit note.'); + } elseif (Tools::isSubmit('submitAddOrder') == 1 && ($id_cart = Tools::getValue('id_cart')) && ($module_name = pSQL(Tools::getValue('payment_module_name'))) && ($id_order_state = Tools::getValue('id_order_state'))) { if ($this->tabAccess['edit'] === '1') diff --git a/css/admin.css b/css/admin.css index 6d1fa26da..9fba2052d 100644 --- a/css/admin.css +++ b/css/admin.css @@ -2017,3 +2017,4 @@ div#scrollTop a:hover{ .category-filter #filternameForm { float:left; margin-left:10px; color:#585A69;} +.current-edit { background-color: rgb(232, 237, 194); } \ No newline at end of file diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index 9e984e975..1a5e2c00c 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -1069,6 +1069,7 @@ CREATE TABLE `PREFIX_order_invoice` ( `total_shipping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_wrapping_tax_excl` decimal(17,2) NOT NULL DEFAULT '0.00', `total_wrapping_tax_incl` decimal(17,2) NOT NULL DEFAULT '0.00', + `note` text, `date_add` datetime NOT NULL, PRIMARY KEY (`id_order_invoice`), KEY `id_order` (`id_order`) diff --git a/install-dev/sql/upgrade/1.5.0.2.sql b/install-dev/sql/upgrade/1.5.0.2.sql index 16f057fcc..b44129e48 100644 --- a/install-dev/sql/upgrade/1.5.0.2.sql +++ b/install-dev/sql/upgrade/1.5.0.2.sql @@ -45,7 +45,7 @@ ALTER TABLE `PREFIX_orders` DROP COLUMN `id_warehouse`; ALTER TABLE `PREFIX_order_detail` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0 AFTER `id_order_invoice`; ALTER TABLE `PREFIX_suplier` ADD COLUMN `id_address` int(10) unsigned NOT NULL AFTER `id_supplier`; ALTER TABLE `PREFIX_address` ADD COLUMN `id_warehouse` int(10) unsigned NOT NULL DEFAULT 0 AFTER `id_supplier`; - +ALTER TABLE `PREFIX_order_invoice` ADD `note` TEXT NOT NULL AFTER `total_wrapping_tax_incl`; /************************ * STOCK MANAGEMENT diff --git a/themes/default/pdf/invoice.tpl b/themes/default/pdf/invoice.tpl index 6c157ceb0..0233b867d 100755 --- a/themes/default/pdf/invoice.tpl +++ b/themes/default/pdf/invoice.tpl @@ -227,6 +227,20 @@ {$tax_tab} +{if isset($order_invoice->note) && $order_invoice->note} +
 
+ + + + + +
+

+ {$order_invoice->note|nl2br} +

+
+{/if} + {if isset($HOOK_DISPLAY_PDF)}