Fix rendering of future charge items
This commit is contained in:
parent
9ab30086fc
commit
fb9ccd927d
@ -107,7 +107,7 @@ class InvoiceItem extends Model
|
||||
);
|
||||
|
||||
default:
|
||||
return Arr::get($types,$this->item_type,'Unknown');
|
||||
return ($this->module_id == 30 ? 'Additional Charge: ' : '').Arr::get($types,$this->item_type,'Unknown');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -840,22 +840,23 @@ class Service extends Model
|
||||
}
|
||||
|
||||
// Add additional charges
|
||||
foreach ($this->charges->filter(function($item) { return ! $item->processed; }) as $oo) {
|
||||
$o = new InvoiceItem;
|
||||
$o->active = TRUE;
|
||||
$o->service_id = $oo->service_id;
|
||||
$o->product_id = $this->product_id;
|
||||
$o->quantity = $oo->quantity;
|
||||
$o->item_type = $oo->type;
|
||||
$o->price_base = $oo->amount;
|
||||
$o->date_start = $oo->date_charge;
|
||||
$o->date_stop = $oo->date_charge;
|
||||
$o->module_id = 30; // @todo This shouldnt be hard coded
|
||||
$o->module_ref = $oo->id;
|
||||
if (! $this->invoice_items->filter(function($item) { return $item->module_id == 30 AND ! $item->exists; })->count())
|
||||
foreach ($this->charges->filter(function($item) { return ! $item->processed; }) as $oo) {
|
||||
$o = new InvoiceItem;
|
||||
$o->active = TRUE;
|
||||
$o->service_id = $oo->service_id;
|
||||
$o->product_id = $this->product_id;
|
||||
$o->quantity = $oo->quantity;
|
||||
$o->item_type = $oo->type;
|
||||
$o->price_base = $oo->amount;
|
||||
$o->date_start = $oo->date_charge;
|
||||
$o->date_stop = $oo->date_charge;
|
||||
$o->module_id = 30; // @todo This shouldnt be hard coded
|
||||
$o->module_ref = $oo->id;
|
||||
|
||||
$o->addTaxes($this->account->country->taxes);
|
||||
$this->invoice_items->push($o);
|
||||
}
|
||||
$o->addTaxes($this->account->country->taxes);
|
||||
$this->invoice_items->push($o);
|
||||
}
|
||||
|
||||
return $this->invoice_items->filter(function($item) { return ! $item->exists; });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user