Adjustments for Facturae 3.2.2

This commit is contained in:
David Bomba 2023-08-10 18:30:05 +10:00
parent e1863394ef
commit 1de6086c21

View File

@ -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