diff --git a/ajax/backend/update.php b/ajax/backend/update.php index 7fea37c473ebef13e5398d1bd08bce03d2634276..5d5afded032f220ccd98268124cee9ce9d6af2d8 100644 --- a/ajax/backend/update.php +++ b/ajax/backend/update.php @@ -27,7 +27,10 @@ function ($orderId, $data) { $Customer = null; if (isset($data['customerId']) && !isset($data['customer'])) { - $Customer = QUI::getUsers()->get($data['customerId']); + try { + $Customer = QUI::getUsers()->get($data['customerId']); + } catch (QUI\Exception) { + } } if (!empty($data['cDate'])) { @@ -44,8 +47,16 @@ function ($orderId, $data) { } if (!$Customer && isset($data['customer'])) { - if (isset($data['customerId']) && !isset($data['customer']['id'])) { - $data['customer']['id'] = $data['customerId']; + // refresh customer id data + if (isset($data['customerId'])) { + try { + $Customer = QUI::getUsers()->get($data['customerId']); + + $data['customer']['id'] = $Customer->getUUID(); + $data['customer']['uuid'] = $Customer->getUUID(); + $data['customer']['customerId'] = $Customer->getAttribute('customerId'); + } catch (QUI\Exception) { + } } if (isset($data['addressInvoice']['country']) && !isset($data['customer']['country'])) { diff --git a/bin/backend/controls/panels/Orders.js b/bin/backend/controls/panels/Orders.js index 4db461da35ade3d9479df6d92480a3df23917524..65cb33d61a812273768557f936a5a03c1c1973f3 100644 --- a/bin/backend/controls/panels/Orders.js +++ b/bin/backend/controls/panels/Orders.js @@ -113,6 +113,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [ let sortOn = self.$Grid.options.sortOn; switch (sortOn) { + case 'customer_id_view': case 'customer_id': sortOn = 'customerId'; break; @@ -173,6 +174,10 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [ }); } + if (typeof entry.customer_no !== 'undefined') { + entry.customer_id_view = entry.customer_no; + } + return entry; }); @@ -1078,8 +1083,8 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [ }, { header: QUILocale.get(lg, 'grid.customerNo'), - dataIndex: 'customer_id', - dataType: 'integer', + dataIndex: 'customer_id_view', + dataType: 'string', width: 90, className: 'clickable' }, @@ -1200,6 +1205,11 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [ dataIndex: 'paymentId', dataType: 'integer', hidden: true + }, + { + dataIndex: 'customer_id', + dataType: 'string', + hidden: true } ]); @@ -1286,6 +1296,7 @@ define('package/quiqqer/order/bin/backend/controls/panels/Orders', [ rowData = self.$Grid.getDataByRow(data.row); if (Cell.get('data-index') === 'customer_id' || + Cell.get('data-index') === 'customer_id_view' || Cell.get('data-index') === 'customer_name' || Cell.get('data-index') === 'invoice_id' || Cell.get('data-index') === 'status') { diff --git a/src/QUI/ERP/Order/Search.php b/src/QUI/ERP/Order/Search.php index 4fc4999634aa8a7adf25e2a460320c794ec7d5e4..c9761658267940f704c23b110f22b44d0fb88570 100644 --- a/src/QUI/ERP/Order/Search.php +++ b/src/QUI/ERP/Order/Search.php @@ -539,10 +539,12 @@ protected function parseListForGrid(array $data): array $orderData['uuid'] = $Order->getUUID(); $orderData['globalProcessId'] = $Order->getGlobalProcessId(); $orderData['prefixed-id'] = $Order->getPrefixedNumber(); + $orderData['customer_no'] = ''; // customer data if (empty($orderData['customer_id'])) { $orderData['customer_id'] = $Customer->getUUID(); + $orderData['customer_no'] = $Customer->getCustomerNo(); if (!$orderData['customer_id']) { $orderData['customer_id'] = Handler::EMPTY_VALUE;