[+] BO : add new feature, Order edition
This commit is contained in:
+22
-4
@@ -66,13 +66,31 @@ function generateSupplyOrderFormPDF()
|
||||
|
||||
function generateInvoicePDF()
|
||||
{
|
||||
if (!isset($_GET['id_order']))
|
||||
die (Tools::displayError('Missing order ID'));
|
||||
$order = new Order((int)($_GET['id_order']));
|
||||
if (Tools::isSubmit('id_order'))
|
||||
generateInvoicePDFByIdOrder(Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
generateInvoicePDFByIdOrderInvoice(Tools::getValue('id_order_invoice'));
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order($id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
|
||||
generatePDF($order, PDF::TEMPLATE_INVOICE);
|
||||
generatePDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice($id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
die(Tools::displayError('Cannot find order invoice in database'));
|
||||
|
||||
generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateOrderSlipPDF()
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center" class="cancelCheck">--</td>
|
||||
<td align="center" class="cancelQuantity">--</td>
|
||||
</tr>
|
||||
{foreach from=$product.customizedDatas key=customizationId item=customization}
|
||||
<tr>
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<tr id="new_product" height="52" style="display:none;background-color:#E8EDC2">
|
||||
<td style="display:none;" colspan="2">
|
||||
<input type="hidden" id="add_product_product_id" name="add_product[product_id]" value="0" />
|
||||
{l s='Product:'} <input type="text" id="add_product_product_name" value="" size="42" />
|
||||
<div id="add_product_product_attribute_area" style="margin-top: 5px;display: none;">
|
||||
{l s='Combinations:'} <select name="add_product[product_attribute_id]" id="add_product_product_attribute_id"></select>
|
||||
</div>
|
||||
</td>
|
||||
<td style="display:none;">
|
||||
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="add_product[product_price_tax_excl]" id="add_product_product_price_tax_excl" value="" size="4" disabled="disabled" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
|
||||
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="add_product[product_price_tax_incl]" id="add_product_product_price_tax_incl" value="" size="4" disabled="disabled" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}<br />
|
||||
</td>
|
||||
<td style="display:none;" align="center" class="productQuantity"><input type="text" name="add_product[product_quantity]" id="add_product_product_quantity" value="1" size="3" disabled="disabled" /></td>
|
||||
{if ($order->hasBeenPaid())}<td style="display:none;" align="center" class="productQuantity"> </td>{/if}
|
||||
{if ($order->hasBeenDelivered())}<td style="display:none;" align="center" class="productQuantity"> </td>{/if}
|
||||
<td style="display:none;" align="center" class="productQuantity" id="add_product_product_stock">0</td>
|
||||
<td style="display:none;" align="center" id="add_product_product_total">{displayPrice price=0 currency=$currency->id}</td>
|
||||
<td style="display:none;" align="center" colspan="2">
|
||||
{if $order->valid}
|
||||
<select name="add_product[invoice]" id="add_product_product_invoice" disabled="disabled">
|
||||
<optgroup label="{l s='Existing'}">
|
||||
{foreach from=$invoices_collection item=invoice}
|
||||
<option value="{$invoice->id}">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
|
||||
{/foreach}
|
||||
</optgroup>
|
||||
<optgroup label="{l s='New'}">
|
||||
<option value="0">{l s='Create a new invoice'}</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
{/if}
|
||||
</td>
|
||||
<td style="display:none;">
|
||||
<input type="button" class="button" id="submitAddProduct" value="{l s='Add product'}" disabled="disabled" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="new_invoice" style="display:none;background-color:#E8EDC2">
|
||||
<td colspan="10">
|
||||
<h3>{l s='New invoice informations'}</h3>
|
||||
<label>{l s='Carrier:'}</label>
|
||||
<div class="margin-form">
|
||||
{$carrier->name}
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="checkbox" name="add_invoice[free_shipping]" value="1" />
|
||||
<label class="t">{l s='Free shipping'}</label>
|
||||
<p>{l s='If you don\'t select the "Free shipping", the normal shipping cost will be applied'}</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 10336 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{* Generate HTML code for printing Invoice Icon with link *}
|
||||
<span style="width:20px; margin-right:5px;">
|
||||
{if (($order_state->invoice && $order->invoice_number) && $tr['product_number'])}
|
||||
<a href="pdf.php?id_order={$order->id}&pdf"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
{* Generate HTML code for printing Delivery Icon with link *}
|
||||
<span style="width:20px;">
|
||||
{if ($order_state->delivery && $order->delivery_number)}
|
||||
<a href="pdf.php?id_delivery={$order->delivery_number}"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
</span>
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
{* Assign product price *}
|
||||
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
|
||||
{assign var=product_price value=($product['product_price'] + $product['ecotax'])}
|
||||
{assign var=product_price value=($product['unit_price_tax_excl'] + $product['ecotax'])}
|
||||
{else}
|
||||
{assign var=product_price value=$product['product_price_wt']}
|
||||
{assign var=product_price value=$product['unit_price_tax_incl']}
|
||||
{/if}
|
||||
|
||||
{if ($product['product_quantity'] > $product['customizationQuantityTotal'])}
|
||||
@@ -39,13 +39,31 @@
|
||||
{if $product.product_reference}{l s='Ref:'} {$product.product_reference}<br />{/if}
|
||||
{if $product.product_supplier_reference}{l s='Ref Supplier:'} {$product.product_supplier_reference}{/if}
|
||||
</a></td>
|
||||
<td align="center">{displayPrice price=$product_price currency=$currency->id}</td>
|
||||
<td align="center" class="productQuantity" {if ($product['product_quantity'] > 1)}style="font-weight:700;font-size:1.1em;color:red"{/if}>{$product['product_quantity']}</td>
|
||||
<td align="center">
|
||||
<span class="product_price_show">{displayPrice price=$product_price currency=$currency->id}</span>
|
||||
{if $can_edit}
|
||||
<span class="product_price_edit" style="display:none;">
|
||||
<input type="hidden" name="product_id_order_detail" class="edit_product_id_order_detail" value="{$product['id_order_detail']}" />
|
||||
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_excl" class="edit_product_price_tax_excl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_excl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax excl.'}<br />
|
||||
{if $currency->sign % 2}{$currency->sign}{/if}<input type="text" name="product_price_tax_incl" class="edit_product_price_tax_incl edit_product_price" value="{Tools::ps_round($product['unit_price_tax_incl'], 2)}" size="5" /> {if !($currency->sign % 2)}{$currency->sign}{/if} {l s='tax incl.'}
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td align="center" class="productQuantity">
|
||||
<span class="product_quantity_show">{$product['product_quantity']}</span>
|
||||
{if $can_edit}
|
||||
<span class="product_quantity_edit" style="display:none;">
|
||||
<input type="text" name="product_quantity" class="edit_product_quantity" value="{$product['product_quantity']}" size="2" />
|
||||
</span>
|
||||
{/if}
|
||||
</td>
|
||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['product_quantity_refunded']}</td>{/if}
|
||||
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['product_quantity_return']}</td>{/if}
|
||||
<td align="center" class="productQuantity">{StockManagerFactory::getManager()->getProductRealQuantities($product['product_id'], $product['product_attribute_id'], null, true)}</td>
|
||||
<td align="center">{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}</td>
|
||||
<td align="center" class="cancelCheck">
|
||||
<td align="center" class="productQuantity product_stock">{StockManagerFactory::getManager()->getProductRealQuantities($product['product_id'], $product['product_attribute_id'], null, true)}</td>
|
||||
<td align="center" class="total_product">
|
||||
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
||||
</td>
|
||||
<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']}" />
|
||||
<input type="hidden" name="productName" id="productName" value="{$product['product_name']}" />
|
||||
@@ -55,7 +73,7 @@
|
||||
--
|
||||
{/if}
|
||||
</td>
|
||||
<td class="cancelQuantity">
|
||||
<td class="cancelQuantity standard_refund_fields" style="background-color:rgb(232, 237, 194);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'))}
|
||||
@@ -76,5 +94,25 @@
|
||||
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="partialRefund[{$k}]" /> €</td>
|
||||
{if $can_edit}
|
||||
<td class="product_invoice" colspan="2" style="display: none;text-align:center;">
|
||||
{if $order->hasBeenPaid()}
|
||||
<select name="product_invoice" class="edit_product_invoice">
|
||||
{foreach from=$invoices_collection item=invoice}
|
||||
<option value="{$invoice->id}" {if $invoice->id == $product['id_order_invoice']}selected="selected"{/if}>#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{else}
|
||||
|
||||
{/if}
|
||||
</td>
|
||||
<td class="product_action" style="text-align:right">
|
||||
<a href="#" class="edit_product_change_link"><img src="../img/admin/edit.gif" alt="{l s='Edit'}" /></a>
|
||||
<input type="submit" class="button" name="submitProductChange" value="{l s='Update'}" style="display: none;" />
|
||||
<a href="#" class="cancel_product_change_link" style="display: none;"><img src="../img/admin/disabled.gif" alt="{l s='Cancel'}" /></a>
|
||||
<a href="#" class="delete_product_line"><img src="../img/admin/delete.gif" alt="{l s='Delete'}" /></a>
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -467,10 +467,10 @@
|
||||
products_found += '<label>{l s='Product:'}</label><select id="id_product" onclick="displayProductAttributes();">';
|
||||
attributes_html += '<label>{l s='Combination:'}</label>';
|
||||
$.each(res.products, function() {
|
||||
products_found += '<option '+(this.combinations.length > 0 ? 'rel="'+this.qty_in_stock+'"' : '')+' value="'+this.id_product+'">'+this.name+(this.combinations.length == 0 ? ' - '+this.price : '')+'</option>';
|
||||
products_found += '<option '+(this.combinations.length > 0 ? 'rel="'+this.qty_in_stock+'"' : '')+' value="'+this.id_product+'">'+this.name+(this.combinations.length == 0 ? ' - '+this.formatted_price : '')+'</option>';
|
||||
attributes_html += '<select class="id_product_attribute" id="ipa_'+this.id_product+'" style="display:none;">';
|
||||
$.each(this.combinations, function() {
|
||||
attributes_html += '<option rel="'+this.qty_in_stock+'" '+(this.default_on == 1 ? 'selected="selected"' : '')+' value="'+this.id_product_attribute+'">'+this.attributes+' - '+this.price+'</option>';
|
||||
attributes_html += '<option rel="'+this.qty_in_stock+'" '+(this.default_on == 1 ? 'selected="selected"' : '')+' value="'+this.id_product_attribute+'">'+this.attributes+' - '+this.formatted_price+'</option>';
|
||||
});
|
||||
attributes_html += '</select>';
|
||||
});
|
||||
@@ -508,7 +508,7 @@
|
||||
var cart_content = '';
|
||||
$.each(products, function() {
|
||||
cart_quantity[this.id_product+'_'+this.id_product_attribute] = this.cart_quantity;
|
||||
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="'+this.price+'" /> <span class="currency_sign"></span></td><td>';
|
||||
cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" size="7" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="'+this.formatted_price+'" /> <span class="currency_sign"></span></td><td>';
|
||||
cart_content += '<p><a href="#" class="delete_product" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'" ><img src="../img/admin/delete.gif" /></a>';
|
||||
cart_content += '<a href="#" class="increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'" ><img src="../img/admin/up.gif" /></a><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="cart_quantity" size="2" value="'+this.cart_quantity+'" /></p>';
|
||||
cart_content += '<p style="float:right"><center><a href="#" class="decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'"><img src="../img/admin/down.gif" /></center></a>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user