Fix adding the product_id to account based charges (when services are not active)
This commit is contained in:
@@ -70,13 +70,13 @@ class InvoiceAdd extends Command
|
||||
sprintf('%s.%s.%s.%s',
|
||||
$item->item_type_name,
|
||||
$item->price_base,
|
||||
$item->product->provider_ref($to->provider),
|
||||
$item->product?->provider_ref($to->provider),
|
||||
$item->taxes->pluck('description')->join('|'))) as $os)
|
||||
{
|
||||
$key = $os->first();
|
||||
|
||||
// Some validation
|
||||
if (! ($ref=$key->product->provider_ref($to->provider))) {
|
||||
if (! ($ref=$key->product?->provider_ref($to->provider))) {
|
||||
$this->error(sprintf('Accounting not defined in product [%d]',$key->product_id));
|
||||
|
||||
return self::FAILURE;
|
||||
|
@@ -285,7 +285,7 @@ class Account extends Model implements IDs
|
||||
|
||||
$ii->active = TRUE;
|
||||
$ii->service_id = $oo->service_id;
|
||||
$ii->product_id = $this->product_id;
|
||||
$ii->product_id = $oo->product_id;
|
||||
$ii->quantity = $oo->quantity;
|
||||
$ii->item_type = $oo->type;
|
||||
$ii->price_base = $oo->amount;
|
||||
|
Reference in New Issue
Block a user