From 540dd2f43e261a7af18d6a0db49cbfbbb3fbcb94 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 22 Jun 2024 20:33:53 +1000 Subject: [PATCH] minor fixes --- app/Jobs/Entity/CreateRawPdf.php | 3 +-- app/Listeners/Invoice/UpdateInvoiceActivity.php | 1 + app/Repositories/ActivityRepository.php | 2 ++ app/Services/Invoice/InvoiceService.php | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Entity/CreateRawPdf.php b/app/Jobs/Entity/CreateRawPdf.php index 45483faf156f..4d52e4319758 100644 --- a/app/Jobs/Entity/CreateRawPdf.php +++ b/app/Jobs/Entity/CreateRawPdf.php @@ -112,8 +112,7 @@ class CreateRawPdf try { $pdf = $ps->boot()->getPdf(); } catch (\Exception $e) { - echo "EXCEPTION::".PHP_EOL; - echo $e->getMessage().PHP_EOL; + nlog($e->getMessage()); throw new FilePermissionsFailure('Unable to generate the raw PDF'); } diff --git a/app/Listeners/Invoice/UpdateInvoiceActivity.php b/app/Listeners/Invoice/UpdateInvoiceActivity.php index c783e1299161..1b346b2bbf44 100644 --- a/app/Listeners/Invoice/UpdateInvoiceActivity.php +++ b/app/Listeners/Invoice/UpdateInvoiceActivity.php @@ -21,6 +21,7 @@ class UpdateInvoiceActivity implements ShouldQueue { protected $activity_repo; + public $delay = 10; /** * Create the event listener. * diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index b802cec68888..035faa5efa6a 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -81,6 +81,8 @@ class ActivityRepository extends BaseRepository return; } + $entity = $entity->fresh(); + if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 13f94fe63656..00c619d6236c 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -292,9 +292,9 @@ class InvoiceService //12-10-2022 if ($this->invoice->partial > 0 && !$this->invoice->partial_due_date) { - $this->invoice->partial_due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); + $this->invoice->partial_due_date = Carbon::parse($this->invoice->date)->addDays((int)$this->invoice->client->getSetting('payment_terms')); } else { - $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); + $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays((int)$this->invoice->client->getSetting('payment_terms')); } return $this;