diff --git a/src/QUI/ERP/Order/AbstractOrder.php b/src/QUI/ERP/Order/AbstractOrder.php index e5e45d5d3f7e1cd39b9b8ca0058fd145270a560f..18b8003c76747db4afd0938ccebf042f29b733b5 100644 --- a/src/QUI/ERP/Order/AbstractOrder.php +++ b/src/QUI/ERP/Order/AbstractOrder.php @@ -474,8 +474,10 @@ protected function setDataBaseData(array $data): void * @param QUI\Interfaces\Users\User|null $PermissionUser * @return ErpEntityInterface|null */ - public function reversal(string $reason = '', null | QUI\Interfaces\Users\User $PermissionUser = null): ?ErpEntityInterface - { + public function reversal( + string $reason = '', + null | QUI\Interfaces\Users\User $PermissionUser = null + ): ?ErpEntityInterface { $this->delete($PermissionUser); return null; } @@ -1167,7 +1169,6 @@ public function setCurrency(QUI\ERP\Currency\Currency $Currency): void * Set a customer to the order * * @param array|User|QUI\Interfaces\Users\User $User - * @throws Exception * @throws QUI\Exception * @throws ExceptionStack */ @@ -1264,6 +1265,7 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + $this->Articles?->setUser($this->Customer); return; } @@ -1277,6 +1279,7 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + $this->Articles?->setUser($this->Customer); return; } @@ -1293,6 +1296,8 @@ public function setCustomer(QUI\Interfaces\Users\User | array | User $User): voi if ($this->customerId !== $oldCustomerId) { QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]); } + + $this->Articles?->setUser($this->Customer); } } @@ -1303,6 +1308,7 @@ public function removeCustomer(): void { $this->Customer = null; $this->customerId = 0; + $this->Articles->setUser(null); try { QUI::getEvents()->fireEvent('onQuiqqerOrderCustomerChange', [$this]);