diff --git a/app/Jobs/EDocument/CreateEDocument.php b/app/Jobs/EDocument/CreateEDocument.php index c78f89c29edd..f8e0dba24af5 100644 --- a/app/Jobs/EDocument/CreateEDocument.php +++ b/app/Jobs/EDocument/CreateEDocument.php @@ -60,7 +60,8 @@ class CreateEDocument implements ShouldQueue /* Set customized translations _NOW_ */ $t->replace(Ninja::transformTranslations($this->document->client->getMergedSettings())); - $e_document_type = $this->document->client->getSetting('e_invoice_type'); + $e_document_type = $settings_entity->getSetting('e_invoice_type') ? $settings_entity->getSetting('e_invoice_type') : "XInvoice_3_0"; + $e_quote_type = $settings_entity->getSetting('e_quote_type') ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended"; if ($this->document instanceof Invoice){ switch ($e_document_type) { case "EN16931": @@ -89,7 +90,7 @@ class CreateEDocument implements ShouldQueue } } elseif ($this->document instanceof Quote){ - switch ($e_document_type){ + switch ($e_quote_type){ case "OrderX_Basic": case "OrderX_Comfort": case "OrderX_Extended": @@ -101,7 +102,7 @@ class CreateEDocument implements ShouldQueue } } elseif ($this->document instanceof PurchaseOrder){ - switch ($e_document_type){ + switch ($e_quote_type){ case "OrderX_Basic": case "OrderX_Comfort": case "OrderX_Extended": diff --git a/app/Services/EDocument/Standards/OrderXDocument.php b/app/Services/EDocument/Standards/OrderXDocument.php index 9e4343fb7fac..f7f592ccc5a9 100644 --- a/app/Services/EDocument/Standards/OrderXDocument.php +++ b/app/Services/EDocument/Standards/OrderXDocument.php @@ -35,7 +35,7 @@ class OrderXDocument extends AbstractService $company = $this->document->company; $settings_entity = ($this->document Instanceof PurchaseOrder) ? $this->document->vendor : $this->document->client; - $profile = $settings_entity->getSetting('e_quote_type'); + $profile = $settings_entity->getSetting('e_quote_type') ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended"; $profile = match ($profile) { "OrderX_Basic" => OrderProfiles::PROFILE_BASIC,