From 3444a5fcd1739fc2768fe7d2fb0976a7fcb3d784 Mon Sep 17 00:00:00 2001
From: Henning <leutz@pcsg.de>
Date: Thu, 20 Mar 2025 13:34:27 +0100
Subject: [PATCH] fix: update user validation in events

Update the user validation method in both `onUserSaveBegin` and `onUserSaveEnd` events. The
previous validation was using `QUI::getUsers()->isUser($User)`, which was replaced with a check for
`$User` instance of `QUI\\Users\\User` for improved reliability.
---
 src/QUI/ERP/Customer/EventHandler.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/QUI/ERP/Customer/EventHandler.php b/src/QUI/ERP/Customer/EventHandler.php
index 6a1f095..1f7e102 100644
--- a/src/QUI/ERP/Customer/EventHandler.php
+++ b/src/QUI/ERP/Customer/EventHandler.php
@@ -198,7 +198,7 @@ protected static function readAttributesFromUserXML(string $file): array
 
     public static function onUserSaveBegin(QUI\Interfaces\Users\User $User): void
     {
-        if (!QUI::getUsers()->isUser($User)) {
+        if (!($User instanceof QUI\Users\User)) {
             return;
         }
 
@@ -238,7 +238,7 @@ public static function onUserSaveBegin(QUI\Interfaces\Users\User $User): void
      */
     public static function onUserSaveEnd(QUI\Interfaces\Users\User $User): void
     {
-        if (!QUI::getUsers()->isUser($User)) {
+        if (!($User instanceof QUI\Users\User)) {
             return;
         }
 
-- 
GitLab