Move charge actions to ChargeController, implemented charge delete
This commit is contained in:
@@ -70,7 +70,7 @@ class Charge extends Model
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
public function getNameAttribute()
|
||||
public function getNameAttribute(): string
|
||||
{
|
||||
return sprintf('%s %s',
|
||||
$this->description,
|
||||
@@ -93,4 +93,14 @@ class Charge extends Model
|
||||
{
|
||||
return Arr::get(InvoiceItem::type,$this->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this charge processable
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUnprocessedAttribute(): bool
|
||||
{
|
||||
return $this->active && (! $this->processed);
|
||||
}
|
||||
}
|
@@ -1275,7 +1275,7 @@ class Service extends Model implements IDs
|
||||
if ((($future == TRUE) OR (($future == FALSE) AND ($this->invoice_to >= $billdate)))
|
||||
AND ! $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) {
|
||||
foreach ($this->charges->filter(function($item) { return $item->unprocessed; }) as $oo) {
|
||||
$o = new InvoiceItem;
|
||||
$o->active = TRUE;
|
||||
$o->service_id = $oo->service_id;
|
||||
|
Reference in New Issue
Block a user