Fix for invoice with sub-items
This commit is contained in:
@@ -43,7 +43,7 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
|
||||
// Items belonging to an invoice
|
||||
protected $_sub_items_load = array(
|
||||
'invoice_item'=>'service_id,item_type,date_start,date_stop',
|
||||
'invoice_item'=>array('service_id','item_type','date_start','date_stop'),
|
||||
);
|
||||
|
||||
protected $_compress_column = array(
|
||||
@@ -58,6 +58,12 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
return new Cart_Item(1,sprintf('Invoice: %s',$this->refnum()),$this->due());
|
||||
}
|
||||
|
||||
public function add_sub_item(Model_Invoice_Item $iio,$taxed=FALSE) {
|
||||
$iio->add_sub_item($this->account->country,$taxed);
|
||||
|
||||
$this->subitem_add($iio);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if this invoice is already in the cart
|
||||
*/
|
||||
@@ -403,17 +409,6 @@ class Model_Invoice extends ORM_OSB implements Cartable {
|
||||
return $this->saved();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to an invoice
|
||||
*/
|
||||
public function subitem_add(Model_Invoice_Item $iio,Model_Country $co,$taxed=FALSE) {
|
||||
$iio->subitem_add($co,$taxed);
|
||||
|
||||
array_push($this->_sub_items,$iio);
|
||||
|
||||
$this->_sub_items_sorted = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of invoice items for this invoice.
|
||||
* @param type [CHARGE|CREDIT|ALL]
|
||||
|
Reference in New Issue
Block a user