[-] BO : Credit slips now appear in document section

This commit is contained in:
fSerny
2011-12-22 18:02:04 +00:00
parent 667dac5b95
commit 5d76d8cb8a
5 changed files with 45 additions and 29 deletions
+26 -3
View File
@@ -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