From 88fdbda67f38079053f1309644f2a55c8189a09e Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Wed, 31 Jul 2024 11:34:22 +0200 Subject: [PATCH] fix: set all important history + comment data --- .../ERP/Accounting/Invoice/ErpProvider.php | 6 ++-- .../ERP/Accounting/Invoice/EventHandler.php | 3 +- src/QUI/ERP/Accounting/Invoice/Factory.php | 2 ++ src/QUI/ERP/Accounting/Invoice/Invoice.php | 13 ++++++-- .../Accounting/Invoice/InvoiceTemporary.php | 33 ++++++++++++++++--- .../Accounting/Invoice/RestApi/Provider.php | 1 + 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/QUI/ERP/Accounting/Invoice/ErpProvider.php b/src/QUI/ERP/Accounting/Invoice/ErpProvider.php index 411d5c3..992adbc 100644 --- a/src/QUI/ERP/Accounting/Invoice/ErpProvider.php +++ b/src/QUI/ERP/Accounting/Invoice/ErpProvider.php @@ -38,7 +38,7 @@ public static function addMenuItems(Map $Map): void } $Invoice = new Item([ - 'icon' => 'fa fa-file-text-o', + 'icon' => Factory::ERP_INVOICE_ICON, 'name' => 'invoice', 'text' => ['quiqqer/invoice', 'erp.panel.invoice.text'], 'opened' => true, @@ -56,7 +56,7 @@ public static function addMenuItems(Map $Map): void $Invoice->appendChild( new Item([ - 'icon' => 'fa fa-file-text-o', + 'icon' => Factory::ERP_INVOICE_ICON, 'name' => 'invoice-drafts', 'text' => ['quiqqer/invoice', 'erp.panel.invoice.drafts.text'], 'require' => 'package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoices' @@ -65,7 +65,7 @@ public static function addMenuItems(Map $Map): void $Invoice->appendChild( new Item([ - 'icon' => 'fa fa-file-text-o', + 'icon' => Factory::ERP_INVOICE_ICON, 'name' => 'invoice-journal', 'text' => ['quiqqer/invoice', 'erp.panel.invoice.journal.text'], 'require' => 'package/quiqqer/invoice/bin/backend/controls/panels/Journal' diff --git a/src/QUI/ERP/Accounting/Invoice/EventHandler.php b/src/QUI/ERP/Accounting/Invoice/EventHandler.php index 3c16dda..f405b0d 100644 --- a/src/QUI/ERP/Accounting/Invoice/EventHandler.php +++ b/src/QUI/ERP/Accounting/Invoice/EventHandler.php @@ -271,7 +271,8 @@ public static function onQuiqqerErpGetHistoryByUser( ]), strtotime($Invoice->getAttribute('c_date')), 'quiqqer/invoice', - 'fa fa-file-text-o', + Factory::ERP_INVOICE_ICON, + false, $Invoice->getUUID() ); } diff --git a/src/QUI/ERP/Accounting/Invoice/Factory.php b/src/QUI/ERP/Accounting/Invoice/Factory.php index 9b17e2b..0fbc282 100644 --- a/src/QUI/ERP/Accounting/Invoice/Factory.php +++ b/src/QUI/ERP/Accounting/Invoice/Factory.php @@ -18,6 +18,8 @@ */ class Factory extends QUI\Utils\Singleton { + const ERP_INVOICE_ICON = 'fa fa-file-text-o'; + /** * Creates a new temporary invoice * diff --git a/src/QUI/ERP/Accounting/Invoice/Invoice.php b/src/QUI/ERP/Accounting/Invoice/Invoice.php index 9529f3b..5e48297 100644 --- a/src/QUI/ERP/Accounting/Invoice/Invoice.php +++ b/src/QUI/ERP/Accounting/Invoice/Invoice.php @@ -1655,7 +1655,15 @@ public function addComment(string $comment, QUI\Interfaces\Users\User $Permissio $comments = $this->getAttribute('comments'); $Comments = QUI\ERP\Comments::unserialize($comments); - $Comments->addComment($comment); + $Comments->addComment( + $comment, + false, + 'quiqqer/invoice', + Factory::ERP_INVOICE_ICON, + false, + $this->getUUID() + ); + $this->setAttribute('comments', $Comments->toJSON()); $this->addHistory( @@ -1712,7 +1720,8 @@ public function addHistory(string $comment): void $comment, false, 'quiqqer/invoice', - 'fa fa-file-text-o', + Factory::ERP_INVOICE_ICON, + false, $this->getUUID() ); diff --git a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php index 1d0d601..823c869 100644 --- a/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php +++ b/src/QUI/ERP/Accounting/Invoice/InvoiceTemporary.php @@ -1416,7 +1416,12 @@ public function post(QUI\Interfaces\Users\User $PermissionUser = null): Invoice 'oldHash' => $oldHash, 'newHash' => $this->getAttribute('hash') ] - ) + ), + false, + 'quiqqer/invoice', + Factory::ERP_INVOICE_ICON, + false, + $this->getUUID() ); } } catch (QUI\Exception $Exception) { @@ -1431,7 +1436,12 @@ public function post(QUI\Interfaces\Users\User $PermissionUser = null): Invoice QUI::getLocale()->get('quiqqer/invoice', 'history.invoiceTemporary.post', [ 'userId' => QUI::getUserBySession()->getUniqueId(), 'username' => QUI::getUserBySession()->getUsername() - ]) + ]), + false, + 'quiqqer/invoice', + Factory::ERP_INVOICE_ICON, + false, + $this->getUUID() ); // new invoice id @@ -2058,7 +2068,15 @@ public function addComment(string $message): void <img><table><tbody><td><tfoot><th><thead><tr>' ); - $this->Comments->addComment($message); + $this->Comments->addComment( + $message, + false, + 'quiqqer/invoice', + Factory::ERP_INVOICE_ICON, + false, + $this->getUUID() + ); + $this->save(); QUI::getEvents()->fireEvent( @@ -2102,7 +2120,14 @@ public function getHistory(): QUI\ERP\Comments */ public function addHistory(string $message): void { - $this->History->addComment($message); + $this->History->addComment( + $message, + false, + 'quiqqer/invoice', + Factory::ERP_INVOICE_ICON, + false, + $this->getUUID() + ); QUI::getEvents()->fireEvent( 'quiqqerInvoiceTemporaryInvoiceAddHistory', diff --git a/src/QUI/ERP/Accounting/Invoice/RestApi/Provider.php b/src/QUI/ERP/Accounting/Invoice/RestApi/Provider.php index 9f4c4ca..358f3ec 100644 --- a/src/QUI/ERP/Accounting/Invoice/RestApi/Provider.php +++ b/src/QUI/ERP/Accounting/Invoice/RestApi/Provider.php @@ -7,6 +7,7 @@ use Psr\Http\Message\ResponseInterface as ResponseInterface; use Psr\Http\Message\ServerRequestInterface as RequestInterface; use QUI; +use QUI\ERP\Accounting\Invoice\Factory; use QUI\ERP\Accounting\Invoice\Factory as InvoiceFactory; use QUI\ERP\Accounting\Invoice\ProcessingStatus\Handler as ProcessingStatuses; use QUI\ERP\Currency\Handler as CurrencyHandler; -- GitLab