[-] BO : Credit slips now appear in document section
This commit is contained in:
@@ -10,30 +10,34 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$order->getDocuments() item=document}
|
||||
{*if TYPE DOCUMENT = INVOICE *}
|
||||
<tr class="invoice_line" id="invoice_{$document->id}">
|
||||
{*/if*}
|
||||
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
<tr class="invoice_line" id="invoice_{$document->id}">
|
||||
{elseif get_class($document) eq 'OrderSlip'}
|
||||
<tr class="invoice_line" id="orderslip_{$document->id}">
|
||||
{/if}
|
||||
|
||||
<td class="document_date">{dateFormat date=$document->date_add}</td>
|
||||
<td class="document_type">Invoice</td>
|
||||
<td class="document_number"><a target="_blank" href="pdf.php?pdf&id_order_invoice={$document->id}">{$document->getInvoiceNumberFormatted($current_id_lang)} <img src="../img/admin/details.gif" alt="{l s='See the invoice'}" /></a></td>
|
||||
<td class="document_type">{if get_class($document) eq 'OrderInvoice'}Invoice{elseif get_class($document) eq 'OrderSlip'}Credit Slip{/if}</td>
|
||||
<td class="document_number"><a target="_blank" href="{if get_class($document) eq 'OrderInvoice'}pdf.php?pdf&id_order_invoice={$document->id}{elseif get_class($document) eq 'OrderSlip'}pdf.php?id_order_slip={$document->id}{/if}">{if get_class($document) eq 'OrderInvoice'}{$document->getInvoiceNumberFormatted($current_id_lang)}{elseif get_class($document) eq 'OrderSlip'}{l s='#'}{'%06d'|sprintf:$document->id}{/if} <img src="../img/admin/details.gif" alt="{l s='See the invoice'}" /></a></td>
|
||||
<td class="document_amount">
|
||||
{*if TYPE DOCUMENT = INVOICE *}
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
{displayPrice price=$document->total_paid_tax_incl currency=$currency->id}
|
||||
{if $document->getRestPaid()}
|
||||
<span style="color:red;font-weight:bold;">({displayPrice price=$document->getRestPaid() currency=$currency->id} {l s='not paid'})</span>
|
||||
{/if}
|
||||
{*/if*}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="right document_action">
|
||||
{*if TYPE DOCUMENT = INVOICE *}
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
{if $document->getRestPaid()}
|
||||
<a href="#" class="js-set-payment" data-amount="{$document->getRestPaid()}" data-id-invoice="{$document->id}" title="{l s='Set payment form'}"><img src="../img/admin/money_add.png" alt="{l s='Set payment form'}" /></a>
|
||||
{/if}
|
||||
<a href="#" onclick="$('#invoiceNote{$document->id}').show(); return false;" title="{if $document->note eq ''}{l s='Add note'}{else}{l s='Edit note'}{/if}"><img src="../img/admin/note.png" alt="{if $document->note eq ''}{l s='Add note'}{else}{l s='Edit note'}{/if}"{if $document->note eq ''} class="js-disabled-action"{/if} /></a>
|
||||
{*/if*}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{*if TYPE DOCUMENT = INVOICE *}
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
<tr id="invoiceNote{$document->id}" style="display:none" class="current-edit">
|
||||
<td colspan="5">
|
||||
<form action="{$currentIndex}&viewOrder&id_order={$smarty.get.id_order|escape:'htmlall':'UTF-8'}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}" method="post">
|
||||
@@ -49,7 +53,7 @@
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{*/if*}
|
||||
{/if}
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="5" class="center">
|
||||
@@ -59,4 +63,4 @@
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
@@ -692,18 +692,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div style="float: left; margin-left: 40px">
|
||||
<fieldset style="width: 400px;">
|
||||
<legend><img src="../img/admin/slip.gif" alt="{l s='Credit slip'}" />{l s='Credit slip'}</legend>
|
||||
{if (!sizeof($slips))}
|
||||
{l s='No slip for this order.'}
|
||||
{else}
|
||||
{foreach from=$slips item=slip}
|
||||
({dateFormat date=$slip['date_upd']}) : <b><a href="pdf.php?id_order_slip={$slip['id_order_slip']}">{l s='#'}{'%06d'|sprintf:$slip['id_order_slip']}</a></b><br />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="clear"> </div>
|
||||
<br /><br /><a href="{$currentIndex}&token={$smarty.get.token}"><img src="../img/admin/arrow2.gif" /> {l s='Back to list'}</a><br />
|
||||
|
||||
|
||||
@@ -238,6 +238,7 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
||||
*/
|
||||
public function getResults()
|
||||
{
|
||||
$this->getAll();
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
@@ -457,4 +458,4 @@ class CollectionCore implements Iterator, ArrayAccess, Countable
|
||||
$this->alias[$association] = 'a'.$this->alias_iterator++;
|
||||
return $this->alias[$association];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-3
@@ -1394,10 +1394,18 @@ class OrderCore extends ObjectModel
|
||||
*/
|
||||
public function getDocuments()
|
||||
{
|
||||
// TODO
|
||||
$invoices = $this->getInvoicesCollection();
|
||||
$invoices = $this->getInvoicesCollection()->getResults();
|
||||
$order_slips = $this->getOrderSlipsCollection()->getResults();
|
||||
$documents = array_merge($invoices, $order_slips);
|
||||
function sortDocuments($a, $b)
|
||||
{
|
||||
if ($a->date_add == $b->date_add)
|
||||
return 0;
|
||||
return ($a->date_add < $b->date_add) ? -1 : 1;
|
||||
}
|
||||
usort($documents, "sortDocuments");
|
||||
|
||||
return $invoices;
|
||||
return $documents;
|
||||
}
|
||||
|
||||
public function getReturn()
|
||||
@@ -1424,6 +1432,21 @@ class OrderCore extends ObjectModel
|
||||
WHERE o.`id_order` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get all order_slips for the current order
|
||||
* @since 1.5.0.1
|
||||
* @return Collection of Order slip
|
||||
*/
|
||||
public function getOrderSlipsCollection()
|
||||
{
|
||||
$order_slips = new Collection('OrderSlip');
|
||||
$order_slips->where('id_order', '=', $this->id);
|
||||
return $order_slips;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get all invoices for the current order
|
||||
|
||||
@@ -1026,7 +1026,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), // Get the sum of total_paid_tax_incl of the order with similar reference
|
||||
'total_paid' => $order->getTotalPaid(),
|
||||
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
|
||||
'slips' => OrderSlip::getOrdersSlip($order->id_customer, $order->id),
|
||||
'orderMessages' => OrderMessage::getOrderMessages($order->id_lang),
|
||||
'messages' => Message::getMessagesByOrderId($order->id, true),
|
||||
'carrier' => new Carrier($order->id_carrier),
|
||||
|
||||
Reference in New Issue
Block a user