Move payment numbering into service

This commit is contained in:
David Bomba 2022-08-05 08:08:19 +10:00
parent e976a4d8fb
commit 0c05370686
2 changed files with 7 additions and 1 deletions

View File

@ -172,6 +172,11 @@ class Vendor extends BaseModel
return $this->company->company_key.'/'.$this->vendor_hash.'/'.$contact_key.'/purchase_orders/'; return $this->company->company_key.'/'.$this->vendor_hash.'/'.$contact_key.'/purchase_orders/';
} }
public function locale()
{
return $this->company->locale();
}
public function country() public function country()
{ {
return $this->belongsTo(Country::class); return $this->belongsTo(Country::class);

View File

@ -55,7 +55,6 @@ class MarkPaid extends AbstractService
$payment->amount = $this->invoice->balance; $payment->amount = $this->invoice->balance;
$payment->applied = $this->invoice->balance; $payment->applied = $this->invoice->balance;
$payment->number = $this->getNextPaymentNumber($this->invoice->client, $payment);
$payment->status_id = Payment::STATUS_COMPLETED; $payment->status_id = Payment::STATUS_COMPLETED;
$payment->client_id = $this->invoice->client_id; $payment->client_id = $this->invoice->client_id;
$payment->transaction_reference = ctrans('texts.manual_entry'); $payment->transaction_reference = ctrans('texts.manual_entry');
@ -74,6 +73,8 @@ class MarkPaid extends AbstractService
$payment->saveQuietly(); $payment->saveQuietly();
$payment->service()->applyNumber()->save();
$this->setExchangeRate($payment); $this->setExchangeRate($payment);
/* Create a payment relationship to the invoice entity */ /* Create a payment relationship to the invoice entity */