From b0da811bd98fee011f01f7fd9480500be87e4275 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Fri, 28 Jun 2024 07:58:35 +0200
Subject: [PATCH] fix: invoice journal: customer cannot be opened

related: pcsg/buero#420
---
 bin/backend/controls/panels/Journal.js                  | 5 ++++-
 src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/backend/controls/panels/Journal.js b/bin/backend/controls/panels/Journal.js
index 9b4fb42..80f0693 100644
--- a/bin/backend/controls/panels/Journal.js
+++ b/bin/backend/controls/panels/Journal.js
@@ -527,6 +527,10 @@ define(
                             dataType: 'string',
                             width: 90,
                             className: 'clickable'
+                        }, {
+                            dataIndex: 'customer_id',
+                            dataType: 'string',
+                            hidden: true
                         },
                         {
                             header: QUILocale.get(lg, 'journal.grid.status'),
@@ -941,7 +945,6 @@ define(
                     ], (CopyErpEntityDialog) => {
                         new CopyErpEntityDialog({
                             hash: hash,
-                            entityPlugin: 'quiqqer/invoice',
                             events: {
                                 onSuccess: resolve
                             }
diff --git a/src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php b/src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
index bb4089a..9ceb66f 100644
--- a/src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
+++ b/src/QUI/ERP/Accounting/Invoice/Search/InvoiceSearch.php
@@ -773,8 +773,10 @@ protected function parseListForGrid(array $data): array
 
             if ($Customer->getAttribute('customerId')) {
                 $invoiceData['customer_id_display'] = $Customer->getAttribute('customerId');
+                $invoiceData['customer_id'] = $Customer->getUUID() ?? $Customer->getId();
             } else {
                 $invoiceData['customer_id_display'] = '';
+                $invoiceData['customer_id'] = '';
             }
 
             $invoiceData['customer_name'] = trim(
-- 
GitLab