Set default payment type if none defined

This commit is contained in:
David Bomba 2021-10-12 21:48:07 +11:00
parent d9b7ffe9f1
commit c4f09c23ba

View File

@ -58,11 +58,17 @@ class MarkPaid extends AbstractService
$payment->transaction_reference = ctrans('texts.manual_entry');
$payment->currency_id = $this->invoice->client->getSetting('currency_id');
$payment->is_manual = true;
/* Create a payment relationship to the invoice entity */
$payment_type_id = $this->invoice->client->getSetting('payment_type_id');
if((int)$payment_type_id > 0)
$payment->type_id = (int)$payment_type_id;
$payment->save();
$this->setExchangeRate($payment);
/* Create a payment relationship to the invoice entity */
$payment->invoices()->attach($this->invoice->id, [
'amount' => $payment->amount,
]);