1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add purpose code if available

This commit is contained in:
David Bomba 2024-05-15 20:57:40 +10:00
parent a212c04ace
commit f7fb20a7ec

View File

@ -82,13 +82,22 @@ class EpcQrGenerator
$this->company->present()->name(),
isset($this->company?->custom_fields?->company1) ? $this->company->settings->custom_value1 : '',
$this->formatMoney($this->amount),
$this->sepa['purpose'],
$this->getPurposeCode(),
substr($this->invoice->number, 0, 34),
'',
' '
]), "\n");
}
private function getPurposeCode(): string
{
if(isset($this->invoice->client->id_number) && strlen($this->invoice->client->id_number) > 2)
return $this->invoice->client->id_number;
return $this->sepa['purpose'];
}
private function validateFields()
{
if (Ninja::isSelfHost() && isset($this->company?->custom_fields?->company2)) {