Fixes for locked invoice status

This commit is contained in:
David Bomba 2024-09-23 16:34:13 +10:00
parent 28775c087e
commit acbb5d475c
2 changed files with 6 additions and 3 deletions

View File

@ -33,7 +33,10 @@ class QuickbooksSyncMap
{ {
$this->sync = $attributes['sync'] ?? true; $this->sync = $attributes['sync'] ?? true;
$this->update_record = $attributes['update_record'] ?? 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;
} }
} }

View File

@ -585,7 +585,7 @@ class Invoice extends BaseModel
* Filtering logic to determine * Filtering logic to determine
* whether an invoice is locked * whether an invoice is locked
* based on the current status of the invoice. * based on the current status of the invoice.
* @return bool [description] * @return bool
*/ */
public function isLocked(): bool public function isLocked(): bool
{ {
@ -595,7 +595,7 @@ class Invoice extends BaseModel
case 'off': case 'off':
return false; return false;
case 'when_sent': case 'when_sent':
return $this->status_id == self::STATUS_SENT; return $this->status_id >= self::STATUS_SENT;
case 'when_paid': case 'when_paid':
return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL; return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL;
case 'end_of_month': case 'end_of_month':