diff --git a/app/Helpers/Epc/EpcQrGenerator.php b/app/Helpers/Epc/EpcQrGenerator.php index 07bfc9080cd6..e0899f61ff52 100644 --- a/app/Helpers/Epc/EpcQrGenerator.php +++ b/app/Helpers/Epc/EpcQrGenerator.php @@ -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)) {