diff --git a/.phive/phars.xml b/.phive/phars.xml index 5bfa092bfad10dad9d23240281a5a2041acb815b..cccdab55e6792f5161b502854bef53c1667a4add 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <phive xmlns="https://phar.io/phive"> - <phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/> + <phar name="phpstan" version="1.*" installed="1.12.13" location="./tools/phpstan" copy="false"/> <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> diff --git a/src/QUI/ERP/Customer/EventHandler.php b/src/QUI/ERP/Customer/EventHandler.php index b150c1aa159fa5b6688ccf03f7ec27ce9cca8631..6a1f0954f86101e6d3a6876efe8f0f5dfaa756fd 100644 --- a/src/QUI/ERP/Customer/EventHandler.php +++ b/src/QUI/ERP/Customer/EventHandler.php @@ -196,7 +196,7 @@ protected static function readAttributesFromUserXML(string $file): array return $attributes; } - public static function onUserSaveBegin(QUI\Users\User $User): void + public static function onUserSaveBegin(QUI\Interfaces\Users\User $User): void { if (!QUI::getUsers()->isUser($User)) { return; @@ -234,10 +234,14 @@ public static function onUserSaveBegin(QUI\Users\User $User): void } /** - * @param QUI\Users\User $User + * @param QUI\Interfaces\Users\User $User */ - public static function onUserSaveEnd(QUI\Users\User $User): void + public static function onUserSaveEnd(QUI\Interfaces\Users\User $User): void { + if (!QUI::getUsers()->isUser($User)) { + return; + } + $attributes = $User->getAttributes(); $data = []; @@ -297,15 +301,15 @@ public static function onUserSaveEnd(QUI\Users\User $User): void } /** - * @param QUI\Users\User $User + * @param QUI\Interfaces\Users\User $User * @param bool|string $code * @param null|QUI\Interfaces\Users\User $PermissionUser * * @throws QUI\Users\Exception|QUI\Exception */ public static function onUserActivateBegin( - QUI\Users\User $User, - bool|string $code, + QUI\Interfaces\Users\User $User, + bool | string $code, ?QUI\Interfaces\Users\User $PermissionUser ): void { $Group = Utils::getInstance()->getCustomerGroup(); @@ -342,6 +346,7 @@ public static function onUserActivateBegin( * - set the user to the customer group * * @param QUI\ERP\Order\Controls\OrderProcess\CustomerData $Step + * @throws QUI\Exception */ public static function onQuiqqerOrderCustomerDataSaveEnd( QUI\ERP\Order\Controls\OrderProcess\CustomerData $Step @@ -378,15 +383,15 @@ public static function onQuiqqerOrderCustomerDataSaveEnd( * Handle the frontend user data event * * @param Collector $Collector - The collector object - * @param QUI\Users\User $User - The user object + * @param QUI\Interfaces\Users\User $User - The user object * @param mixed $Address - The address data * @return void * @throws Exception */ public static function onFrontendUserDataMiddle( Collector $Collector, - QUI\Users\User $User, - $Address + QUI\Interfaces\Users\User $User, + mixed $Address ): void { $Engine = QUI::getTemplateManager()->getEngine(); $canEdit = QUI\Permissions\Permission::hasPermission('quiqqer.customer.FrontendUsers.contactPerson.edit');