From acbb5d475c048fb89807e3928b23dd9c0e3c93a1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 23 Sep 2024 16:34:13 +1000 Subject: [PATCH] Fixes for locked invoice status --- app/DataMapper/QuickbooksSyncMap.php | 5 ++++- app/Models/Invoice.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/DataMapper/QuickbooksSyncMap.php b/app/DataMapper/QuickbooksSyncMap.php index ef3da4f34c96..40250b61f103 100644 --- a/app/DataMapper/QuickbooksSyncMap.php +++ b/app/DataMapper/QuickbooksSyncMap.php @@ -33,7 +33,10 @@ class QuickbooksSyncMap { $this->sync = $attributes['sync'] ?? true; $this->update_record = $attributes['update_record'] ?? true; - $this->direction = $attributes['direction'] ?? SyncDirection::BIDIRECTIONAL; + $this->direction = isset($attributes['direction']) + ? SyncDirection::from($attributes['direction']) + : SyncDirection::BIDIRECTIONAL; + } } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 203061b972d7..1cfd1df3404e 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -585,7 +585,7 @@ class Invoice extends BaseModel * Filtering logic to determine * whether an invoice is locked * based on the current status of the invoice. - * @return bool [description] + * @return bool */ public function isLocked(): bool { @@ -595,7 +595,7 @@ class Invoice extends BaseModel case 'off': return false; case 'when_sent': - return $this->status_id == self::STATUS_SENT; + return $this->status_id >= self::STATUS_SENT; case 'when_paid': return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL; case 'end_of_month':