[+] BO : on order edition, you can add a discount

[+] BO : on order edition, you can delete a discount
// Adding two new columns in order_cart_rule table: id_order_invoice, value_tax_excl
This commit is contained in:
aFolletete
2011-12-18 17:18:54 +00:00
parent 6af99d043a
commit a299b66c33
9 changed files with 381 additions and 48 deletions
@@ -43,8 +43,8 @@
<textarea name="note" rows="10" cols="10" id="editNote{$document->id}" class="edit-note">{$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="$('#invoiceNote{$document->id}').hide();" class="button" />
<input type="submit" name="submitEditNote" value="{l s='Save'}" class="button" />&nbsp;
<a href="#" id="cancelNote" onclick="$('#invoiceNote{$document->id}').hide();return false;">{l s='Cancel'}</a>
</p>
</form>
</td>
+70 -3
View File
@@ -544,7 +544,7 @@
</div>
<div style="float:right;">
<table class="table" width="300px;" cellspacing="0" cellpadding="0">
<table class="table" width="450px;" cellspacing="0" cellpadding="0">
<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>
@@ -576,12 +576,13 @@
</div>
<div class="clear"></div>
{if (sizeof($discounts))}
<div style="float:right; width:280px; margin-top:15px;">
{if (sizeof($discounts) || $can_edit)}
<div style="float:right; width:450px; margin-top:15px;">
<table cellspacing="0" cellpadding="0" class="table" style="width:100%;">
<tr>
<th><img src="../img/admin/coupon.gif" alt="{l s='Discounts'}" />{l s='Discount name'}</th>
<th align="center" style="width: 100px">{l s='Value'}</th>
{if $can_edit}<th align="center" style="width: 30px">{l s='Action'}</th>{/if}
</tr>
{foreach from=$discounts item=discount}
<tr>
@@ -592,8 +593,74 @@
{/if}
{displayPrice price=$discount['value'] currency=$currency->id}
</td>
{if $can_edit}
<td class="center">
<a href="{$currentIndex}&submitDeleteVoucher&id_order_cart_rule={$discount['id_order_cart_rule']}&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}"><img src="../img/admin/delete.gif" alt="{l s='Delete voucher'}" /></a>
</td>
{/if}
</tr>
{/foreach}
{if $can_edit}
<tr>
<td colspan="3" class="center">
<a href="#" id="add_voucher"><img src="../img/admin/add.gif" alt="{l s='Add'}" /> {l s='Add a new discount'}</a>
</td>
</tr>
<tr style="display: none" >
<td colspan="3" class="current-edit" id="voucher_form">
<form method="POST" action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<label>{l s='Name'}</label>
<div class="margin-form">
<input type="text" name="discount_name" value="" />
</div>
<label>{l s='Type'}</label>
<div class="margin-form">
<select name="discount_type" id="discount_type">
<option value="1">{l s='Percent'}</option>
<option value="2">{l s='Amount'}</option>
<option value="3">{l s='Free shipping'}</option>
</select>
</div>
<div id="discount_value_field">
<label>{l s='Value'}</label>
<div class="margin-form">
{if ($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<input type="text" name="discount_value" size="3" />
{if !($currency->format % 2)}
<span id="discount_currency_sign" style="display: none;">{$currency->sign}</span>
{/if}
<span id="discount_percent_symbol">%</span>
<p class="preference_description" id="discount_value_help" style="width: 95%;display: none;">
{l s='This value must be taxes included.'}
</p>
</div>
</div>
<label>{l s='Invoice'}</label>
<div class="margin-form">
<select name="discount_invoice">
{foreach from=$invoices_collection item=invoice}
<option value="{$invoice->id}" selected="selected">#{Configuration::get('PS_INVOICE_PREFIX', $current_id_lang)}{'%06d'|sprintf:$invoice->number} - {displayPrice price=$invoice->total_paid_tax_incl currency=$order->id_currency}</option>
{/foreach}
</select><br />
<input type="checkbox" name="discount_all_invoices" id="discount_all_invoices" value="1" /> <label class="t" for="discount_all_invoices">{l s='Apply on all invoices'}</label>
<p class="preference_description" style="width: 95%">
{l s='If you select to create this discount for all invoices, one discount will be created per order invoice.'}
</p>
</div>
<p class="center">
<input class="button" type="submit" name="submitNewVoucher" value="{l s='Add'}" />&nbsp;
<a href="#" id="cancel_add_voucher">{l s='Cancel'}</a>
</p>
</form>
</td>
</tr>
{/if}
</table>
</div>
{/if}