diff --git a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php index c03cc30a28817de3576a7ae222cda7adea474ba7..73589d4822ff495d51e050ab7a0fcfd3fc3bf545 100644 --- a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php +++ b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php @@ -353,6 +353,8 @@ public function getCustomer() 'email' => $User->getAttribute('email') ]; + $Customer = false; + try { $Customer = QUI\ERP\User::convertUserToErpUser($User); $userData = $Customer->getAttributes(); @@ -390,10 +392,6 @@ public function getCustomer() } } - if (!empty($this->getAttribute('contact_person'))) { - $userData['quiqqer.erp.customer.contact.person'] = $this->getAttribute('contact_person'); - } - if (empty($userData['country'])) { $userData['country'] = QUI\ERP\Defaults::getCountry()->getCode(); } @@ -767,8 +765,9 @@ public function update($PermissionUser = null) $invoiceAddressCheck['contactEmail'] = $contactEmail; $invoiceAddress = \json_encode($invoiceAddressCheck); - } else { + } elseif (\is_array($invoiceAddress)) { $invoiceAddress['contactEmail'] = $contactEmail; + $invoiceAddress = \json_encode($invoiceAddress); } if (!$invoiceAddressCheck) {