From 54655dd63900fe3790d41c04c1bf0c9ea78c049f Mon Sep 17 00:00:00 2001 From: Dominik Pfaffenbauer Date: Wed, 4 Dec 2024 15:50:14 +0100 Subject: [PATCH] [ResourceBundle/OrderBundle] fix order grid-configs and add a new CoreShop Resource Field Getter Operator --- .../Resources/install/pimcore/grid-config.yml | 2018 ++++++++--------- .../Configuration/GridConfigConfiguration.php | 24 +- .../GridColumnConfig/ResourceFieldGetter.php | 104 + .../Resources/config/pimcore/admin.yml | 1 + .../Resources/config/services.yml | 1 + .../Resources/config/services/grid.yml | 7 + .../coreshop_resource_field_getter.js | 22 + 7 files changed, 1119 insertions(+), 1058 deletions(-) create mode 100644 src/CoreShop/Bundle/ResourceBundle/Pimcore/GridColumnConfig/ResourceFieldGetter.php create mode 100644 src/CoreShop/Bundle/ResourceBundle/Resources/config/services/grid.yml create mode 100644 src/CoreShop/Bundle/ResourceBundle/Resources/public/pimcore/js/object/gridcolumn/operator/coreshop_resource_field_getter.js diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/install/pimcore/grid-config.yml b/src/CoreShop/Bundle/OrderBundle/Resources/install/pimcore/grid-config.yml index 903579eb03..4e756b7515 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/install/pimcore/grid-config.yml +++ b/src/CoreShop/Bundle/OrderBundle/Resources/install/pimcore/grid-config.yml @@ -1,1052 +1,978 @@ grid_config: - order_en: - name: 'Order Overview' - class: coreshop.order - data: - language: en - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced7f5': - name: '#5a65a6bced7f5' - position: 2 - hidden: false - width: 109 - fieldConfig: - isOperator: true - attributes: - label: 'Order Number' - type: operator - class: Trimmer - trim: 0 - childs: - - - label: 'Order Number (orderNumber)' - type: value - class: DefaultValue - attribute: orderNumber - dataType: input - childs: { } - key: '#5a65a6bced7f5' - isOperator: true - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Customer (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - '#5a65a6bced959': - name: '#5a65a6bced959' - position: 5 - hidden: false - width: 190 - fieldConfig: - isOperator: true - attributes: - label: 'Order State' - type: operator - class: coreshop_order_state - orderState: orderState - childs: - - - label: 'Order State (orderState)' - type: value - class: DefaultValue - attribute: orderState - dataType: input - childs: { } - highlightLabel: true - key: '#5a65a6bced959' - isOperator: true - '#5a65a6bced9e2': - name: '#5a65a6bced9e2' - position: 6 - hidden: false - width: 231 - fieldConfig: - isOperator: true - attributes: - label: 'Payment State' - type: operator - class: coreshop_order_state - highlightLabel: true - childs: - - - label: 'Payment State (paymentState)' - type: value - class: DefaultValue - attribute: paymentState - dataType: input - childs: { } - key: '#5a65a6bced9e2' - isOperator: true - '#5a65a6bceda82': - name: '#5a65a6bceda82' - position: 7 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: 'Shipping State' - type: operator - class: coreshop_order_state - highlightLabel: true - childs: - - - label: 'Shipping State (shippingState)' - type: value - class: DefaultValue - attribute: shippingState - dataType: input - childs: { } - key: '#5a65a6bceda82' - isOperator: true - '#5a65a6bcedae7': - name: '#5a65a6bcedae7' - position: 8 - hidden: false - width: 145 - fieldConfig: - isOperator: true - attributes: - label: 'Total Amount' - type: operator - class: coreshop_price_formatter - childs: - - - label: 'Total gross (totalGross)' - type: value - class: DefaultValue - attribute: totalGross - dataType: coreShopMoney - childs: { } - key: '#5a65a6bcedae7' - isOperator: true - orderDate: - name: orderDate - position: 9 - hidden: false - width: 183 - fieldConfig: - key: orderDate - label: 'Order Date' - type: datetime - layout: - fieldtype: datetime - queryColumnType: bigint(20) - columnType: bigint(20) - phpdocType: \Carbon\Carbon - defaultValue: null - useCurrentDate: false - name: orderDate - title: 'Order Date' - tooltip: '' - mandatory: false - noteditable: true - index: false - locked: false - style: '' - permissions: null - datatype: data - relationType: false - invisible: false - visibleGridView: false - visibleSearch: false - width: 224 - onlyDirectChildren: false - shareGlobally: true - setAsFavourite: true - pageSize: 25 + order_en: + name: 'Order Overview' + class: coreshop.order + data: + language: en + pageSize: 25 + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 40 + locked: false + fieldConfig: + key: id + label: ID + type: system + '#order_number': + name: order_number + position: 2 + hidden: false + width: 97 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Order Number + type: operator + class: Trimmer + trim: 2 + children: + - label: Ordernumber (orderNumber) + type: value + class: DefaultValue + attribute: orderNumber + dataType: input + children: [ ] + key: '#order_number' + isOperator: true + orderDate: + name: orderDate + position: 3 + hidden: false + width: 183 + locked: false + fieldConfig: + key: orderDate + label: coreshop.order.date + type: datetime + width: 183 + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + '#order_state': + name: order_state + position: 6 + hidden: false + width: 80 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Order State + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Order State (orderState) + type: value + class: DefaultValue + attribute: orderState + dataType: input + children: [ ] + key: '#order_state' + isOperator: true + '#payment_state': + name: payment_state + position: 7 + hidden: false + width: 95 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Payment State + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Payment State (paymentState) + type: value + class: DefaultValue + attribute: paymentState + dataType: input + children: [ ] + key: '#payment_state' + isOperator: true + '#shipping_state': + name: shipping_state + position: 8 + hidden: false + width: 95 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Shipping State + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Shipping State (shippingState) + type: value + class: DefaultValue + attribute: shippingState + dataType: input + children: [ ] + key: '#shipping_state' + isOperator: true + '#total_amount_gross': + name: total_amount_gross + position: 9 + hidden: false + width: 91 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Total Amount + type: operator + class: coreshop_price_formatter + children: + - label: Total (Gross) (totalGross) + type: value + class: DefaultValue + attribute: totalGross + dataType: coreShopMoney + children: [ ] + key: '#total_amount_gross' + isOperator: true + '#payment_provider': + name: payment_provider + position: 10 + hidden: false + width: 113 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Payment Provider + type: operator + class: coreshop_resource_field_getter + attribute: title + forwardAttribute: '' + children: + - label: Payment Provider (paymentProvider) + type: value + class: DefaultValue + attribute: paymentProvider + dataType: coreShopPaymentProvider + children: [ ] + key: '#payment_provider' + isOperator: true + onlyDirectChildren: false + searchFilter: '' + filter: [ ] + pimcore_version: v11.4.2 + pimcore_revision: c3beefe92e4ac592d09b2e103ad509de97b10e69 + context: "{}" - order_de: - name: Bestellübersicht - class: coreshop.order - data: - language: de - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced7f5': - name: '#5a65a6bced7f5' - position: 2 - hidden: false - width: 109 - fieldConfig: - isOperator: true - attributes: - label: Bestellnummer - type: operator - class: Trimmer - trim: 0 - childs: - - - label: 'Bestellnummer (orderNumber)' - type: value - class: DefaultValue - attribute: orderNumber - dataType: input - childs: { } - key: '#5a65a6bced7f5' - isOperator: true - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Kunde (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - '#5a65a6bced959': - name: '#5a65a6bced959' - position: 5 - hidden: false - width: 190 - fieldConfig: - isOperator: true - attributes: - label: Bestellstatus - type: operator - class: coreshop_order_state - orderState: orderState - childs: - - - label: 'Order State (orderState)' - type: value - class: DefaultValue - attribute: orderState - dataType: input - childs: { } - highlightLabel: true - key: '#5a65a6bced959' - isOperator: true - '#5a65a6bced9e2': - name: '#5a65a6bced9e2' - position: 6 - hidden: false - width: 231 - fieldConfig: - isOperator: true - attributes: - label: Zahlungsstatus - type: operator - class: coreshop_order_state - highlightLabel: true - childs: - - - label: 'Payment State (paymentState)' - type: value - class: DefaultValue - attribute: paymentState - dataType: input - childs: { } - key: '#5a65a6bced9e2' - isOperator: true - '#5a65a6bceda82': - name: '#5a65a6bceda82' - position: 7 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Lieferstatus - type: operator - class: coreshop_order_state - highlightLabel: true - childs: - - - label: 'Shipping State (shippingState)' - type: value - class: DefaultValue - attribute: shippingState - dataType: input - childs: { } - key: '#5a65a6bceda82' - isOperator: true - '#5a65a6bcedae7': - name: '#5a65a6bcedae7' - position: 8 - hidden: false - width: 145 - fieldConfig: - isOperator: true - attributes: - label: Gesamtpreis - type: operator - class: coreshop_price_formatter - childs: - - - label: 'Total Brutto (totalGross)' - type: value - class: DefaultValue - attribute: totalGross - dataType: coreShopMoney - childs: { } - key: '#5a65a6bcedae7' - isOperator: true - orderDate: - name: orderDate - position: 9 - hidden: false - width: 183 - fieldConfig: - key: orderDate - label: 'Order Date' - type: datetime - layout: - fieldtype: datetime - queryColumnType: bigint(20) - columnType: bigint(20) - phpdocType: \Carbon\Carbon - defaultValue: null - useCurrentDate: false - name: orderDate - title: 'Order Date' - tooltip: '' - mandatory: false - noteditable: true - index: false - locked: false - style: '' - permissions: null - datatype: data - relationType: false - invisible: false - visibleGridView: false - visibleSearch: false - width: 224 - onlyDirectChildren: false - pageSize: 25 + order_de: + name: 'Bestellübersicht' + class: coreshop.order + data: + language: de + pageSize: 25 + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 40 + locked: false + fieldConfig: + key: id + label: ID + type: system + order_number: + name: order_number + position: 2 + hidden: false + width: 97 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Bestellnummer + type: operator + class: Trimmer + trim: 2 + children: + - label: Ordernumber (orderNumber) + type: value + class: DefaultValue + attribute: orderNumber + dataType: input + children: [ ] + key: order_number + isOperator: true + orderDate: + name: orderDate + position: 3 + hidden: false + width: 183 + locked: false + fieldConfig: + key: orderDate + label: Bestelldatum + type: datetime + width: 183 + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + '#order_state': + name: order_state + position: 6 + hidden: false + width: 80 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Bestellstatus + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Order State (orderState) + type: value + class: DefaultValue + attribute: orderState + dataType: input + children: [ ] + key: '#order_state' + isOperator: true + '#payment_state': + name: payment_state + position: 7 + hidden: false + width: 95 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Zahlungsstatus + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Payment State (paymentState) + type: value + class: DefaultValue + attribute: paymentState + dataType: input + children: [ ] + key: '#payment_state' + isOperator: true + '#shipping_state': + name: shipping_state + position: 8 + hidden: false + width: 95 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Versandstatus + type: operator + class: coreshop_order_state + highlightLabel: true + children: + - label: Shipping State (shippingState) + type: value + class: DefaultValue + attribute: shippingState + dataType: input + children: [ ] + key: '#shipping_state' + isOperator: true + '#total_amount_gross': + name: total_amount_gross + position: 9 + hidden: false + width: 91 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Gesamt + type: operator + class: coreshop_price_formatter + children: + - label: Total (Gross) (totalGross) + type: value + class: DefaultValue + attribute: totalGross + dataType: coreShopMoney + children: [ ] + key: '#total_amount_gross' + isOperator: true + '#payment_provider': + name: payment_provider + position: 10 + hidden: false + width: 113 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Zahlungsanbieter + type: operator + class: coreshop_resource_field_getter + attribute: title + forwardAttribute: '' + children: + - label: Payment Provider (paymentProvider) + type: value + class: DefaultValue + attribute: paymentProvider + dataType: coreShopPaymentProvider + children: [ ] + key: '#payment_provider' + isOperator: true + onlyDirectChildren: false + searchFilter: '' + filter: [ ] + pimcore_version: v11.4.2 + pimcore_revision: c3beefe92e4ac592d09b2e103ad509de97b10e69 + context: "{}" - quote_en: - name: 'Quote Overview' - class: coreshop.order - data: - language: en - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced7f5': - name: '#5a65a6bced7f5' - position: 2 - hidden: false - width: 109 - fieldConfig: - isOperator: true - attributes: - label: 'Quote Number' - type: operator - class: Trimmer - trim: 0 - childs: - - - label: 'Quote Number (quoteNumber)' - type: value - class: DefaultValue - attribute: quoteNumber - dataType: input - childs: { } - key: '#5a65a6bced7f5' - isOperator: true - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Customer (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - '#5a65a6bcedae7': - name: '#5a65a6bcedae7' - position: 5 - hidden: false - width: 145 - fieldConfig: - isOperator: true - attributes: - label: 'Total Gross' - type: operator - class: coreshop_price_formatter - childs: - - - label: 'Total Gross (totalGross)' - type: value - class: DefaultValue - attribute: totalGross - dataType: coreShopMoney - childs: { } - key: '#5a65a6bcedae7' - isOperator: true - quoteDate: - name: quoteDate - position: 6 - hidden: false - width: 183 - fieldConfig: - key: quoteDate - label: 'Quote Date' - type: datetime - layout: - fieldtype: datetime - queryColumnType: bigint(20) - columnType: bigint(20) - phpdocType: \Carbon\Carbon - defaultValue: null - useCurrentDate: false - name: quoteDate - title: 'Quote Date' - tooltip: '' - mandatory: false - noteditable: true - index: false - locked: false - style: '' - permissions: null - datatype: data - relationType: false - invisible: false - visibleGridView: false - visibleSearch: false - width: 224 - onlyDirectChildren: false - pageSize: 25 + quote_en: + name: 'Quote Overview' + class: coreshop.order + data: + language: en + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 80 + fieldConfig: + key: id + label: ID + type: system + layout: + title: id + name: id + datatype: data + fieldtype: system + '#quote_number': + name: quote_number + position: 2 + hidden: false + width: 97 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Quote Number + type: operator + class: Trimmer + trim: 2 + children: + - label: Quote Number (quoteNumber) + type: value + class: DefaultValue + attribute: quoteNumber + dataType: input + children: [ ] + key: '#quote_number' + isOperator: true + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + '#total_amount_gross': + name: total_amount_gross + position: 9 + hidden: false + width: 91 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Total Amount + type: operator + class: coreshop_price_formatter + children: + - label: Total (Gross) (totalGross) + type: value + class: DefaultValue + attribute: totalGross + dataType: coreShopMoney + children: [ ] + key: '#total_amount_gross' + isOperator: true + quoteDate: + name: quoteDate + position: 6 + hidden: false + width: 183 + fieldConfig: + key: quoteDate + label: 'Quote Date' + type: datetime + layout: + fieldtype: datetime + queryColumnType: bigint(20) + columnType: bigint(20) + phpdocType: \Carbon\Carbon + defaultValue: null + useCurrentDate: false + name: quoteDate + title: 'Quote Date' + tooltip: '' + mandatory: false + noteditable: true + index: false + locked: false + style: '' + permissions: null + datatype: data + relationType: false + invisible: false + visibleGridView: false + visibleSearch: false + width: 224 + onlyDirectChildren: false + pageSize: 25 - quote_de: - name: Angebotsübersicht - class: coreshop.order - data: - language: de - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced7f5': - name: '#5a65a6bced7f5' - position: 2 - hidden: false - width: 109 - fieldConfig: - isOperator: true - attributes: - label: Angebotsnummer - type: operator - class: Trimmer - trim: 0 - childs: - - - label: 'Angebotsnummer (quoteNumber)' - type: value - class: DefaultValue - attribute: quoteNumber - dataType: input - childs: { } - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Kunde (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - '#5a65a6bcedae7': - name: '#5a65a6bcedae7' - position: 5 - hidden: false - width: 145 - fieldConfig: - isOperator: true - attributes: - label: Gesamtpreis - type: operator - class: coreshop_price_formatter - childs: - - - label: 'Total Brutto (totalGross)' - type: value - class: DefaultValue - attribute: totalGross - dataType: coreShopMoney - childs: { } - key: '#5a65a6bcedae7' - isOperator: true - quoteDate: - name: quoteDate - position: 6 - hidden: false - width: 183 - fieldConfig: - key: quoteDate - label: 'Quote Date' - type: datetime - layout: - fieldtype: datetime - queryColumnType: bigint(20) - columnType: bigint(20) - phpdocType: \Carbon\Carbon - defaultValue: null - useCurrentDate: false - name: quoteDate - title: 'Quote Date' - tooltip: '' - mandatory: false - noteditable: true - index: false - locked: false - style: '' - permissions: null - datatype: data - relationType: false - invisible: false - visibleGridView: false - visibleSearch: false - width: 224 - onlyDirectChildren: false - pageSize: 25 + quote_de: + name: Angebotsübersicht + class: coreshop.order + data: + language: de + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 80 + fieldConfig: + key: id + label: ID + type: system + layout: + title: id + name: id + datatype: data + fieldtype: system + '#quote_number': + name: quote_number + position: 2 + hidden: false + width: 97 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Angebotsnummer + type: operator + class: Trimmer + trim: 2 + children: + - label: Quote Number (quoteNumber) + type: value + class: DefaultValue + attribute: quoteNumber + dataType: input + children: [ ] + key: '#quote_number' + isOperator: true + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + '#total_amount_gross': + name: total_amount_gross + position: 9 + hidden: false + width: 91 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Gesamt + type: operator + class: coreshop_price_formatter + children: + - label: Total (Gross) (totalGross) + type: value + class: DefaultValue + attribute: totalGross + dataType: coreShopMoney + children: [ ] + key: '#total_amount_gross' + isOperator: true + quoteDate: + name: quoteDate + position: 6 + hidden: false + width: 183 + fieldConfig: + key: quoteDate + label: 'Quote Date' + type: datetime + layout: + fieldtype: datetime + queryColumnType: bigint(20) + columnType: bigint(20) + phpdocType: \Carbon\Carbon + defaultValue: null + useCurrentDate: false + name: quoteDate + title: 'Quote Date' + tooltip: '' + mandatory: false + noteditable: true + index: false + locked: false + style: '' + permissions: null + datatype: data + relationType: false + invisible: false + visibleGridView: false + visibleSearch: false + width: 224 + onlyDirectChildren: false + pageSize: 25 - cart_en: - name: 'Cart Overview' - class: coreshop.order - data: - language: en - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Customer (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Invoice Address (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - onlyDirectChildren: false - pageSize: 25 + cart_en: + name: 'Cart Overview' + class: coreshop.order + data: + language: en + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 80 + fieldConfig: + key: id + label: ID + type: system + layout: + title: id + name: id + datatype: data + fieldtype: system + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + onlyDirectChildren: false + pageSize: 25 - cart_de: - name: 'Warenkorb Übersicht' - class: coreshop.order - data: - language: de - sortinfo: - field: id - direction: DESC - classId: null - columns: - id: - name: id - position: 1 - hidden: false - width: 80 - fieldConfig: - key: id - label: ID - type: system - layout: - title: id - name: id - datatype: data - fieldtype: system - '#5a65a6bced85d': - name: '#5a65a6bced85d' - position: 3 - hidden: false - width: 200 - fieldConfig: - isOperator: true - attributes: - label: Email - type: operator - class: AnyGetter - attribute: email - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Kunde (customer)' - type: value - class: DefaultValue - attribute: customer - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced85d' - isOperator: true - '#5a65a6bced8d0': - name: '#5a65a6bced8d0' - position: 4 - hidden: false - width: 180 - fieldConfig: - isOperator: true - attributes: - label: Name - type: operator - class: Concatenator - glue: ' ' - childs: - - label: 'First Name' - type: operator - class: AnyGetter - attribute: firstname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - - label: 'Last Name' - type: operator - class: AnyGetter - attribute: lastname - param1: '' - isArrayType: false - forwardAttribute: '' - forwardParam1: '' - returnLastResult: false - childs: - - label: 'Rechnungsadresse (invoiceAddress)' - type: value - class: DefaultValue - attribute: invoiceAddress - dataType: coreShopRelation - childs: { } - key: '#5a65a6bced8d0' - isOperator: true - onlyDirectChildren: false - shareGlobally: true - setAsFavourite: true - pageSize: 25 + cart_de: + name: 'Warenkorb Übersicht' + class: coreshop.order + data: + language: de + sortinfo: + field: id + direction: DESC + columns: + id: + name: id + position: 1 + hidden: false + width: 80 + fieldConfig: + key: id + label: ID + type: system + layout: + title: id + name: id + datatype: data + fieldtype: system + '#customer_email': + name: customer_email + position: 4 + hidden: false + width: 49 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Email + type: operator + class: ObjectFieldGetter + attribute: email + forwardAttribute: '' + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + key: '#customer_email' + isOperator: true + '#customer_name': + name: customer_name + position: 5 + hidden: false + width: 52 + locked: false + fieldConfig: + isOperator: true + attributes: + label: Name + type: operator + class: Concatenator + glue: " " + forceValue: false + children: + - label: Firstname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: firstname + forwardAttribute: '' + - label: Lastname + type: operator + class: ObjectFieldGetter + children: + - label: Customer (customer) + type: value + class: DefaultValue + attribute: customer + dataType: coreShopRelation + children: [ ] + attribute: lastname + forwardAttribute: '' + key: '#customer_name' + isOperator: true + onlyDirectChildren: false + shareGlobally: true + setAsFavourite: true + pageSize: 25 diff --git a/src/CoreShop/Bundle/ResourceBundle/Installer/Configuration/GridConfigConfiguration.php b/src/CoreShop/Bundle/ResourceBundle/Installer/Configuration/GridConfigConfiguration.php index b2bbe59ca2..69770e0ba0 100644 --- a/src/CoreShop/Bundle/ResourceBundle/Installer/Configuration/GridConfigConfiguration.php +++ b/src/CoreShop/Bundle/ResourceBundle/Installer/Configuration/GridConfigConfiguration.php @@ -30,18 +30,18 @@ public function getConfigTreeBuilder(): TreeBuilder $rootNode ->children() - ->arrayNode('grid_config') - ->useAttributeAsKey('key') - ->arrayPrototype() - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('key')->cannotBeEmpty()->end() - ->scalarNode('name')->cannotBeEmpty()->end() - ->scalarNode('class')->cannotBeEmpty()->end() - ->variableNode('data')->cannotBeEmpty()->end() - ->end() - ->end() - ->end() + ->arrayNode('grid_config') + ->useAttributeAsKey('key') + ->arrayPrototype() + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('key')->cannotBeEmpty()->end() + ->scalarNode('name')->cannotBeEmpty()->end() + ->scalarNode('class')->cannotBeEmpty()->end() + ->variableNode('data')->cannotBeEmpty()->end() + ->end() + ->end() + ->end() ->end() ; diff --git a/src/CoreShop/Bundle/ResourceBundle/Pimcore/GridColumnConfig/ResourceFieldGetter.php b/src/CoreShop/Bundle/ResourceBundle/Pimcore/GridColumnConfig/ResourceFieldGetter.php new file mode 100644 index 0000000000..4d2cd169d4 --- /dev/null +++ b/src/CoreShop/Bundle/ResourceBundle/Pimcore/GridColumnConfig/ResourceFieldGetter.php @@ -0,0 +1,104 @@ +attribute = $config->attribute ?? ''; + $this->forwardAttribute = $config->forwardAttribute ?? ''; + } + + public function getLabeledValue(array|ElementInterface $element): ResultContainer|\stdClass|null + { + $result = new \stdClass(); + $result->label = $this->label; + + $children = $this->getChildren(); + + $getter = 'get' . ucfirst($this->attribute); + + if (!$children) { + if ($this->attribute && method_exists($element, $getter)) { + $result->value = $element->$getter(); + if ($result->value instanceof ResourceInterface) { + $result->value = $result->value->getId(); + } + + return $result; + } + } else { + $c = $children[0]; + $forwardObject = $element; + + if ($this->forwardAttribute) { + $forwardGetter = 'get' . ucfirst($this->forwardAttribute); + if (method_exists($element, $forwardGetter)) { + $forwardObject = $element->$forwardGetter(); + if (!$forwardObject) { + return $result; + } + } else { + return $result; + } + } + + $valueContainer = $c->getLabeledValue($forwardObject); + $value = $valueContainer->value ?? null; + $result->value = $value; + + if (is_array($value)) { + $newValues = []; + foreach ($value as $o) { + if ($o instanceof ResourceInterface) { + if ($this->attribute && method_exists($o, $getter)) { + $targetValue = $o->$getter(); + if (is_array($targetValue)) { + $newValues = array_merge($newValues, $targetValue); + } else { + $newValues[] = $targetValue; + } + } + } + } + $result->value = $newValues; + $result->isArrayType = true; + } elseif ($value instanceof ResourceInterface) { + $o = $value; + if ($this->attribute && method_exists($o, $getter)) { + $value = $o->$getter(); + $result->value = $value; + } + } + } + + return $result; + } +} diff --git a/src/CoreShop/Bundle/ResourceBundle/Resources/config/pimcore/admin.yml b/src/CoreShop/Bundle/ResourceBundle/Resources/config/pimcore/admin.yml index a03f140429..d553a2fa92 100644 --- a/src/CoreShop/Bundle/ResourceBundle/Resources/config/pimcore/admin.yml +++ b/src/CoreShop/Bundle/ResourceBundle/Resources/config/pimcore/admin.yml @@ -25,6 +25,7 @@ core_shop_resource: selector_selector: '/bundles/coreshopresource/pimcore/js/selector/selector.js' resource_creation: '/bundles/coreshopresource/pimcore/js/resource/creation.js' events: '/bundles/coreshopresource/pimcore/js/events.js' + object_grid_column_resource_field_getter: '/bundles/coreshopresource/pimcore/js/object/gridcolumn/operator/coreshop_resource_field_getter.js' css: resource: '/bundles/coreshopresource/pimcore/css/resource.css' editmode_js: diff --git a/src/CoreShop/Bundle/ResourceBundle/Resources/config/services.yml b/src/CoreShop/Bundle/ResourceBundle/Resources/config/services.yml index ad3bf7696c..6bb1316ac5 100755 --- a/src/CoreShop/Bundle/ResourceBundle/Resources/config/services.yml +++ b/src/CoreShop/Bundle/ResourceBundle/Resources/config/services.yml @@ -5,6 +5,7 @@ imports: - { resource: services/commands.yml } - { resource: services/validators.yml } - { resource: services/form.yml } + - { resource: services/grid.yml } services: _defaults: diff --git a/src/CoreShop/Bundle/ResourceBundle/Resources/config/services/grid.yml b/src/CoreShop/Bundle/ResourceBundle/Resources/config/services/grid.yml new file mode 100644 index 0000000000..b745739ad2 --- /dev/null +++ b/src/CoreShop/Bundle/ResourceBundle/Resources/config/services/grid.yml @@ -0,0 +1,7 @@ +services: + coreshop.data_object.grid_column_config.operator.factory.resource_field_getter: + class: Pimcore\Bundle\AdminBundle\DataObject\GridColumnConfig\Operator\Factory\DefaultOperatorFactory + arguments: + $className: CoreShop\Bundle\ResourceBundle\Pimcore\GridColumnConfig\ResourceFieldGetter + tags: + - { name: pimcore.data_object.grid_column_config.operator_factory, id: coreshop_resource_field_getter } diff --git a/src/CoreShop/Bundle/ResourceBundle/Resources/public/pimcore/js/object/gridcolumn/operator/coreshop_resource_field_getter.js b/src/CoreShop/Bundle/ResourceBundle/Resources/public/pimcore/js/object/gridcolumn/operator/coreshop_resource_field_getter.js new file mode 100644 index 0000000000..9b8c5b5f90 --- /dev/null +++ b/src/CoreShop/Bundle/ResourceBundle/Resources/public/pimcore/js/object/gridcolumn/operator/coreshop_resource_field_getter.js @@ -0,0 +1,22 @@ +/* + * CoreShop. + * + * This source file is subject to the GNU General Public License version 3 (GPLv3) + * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt + * files that are distributed with this source code. + * + * @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) + * @license https://www.coreshop.org/license GPLv3 and CCL + * + */ + +pimcore.registerNS("pimcore.object.gridcolumn.operator.coreshop_resource_field_getter"); + +pimcore.object.gridcolumn.operator.coreshop_resource_field_getter = Class.create(pimcore.object.gridcolumn.operator.objectfieldgetter, { + operatorGroup: "extractor", + type: "operator", + class: "coreshop_resource_field_getter", + iconCls: "pimcore_icon_operator_object_field_getter", + defaultText: "CoreShop Resource Field Getter", + group: "getter" +}); \ No newline at end of file