Adjust number applying on Purchase orders when_sent / when_saved

This commit is contained in:
David Bomba 2022-07-02 11:40:51 +10:00
parent 6e5f5da6bb
commit 6faa3a0ccb
2 changed files with 17 additions and 1 deletions

View File

@ -923,6 +923,9 @@ class Import implements ShouldQueue
$modified['company_id'] = $this->company->id; $modified['company_id'] = $this->company->id;
$modified['line_items'] = $this->cleanItems($modified['line_items']); $modified['line_items'] = $this->cleanItems($modified['line_items']);
if(array_key_exists('next_send_date', $resource))
$modified['next_send_date_client'] = $resource['next_send_date'];
if(array_key_exists('created_at', $modified)) if(array_key_exists('created_at', $modified))
$modified['created_at'] = Carbon::parse($modified['created_at']); $modified['created_at'] = Carbon::parse($modified['created_at']);

View File

@ -41,7 +41,20 @@ class ApplyNumber extends AbstractService
return $this->purchase_order; return $this->purchase_order;
} }
switch ($this->vendor->company->getSetting('counter_number_applied')) {
case 'when_saved':
$this->trySaving(); $this->trySaving();
break;
case 'when_sent':
if ($this->invoice->status_id == PurchaseOrder::STATUS_SENT) {
$this->trySaving();
}
break;
default:
break;
}
return $this->purchase_order; return $this->purchase_order;
} }