From 01404a75f612a1e1b38d967f0103bc2370628558 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 24 Mar 2023 14:03:58 +1100 Subject: [PATCH 1/3] dynamically load broadcaster --- app/Providers/AppServiceProvider.php | 7 +++++++ config/app.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ed8b2a643c0c..041b2d2c8d1b 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -121,4 +121,11 @@ class AppServiceProvider extends ServiceProvider Artisan::call('db:seed'); }); } + + public function register(): void + { + + $this->app->register(\App\Providers\BroadcastServiceProvider::class); + + } } diff --git a/config/app.php b/config/app.php index 16c82b06b607..225f88c32d82 100644 --- a/config/app.php +++ b/config/app.php @@ -194,7 +194,7 @@ return [ */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, - App\Providers\BroadcastServiceProvider::class, + // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, App\Providers\ComposerServiceProvider::class, From 3daa49a6188408139eb93e61722f45511c63c54a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 24 Mar 2023 14:04:46 +1100 Subject: [PATCH 2/3] Dynamically load broadcastprovider --- app/Providers/AppServiceProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b44c4447e2bd..d0f17d0a170c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -123,8 +123,8 @@ class AppServiceProvider extends ServiceProvider public function register(): void { - - $this->app->register(\App\Providers\BroadcastServiceProvider::class); - + if (Ninja::isHosted()) { + $this->app->register(\App\Providers\BroadcastServiceProvider::class); + } } } From 0472cb97f8d025eb15fe6c70599bea1cfa73fd3d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 25 Mar 2023 11:51:06 +1100 Subject: [PATCH 3/3] Fixes for recurring price increases/updates --- app/Jobs/RecurringInvoice/UpdateRecurring.php | 2 ++ app/Services/Recurring/UpdatePrice.php | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Jobs/RecurringInvoice/UpdateRecurring.php b/app/Jobs/RecurringInvoice/UpdateRecurring.php index 5c124922b059..ee0527bcab83 100644 --- a/app/Jobs/RecurringInvoice/UpdateRecurring.php +++ b/app/Jobs/RecurringInvoice/UpdateRecurring.php @@ -40,6 +40,8 @@ class UpdateRecurring implements ShouldQueue { MultiDB::setDb($this->company->db); + $this->user->setCompany($this->company); + RecurringInvoice::where('company_id', $this->company->id) ->whereIn('id', $this->ids) ->chunk(100, function ($recurring_invoices) { diff --git a/app/Services/Recurring/UpdatePrice.php b/app/Services/Recurring/UpdatePrice.php index 1666f1c4a4f1..92600b9ec7a7 100644 --- a/app/Services/Recurring/UpdatePrice.php +++ b/app/Services/Recurring/UpdatePrice.php @@ -26,17 +26,19 @@ class UpdatePrice extends AbstractService $line_items = $this->recurring_invoice->line_items; foreach ($line_items as $key => $line_item) { + $product = Product::where('company_id', $this->recurring_invoice->company_id) ->where('product_key', $line_item->product_key) ->where('is_deleted', 0) ->first(); if ($product) { - $line_items[$key]->cost = $product->cost; + $line_items[$key]->cost = floatval($product->cost); } } $this->recurring_invoice->line_items = $line_items; + $this->recurring_invoice->calc()->getInvoice()->save(); } }