From 1de6086c215b75cd963521b9eadc8e70d0e51373 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 10 Aug 2023 18:30:05 +1000 Subject: [PATCH] Adjustments for Facturae 3.2.2 --- app/Services/Invoice/EInvoice/FacturaEInvoice.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/Invoice/EInvoice/FacturaEInvoice.php b/app/Services/Invoice/EInvoice/FacturaEInvoice.php index 9f97da9e4519..700bad3602a8 100644 --- a/app/Services/Invoice/EInvoice/FacturaEInvoice.php +++ b/app/Services/Invoice/EInvoice/FacturaEInvoice.php @@ -218,8 +218,10 @@ class FacturaEInvoice extends AbstractService private function setPoNumber(): self { $po = $this->invoice->po_number ?? ''; + $transaction_reference = (isset($this->invoice->custom_value1) && strlen($this->invoice->custom_value1) > 2) ? substr($this->invoice->custom_value1, 0, 20) : null; + $contract_reference = (isset($this->invoice->custom_value2) && strlen($this->invoice->custom_value2) > 2) ? $this->invoice->custom_value2: null; - $this->fac->setReferences($po, substr($this->invoice->custom_value1, 0, 20), $this->invoice->custom_value2); + $this->fac->setReferences($po, $transaction_reference, $contract_reference); return $this; } @@ -242,6 +244,9 @@ class FacturaEInvoice extends AbstractService private function setBillingPeriod(): self { + if(!$this->invoice->custom_value3) + return $this; + try { if (\Carbon\Carbon::createFromFormat('Y-m-d', $this->invoice->custom_value3)->format('Y-m-d') === $this->invoice->custom_value3 && \Carbon\Carbon::createFromFormat('Y-m-d', $this->invoice->custom_value4)->format('Y-m-d') === $this->invoice->custom_value4