[+] BO : Add a note on invoice

This commit is contained in:
jBreux
2011-12-15 11:38:01 +00:00
parent c01db578a4
commit b2777ffd8c
8 changed files with 65 additions and 9 deletions
@@ -64,7 +64,7 @@
{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">
<td align="center" class="cancelCheck standard_refund_fields current-edit" style="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']}" />
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
@@ -74,7 +74,7 @@
--
{/if}
</td>
<td class="cancelQuantity standard_refund_fields" style="background-color:rgb(232, 237, 194);display:none">
<td class="cancelQuantity standard_refund_fields current-edit" style="display:none">
{if ($product['product_quantity_return'] + $product['product_quantity_refunded'] >= $product['product_quantity'])}
<input type="hidden" name="cancelQuantity[{$k}]" value="0" />
{elseif (!$order->hasBeenDelivered() OR Configuration::get('PS_ORDER_RETURN'))}
@@ -95,7 +95,7 @@
0/{$productQuantity}
{/if}
</td>
<td class="partial_refund_fields" style="text-align:right;background-color:rgb(232, 237, 194);display:none"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> &euro;</td>
<td class="partial_refund_fields current-edit" style="text-align:right;display:none"><input type="text" size="3" name="partialRefundProduct[{$k}]" /> &euro;</td>
{if ($can_edit && !$order->hasBeenDelivered())}
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
{if sizeof($invoices_collection)}
+21 -5
View File
@@ -224,6 +224,7 @@
<th style="width:20%">Date</th>
<th>Document</th>
<th style="width:20%">Number</th>
<th style="width:20px"></th>
</tr>
</thead>
<tbody>
@@ -232,6 +233,21 @@
<td>{dateFormat date=$document->date_add}</td>
<td>Invoice</td>
<td><a href="pdf.php?pdf&id_order_invoice={$document->id}">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->number}</a></td>
<td><a href="#" onclick="jQuery('#invoiceNote{$document->id}').show(); return false;"><img src="../img/admin/comment_edit.png" alt="{l s='Edit'}" /></a></td>
</tr>
<tr id="invoiceNote{$document->id}" style="display:none" class="current-edit">
<td colspan="4">
<form action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}" method="post">
<p class="center">
<input type="hidden" name="id_order_invoice" value="{$document->id}" />
<textarea name="note" rows="10" cols="10" style="width:98%;height:100px;">{$document->note|escape:'htmlall':'UTF-8'}</textarea>
</p>
<p class="right">
<input type="submit" name="submitEditNote" value="{l s='Save'}" class="button" />
<input type="button" name="cancelNote" id="cancelNote" value="{l s='Cancel'}" onclick="jQuery('#invoiceNote{$document->id}').hide();" class="button" />
</p>
</form>
</td>
</tr>
{foreachelse}
<tr>
@@ -602,29 +618,29 @@
<tr id="total_products">
<td width="150px;"><b>{l s='Products'}</b></td>
<td class="amount" align="right">{displayPrice price=$order->total_products_wt currency=$currency->id}</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="display:none;">&nbsp;</td>
</tr>
<tr id="total_discounts" {if $order->total_discounts_tax_incl == 0}style="display: none;"{/if}>
<td><b>{l s='Discounts'}</b></td>
<td class="amount" align="right">-{displayPrice price=$order->total_discounts_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="display:none;">&nbsp;</td>
</tr>
<tr id="total_wrapping" {if $order->total_wrapping_tax_incl == 0}style="display: none;"{/if}>
<td><b>{l s='Wrapping'}</b></td>
<td class="amount" align="right">{displayPrice price=$order->total_wrapping_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="display:none;">&nbsp;</td>
</tr>
<tr id="total_shipping">
<td><b>{l s='Shipping'}</b></td>
<td class="amount" align="right">{displayPrice price=$order->total_shipping_tax_incl currency=$currency->id}</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);"><input type="text" size="3" name="partialRefundShippingCost" /> &euro;</td>
<td class="partial_refund_fields current-edit" style="display:none;"><input type="text" size="3" name="partialRefundShippingCost" /> &euro;</td>
</tr>
<tr style="font-size: 20px" id="total_order">
<td style="font-size: 20px">{l s='Total'}</td>
<td class="amount" style="font-size: 20px" align="right">
{displayPrice price=$order->total_paid_tax_incl currency=$currency->id}
</td>
<td class="partial_refund_fields" style="display:none;background-color:rgb(232, 237, 194);">&nbsp;</td>
<td class="partial_refund_fields current-edit" style="display:none;">&nbsp;</td>
</tr>
</table>
</div>
+4
View File
@@ -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'),
),
);
@@ -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')
+1
View File
@@ -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); }
+1
View File
@@ -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`)
+1 -1
View File
@@ -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
+14
View File
@@ -227,6 +227,20 @@
{$tax_tab}
{if isset($order_invoice->note) && $order_invoice->note}
<div style="line-height: 1pt">&nbsp;</div>
<table style="width: 100%">
<tr>
<td style="width: 15%"></td>
<td style="width: 85%">
<p>
{$order_invoice->note|nl2br}
</p>
</td>
</tr>
</table>
{/if}
{if isset($HOOK_DISPLAY_PDF)}
<div style="line-height: 1pt">&nbsp;</div>
<table style="width: 100%">