From a65c81871b6fab4b51a7d97a2b078bae428e1adc Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 16 Sep 2024 11:36:55 +1000 Subject: [PATCH] Fix adding the product_id to account based charges (when services are not active) --- app/Console/Commands/Intuit/InvoiceAdd.php | 4 ++-- app/Models/Account.php | 2 +- public/css/fixes.css | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/Intuit/InvoiceAdd.php b/app/Console/Commands/Intuit/InvoiceAdd.php index 2ccecb2..fd62b28 100644 --- a/app/Console/Commands/Intuit/InvoiceAdd.php +++ b/app/Console/Commands/Intuit/InvoiceAdd.php @@ -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; diff --git a/app/Models/Account.php b/app/Models/Account.php index de682e7..b4d4198 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -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; diff --git a/public/css/fixes.css b/public/css/fixes.css index b4788e6..deadb46 100644 --- a/public/css/fixes.css +++ b/public/css/fixes.css @@ -84,7 +84,7 @@ span.select2-selection.select2-selection--single > span.select2-selection__rende width: 100%; } -/* Render the invalid red when a select container fails vlidation */ +/* Render the invalid red when a select container fails validation */ .is-invalid + .select2-container--default .select2-selection--single, .is-invalid + .select2-container--default .select2-selection--multiple { border: 1px solid #dc3545;