From e34b05a38165136abdda29d858557908695ee9db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Patrick=20M=C3=BCller?= <p.mueller@pcsg.de>
Date: Fri, 21 May 2021 12:20:18 +0200
Subject: [PATCH] feat: getHistoryByUser quiqqer/customer#53

---
 src/QUI/ERP/Comments.php | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/QUI/ERP/Comments.php b/src/QUI/ERP/Comments.php
index b240b57..573fef0 100644
--- a/src/QUI/ERP/Comments.php
+++ b/src/QUI/ERP/Comments.php
@@ -206,6 +206,8 @@ public function import(Comments $Comments)
     // region utils
 
     /**
+     * Get comments by user
+     *
      * @param QUI\Users\User $User
      * @return Comments
      *
@@ -254,5 +256,28 @@ public static function getCommentsByUser(QUI\Users\User $User)
         return $Comments;
     }
 
+    /**
+     * Get history by user
+     *
+     * @param QUI\Users\User $User
+     * @return Comments
+     *
+     * @throws QUI\Exception
+     * @throws QUI\ExceptionStack
+     */
+    public static function getHistoryByUser(QUI\Users\User $User)
+    {
+        $Comments = new self();
+
+        QUI::getEvents()->fireEvent(
+            'quiqqerErpGetHistoryByUser',
+            [$User, $Comments]
+        );
+
+        $Comments->sort();
+
+        return $Comments;
+    }
+
     // endregion
 }
-- 
GitLab