You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2024/11/05 19:11:40 UTC
(ofbiz-framework) branch release24.09 updated: Improved: Slim down use of ${groovy: } (OFBIZ-13146) (#838)
This is an automated email from the ASF dual-hosted git repository.
nmalin pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 9464a4f210 Improved: Slim down use of ${groovy: } (OFBIZ-13146) (#838)
9464a4f210 is described below
commit 9464a4f2107ea2f63b44db3e4fa444a7794c3e16
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Tue Nov 5 18:32:03 2024 +0100
Improved: Slim down use of ${groovy: } (OFBIZ-13146) (#838)
* Improved: Slim down use of ${groovy: } (OFBIZ-13146)
With the framework evolution, we used on many place the scriptlet ${groovy: } on screen rendering where something it's now unecessary.
This issue convert some of them on a other solution to slim down this usage
---
.../invoice/DisplayInvoiceAmounts.groovy | 25 +++++++
.../ledger/PartyPreferenceTooltipLabels.groovy | 25 +++++++
.../accounting/widget/BillingAccountForms.xml | 8 +-
applications/accounting/widget/GlSetupForms.xml | 87 +++++++---------------
.../commonext/ofbizsetup/SystemInfoNote.groovy | 29 ++++++++
applications/commonext/widget/CommonScreens.xml | 12 +--
.../content/widget/website/WebSiteForms.xml | 2 +-
.../widget/manufacturing/ProductionRunForms.xml | 6 +-
applications/marketing/widget/ContactListForms.xml | 2 +-
.../order/widget/ordermgr/OrderEntryForms.xml | 2 +-
applications/party/widget/partymgr/PartyForms.xml | 13 ++--
.../widget/catalog/ImageManagementForms.xml | 3 +-
.../org/apache/ofbiz/common/GetUiLabels.groovy | 21 ++++++
themes/common-theme/widget/CommonScreens.xml | 2 +-
14 files changed, 143 insertions(+), 94 deletions(-)
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/DisplayInvoiceAmounts.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/DisplayInvoiceAmounts.groovy
new file mode 100644
index 0000000000..32b7dd7d58
--- /dev/null
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/DisplayInvoiceAmounts.groovy
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.ofbiz.accounting.invoice
+
+String invoiceId = context.invoiceId
+BigDecimal amountToApply = InvoiceWorker.getInvoiceNotApplied(delegator, invoiceId)
+context.paidInvoice = amountToApply == 0
+context.amountToApply = amountToApply
+context.total = InvoiceWorker.getInvoiceTotal(delegator, invoiceId)
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/ledger/PartyPreferenceTooltipLabels.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/ledger/PartyPreferenceTooltipLabels.groovy
new file mode 100644
index 0000000000..4204e6478a
--- /dev/null
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/ledger/PartyPreferenceTooltipLabels.groovy
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.ofbiz.accounting.ledger
+
+List fieldForTooltip = delegator.getModelEntity('PartyAcctgPreference').getAllFieldNames()
+String labelInherited = label('AccountingUiLabels', 'AccountingInheritedValue')
+fieldForTooltip.each {
+ context."${it}Tooltip" = !context.partyAcctgPreference?.(it) && context.aggregatedPartyAcctgPreference?.(it) ? labelInherited : ''
+}
diff --git a/applications/accounting/widget/BillingAccountForms.xml b/applications/accounting/widget/BillingAccountForms.xml
index f55a6ce4c1..0a8cbd840a 100644
--- a/applications/accounting/widget/BillingAccountForms.xml
+++ b/applications/accounting/widget/BillingAccountForms.xml
@@ -80,13 +80,7 @@ under the License.
<field-map field-name="compareDate" from-field="invoiceDate"/>
<field-map field-name="lastNameFirst" value="Y"/>
</service>
- <set field="paidInvoice" value="${groovy: org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId).compareTo(java.math.BigDecimal.ZERO)==0}" type="Boolean"/>
- <set field="amountToApply" value="${groovy:
- import java.text.NumberFormat;
- return(NumberFormat.getNumberInstance(locale).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
- <set field="total" value="${groovy:
- import java.text.NumberFormat;
- return(NumberFormat.getNumberInstance(locale).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
+ <script location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/DisplayInvoiceAmounts.groovy"/>
</row-actions>
<field name="billingAccountId"><hidden/></field>
<field name="invoiceId" widget-style="buttontext">
diff --git a/applications/accounting/widget/GlSetupForms.xml b/applications/accounting/widget/GlSetupForms.xml
index b50f8d49ea..21bf4da094 100644
--- a/applications/accounting/widget/GlSetupForms.xml
+++ b/applications/accounting/widget/GlSetupForms.xml
@@ -159,6 +159,7 @@ under the License.
<field-map field-name="organizationPartyId"/>
</service>
<set field="aggregatedPartyAcctgPreference" from-field="result.partyAccountingPreference" type="Object"/>
+ <script location="component://accounting/src/main/groovy/org/apache/ofbiz/accounting/ledger/PartyPreferenceTooltipLabels.groovy"/>
</actions>
<alt-target use-when="partyAcctgPreference!=null" target="updatePartyAcctgPreference"/>
<auto-fields-service service-name="createPartyAcctgPreference"/>
@@ -167,7 +168,7 @@ under the License.
<field name="partyId" title="${uiLabelMap.AccountingOrganizationPartyId}"><display/></field>
<!-- if there is no partyAcctgPreference yet, then we show drop-downs for the fields and a submit button -->
<field name="fiscalYearStartMonth" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('fiscalYearStartMonth')!=null)return (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${fiscalYearStartMonthTooltip}">
<drop-down>
<option key="1" description="${uiLabelMap.AccountingFiscalMonth01}"/>
<option key="2" description="${uiLabelMap.AccountingFiscalMonth02}"/>
@@ -184,7 +185,7 @@ under the License.
</drop-down>
</field>
<field name="fiscalYearStartDay" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('fiscalYearStartDay')!=null)return (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${fiscalYearStartDayTooltip}">
<drop-down>
<option key="1"/><option key="2"/><option key="3"/><option key="4"/><option key="5"/>
<option key="6"/><option key="7"/><option key="8"/><option key="9"/><option key="10"/>
@@ -196,8 +197,7 @@ under the License.
</drop-down>
</field>
<field name="taxFormId" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('taxFormId')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${taxFormIdTooltip}">
<drop-down>
<entity-options entity-name="Enumeration" key-field-name="enumId">
<entity-constraint name="enumTypeId" operator="equals" value="TAX_FORMS"/>
@@ -206,7 +206,7 @@ under the License.
</drop-down>
</field>
<field name="cogsMethodId" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('cogsMethodId')!=null)return (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${cogsMethodIdTooltip}">
<drop-down>
<entity-options entity-name="Enumeration" key-field-name="enumId">
<entity-constraint name="enumTypeId" operator="equals" value="COGS_METHODS"/>
@@ -215,8 +215,7 @@ under the License.
</drop-down>
</field>
<field name="baseCurrencyUomId" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('baseCurrencyUomId')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${baseCurrencyUomIdTooltip}">
<drop-down no-current-selected-key="${defaultOrganizationPartyCurrencyUomId}">
<entity-options key-field-name="uomId" description="${description} - ${abbreviation}" entity-name="Uom">
<entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
@@ -225,113 +224,77 @@ under the License.
</drop-down>
</field>
<field name="invoiceIdPrefix" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('invoiceIdPrefix')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${invoiceIdPrefixTooltip}">
<text maxlength="10" size="5"/>
</field>
<field name="useInvoiceIdForReturns" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('useInvoiceIdForReturns')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${useInvoiceIdForReturnsTooltip}">
<drop-down allow-empty="true">
<option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/>
</drop-down>
</field>
<field name="quoteIdPrefix" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('quoteIdPrefix')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${quoteIdPrefixTootlip}">
<text maxlength="10" size="5"/>
</field>
<field name="orderIdPrefix" use-when="partyAcctgPreference==null"
- tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties; if(aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('orderIdPrefix')!=null)return (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ tooltip="${orderIdPrefixTooltip}">
<text maxlength="10" size="5"/>
</field>
<field name="createButton" use-when="partyAcctgPreference==null" title="${uiLabelMap.CommonAdd}"><submit/></field>
<field name="updateButton" use-when="partyAcctgPreference!=null" title="${uiLabelMap.CommonUpdate}"><submit/></field>
<!-- otherwise, we just display the fields. there is no submit button because we shouldn't try to create it again and don't support an update option right now-->
- <field name="fiscalYearStartMonth" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('fiscalYearStartMonth')==null&&aggregatedPartyAcctgPreference.get('fiscalYearStartMonth')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="fiscalYearStartMonth" use-when="partyAcctgPreference!=null" tooltip="${fiscalYearStartMonthTooltip}">
<display/>
</field>
- <field name="fiscalYearStartDay" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('fiscalYearStartDay')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('fiscalYearStartDay')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="fiscalYearStartDay" use-when="partyAcctgPreference!=null" tooltip="${fiscalYearStartDayTooltip}">
<display/>
</field>
- <field name="taxFormId" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('taxFormId')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('taxFormId')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="taxFormId" use-when="partyAcctgPreference!=null" tooltip="${taxFormIdTooltip}">
<display-entity entity-name="Enumeration" key-field-name="enumId"/>
</field>
- <field name="cogsMethodId" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('cogsMethodId')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('cogsMethodId')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="cogsMethodId" use-when="partyAcctgPreference!=null" tooltip="${cogsMethodIdTooltip}">
<display-entity entity-name="Enumeration" key-field-name="enumId"/>
</field>
- <field name="baseCurrencyUomId" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('baseCurrencyUomId')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('baseCurrencyUomId')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="baseCurrencyUomId" use-when="partyAcctgPreference!=null" tooltip="${baseCurrencyUomIdTooltip}">
<display/>
</field>
- <field name="invoiceIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('invoiceIdPrefix')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('invoiceIdPrefix')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="invoiceIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${invoiceIdPrefixTooltip}">
<display/>
</field>
- <field name="useInvoiceIdForReturns" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('useInvoiceIdForReturns')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('useInvoiceIdForReturns')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="useInvoiceIdForReturns" use-when="partyAcctgPreference!=null" tooltip="${useInvoiceIdForReturnsTooltip}">
<display/>
</field>
- <field name="quoteIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('quoteIdPrefix')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('quoteIdPrefix')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="quoteIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${quoteIdPrefixTooltip}">
<display/>
</field>
- <field name="lastQuoteNumber" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('lastQuoteNumber')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastQuoteNumber')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="lastQuoteNumber" use-when="partyAcctgPreference!=null" tooltip="${lastQuoteNumberTooltip}">
<display/>
</field>
- <field name="orderIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('orderIdPrefix')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('orderIdPrefix')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="orderIdPrefix" use-when="partyAcctgPreference!=null" tooltip="${orderIdPrefixTooltip}">
<display/>
</field>
- <field name="lastOrderNumber" use-when="partyAcctgPreference!=null" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if(partyAcctgPreference!= null&&partyAcctgPreference.get('lastOrderNumber')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastOrderNumber')!=null)return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="lastOrderNumber" use-when="partyAcctgPreference!=null" tooltip="${lastOrderNumberTooltip}">
<display/>
</field>
<!-- these 2 are ONLY displayed, never allow manual editing -->
- <field name="lastInvoiceNumber" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if((partyAcctgPreference==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastInvoiceNumber')!=null) ||
- (partyAcctgPreference!=null&&partyAcctgPreference.get('lastInvoiceNumber')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastInvoiceNumber')!=null))return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="lastInvoiceNumber" tooltip="${lastInvoiceNumberTooltip}">
<display/>
</field>
- <field name="lastInvoiceRestartDate" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if((partyAcctgPreference==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastInvoiceRestartDate')!=null) ||
- (partyAcctgPreference!=null&&partyAcctgPreference.get('lastInvoiceRestartDate')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('lastInvoiceRestartDate')!=null))return (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="lastInvoiceRestartDate" tooltip="${lastInvoiceRestartDateTooltip}">
<display/>
</field>
<!-- these 2 are always can be updated -->
- <field name="refundPaymentMethodId" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if((partyAcctgPreference==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('refundPaymentMethodId')!=null) ||
- (partyAcctgPreference!=null&&partyAcctgPreference.get('refundPaymentMethodId')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('refundPaymentMethodId')!=null))return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="refundPaymentMethodId" tooltip="${refundPaymentMethodIdTooltip}">
<drop-down>
<entity-options entity-name="PaymentMethod" key-field-name="paymentMethodId">
<entity-constraint name="partyId" operator="equals" env-name="organizationPartyId"/>
</entity-options>
</drop-down>
</field>
- <field name="errorGlJournalId" tooltip="${groovy: import org.apache.ofbiz.base.util.UtilProperties;
- if((partyAcctgPreference==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('errorGlJournalId')!=null) ||
- (partyAcctgPreference!=null&&partyAcctgPreference.get('errorGlJournalId')==null&&aggregatedPartyAcctgPreference!= null&&aggregatedPartyAcctgPreference.get('errorGlJournalId')!=null))return
- (UtilProperties.getMessage('AccountingUiLabels', 'AccountingInheritedValue', locale))}">
+ <field name="errorGlJournalId" tooltip="${errorGlJournalIdTooltip}">
<drop-down allow-empty="true">
<entity-options entity-name="GlJournal" key-field-name="glJournalId" description="${glJournalName} [${glJournalId}]">
<entity-constraint name="organizationPartyId" operator="equals" env-name="organizationPartyId"/>
diff --git a/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoNote.groovy b/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoNote.groovy
new file mode 100644
index 0000000000..10effd80e5
--- /dev/null
+++ b/applications/commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoNote.groovy
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.ofbiz.commonext.ofbizsetup
+
+Map serviceResult = run service: 'getLastSystemInfoNote', with: parameters
+ context.layoutSettings.middleTopHeader = "---------- ${uiLabelMap.CommonLastSytemNotes} ----------"
+['1', '2', '3'].each {
+ Map infoNote = serviceResult."lastSystemInfoNote$it"
+ context.layoutSettings."middleTopMessage$it" = infoNote ? "${infoNote.noteDateTime.toString().substring(0, 16)} ${infoNote.noteInfo}" : ''
+ context.layoutSettings."middleTopLink$it" = infoNote && infoNote.moreInfoUrl && infoNote.moreInfoItemName && infoNote.moreInfoItemId
+ ? "${infoNote.moreInfoUrl}?${infoNote.moreInfoItemName}=${infoNote.moreInfoItemId}&id=${infoNote.moreInfoItemId}"
+ : ''
+}
diff --git a/applications/commonext/widget/CommonScreens.xml b/applications/commonext/widget/CommonScreens.xml
index 6c110b2ce6..46df879425 100644
--- a/applications/commonext/widget/CommonScreens.xml
+++ b/applications/commonext/widget/CommonScreens.xml
@@ -33,17 +33,7 @@ under the License.
<set field="layoutSettings.topLines[]" from-field="line" global="true"/>
<script location="component://commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/ChangeOrgPartyId.groovy"/><!-- to see ofbizsetup needs to be displayed -->
<!-- system info notes -->
- <service service-name="getLastSystemInfoNote" result-map="resultNote"/>
- <set field="lastSystemInfoNote1" from-field="resultNote.lastSystemInfoNote1"/>
- <set field="lastSystemInfoNote2" from-field="resultNote.lastSystemInfoNote2"/>
- <set field="lastSystemInfoNote3" from-field="resultNote.lastSystemInfoNote3"/>
- <set field="layoutSettings.middleTopHeader" value="---------- ${uiLabelMap.CommonLastSytemNotes} ----------"/>
- <set field="layoutSettings.middleTopMessage1" value="${groovy:lastSystemInfoNote1!=null?lastSystemInfoNote1.noteDateTime.toString().substring(0,16) + " " + lastSystemInfoNote1.noteInfo:""}"/>
- <set field="layoutSettings.middleTopMessage2" value="${groovy:lastSystemInfoNote2!=null?lastSystemInfoNote2.noteDateTime.toString().substring(0,16) + " " + lastSystemInfoNote2.noteInfo:""}"/>
- <set field="layoutSettings.middleTopMessage3" value="${groovy:lastSystemInfoNote3!=null?lastSystemInfoNote3.noteDateTime.toString().substring(0,16) + " " + lastSystemInfoNote3.noteInfo:""}"/>
- <set field="layoutSettings.middleTopLink1" value="${lastSystemInfoNote1.moreInfoUrl}${groovy: if (lastSystemInfoNote1&&lastSystemInfoNote1.moreInfoItemName&&lastSystemInfoNote1.moreInfoItemId)"?" + lastSystemInfoNote1.moreInfoItemName + "=" + lastSystemInfoNote1.moreInfoItemId + "&id=" + lastSystemInfoNote1.moreInfoItemId;}"/>
- <set field="layoutSettings.middleTopLink2" value="${lastSystemInfoNote2.moreInfoUrl}${groovy: if (lastSystemInfoNote2&&lastSystemInfoNote2.moreInfoItemName&&lastSystemInfoNote2.moreInfoItemId)"?" + lastSystemInfoNote2.moreInfoItemName + "=" + lastSystemInfoNote2.moreInfoItemId + "&id=" + lastSystemInfoNote2.moreInfoItemId;}"/>
- <set field="layoutSettings.middleTopLink3" value="${lastSystemInfoNote3.moreInfoUrl}${groovy: if (lastSystemInfoNote3&&lastSystemInfoNote3.moreInfoItemName&&lastSystemInfoNote3.moreInfoItemId)"?" + lastSystemInfoNote3.moreInfoItemName + "=" + lastSystemInfoNote3.moreInfoItemId + "&id=" + lastSystemInfoNote3.moreInfoItemId;}"/>
+ <script location="component://commonext/src/main/groovy/org/apache/ofbiz/commonext/ofbizsetup/SystemInfoNote.groovy"/>
<!-- Help link actions -->
<set field="helpTopic" value="${groovy: webappName.toUpperCase() + '_' + requestAttributes._CURRENT_VIEW_}"/>
<entity-and entity-name="ContentAssoc" list="pageAvail">
diff --git a/applications/content/widget/website/WebSiteForms.xml b/applications/content/widget/website/WebSiteForms.xml
index 01f233d1e2..bae024416e 100644
--- a/applications/content/widget/website/WebSiteForms.xml
+++ b/applications/content/widget/website/WebSiteForms.xml
@@ -274,7 +274,7 @@ under the License.
<form name="CreateWebSiteContactList" type="single" target="createWebSiteContactList"
default-map-name="webSite" title="" header-row-style="header-row" default-table-style="basic-table">
<actions>
- <set field="fromDate" value="${groovy: import org.apache.ofbiz.base.util.UtilDateTime; return UtilDateTime.nowTimestamp();}" type="Timestamp"/>
+ <set field="fromDate" value="${date:nowTimestamp()}" type="Timestamp"/>
</actions>
<field name="webSiteId"><display/></field>
<field name="siteName"><display/></field>
diff --git a/applications/manufacturing/widget/manufacturing/ProductionRunForms.xml b/applications/manufacturing/widget/manufacturing/ProductionRunForms.xml
index 73b42b6834..57573320f3 100644
--- a/applications/manufacturing/widget/manufacturing/ProductionRunForms.xml
+++ b/applications/manufacturing/widget/manufacturing/ProductionRunForms.xml
@@ -552,13 +552,13 @@ under the License.
<field name="drObjectInfo" title="${uiLabelMap.CommonContent}">
<display description="default ${drObjectInfo}"/>
</field>
- <field name="drObjectInfo" title="${uiLabelMap.CommonContent}" use-when="${groovy: drDataResourceTypeId != null && (drDataResourceTypeId.contains("FILE") || drDataResourceTypeId.equals("IMAGE_OBJECT"))}">
+ <field name="drObjectInfo" title="${uiLabelMap.CommonContent}" use-when="${drDataResourceTypeId?.contains('FILE') || drDataResourceTypeId == 'IMAGE_OBJECT'}">
<hyperlink description="${drObjectInfo}" target="/content/control/ViewBinaryDataResource" target-type="content" target-window="productionRunContentWindow">
<parameter param-name="dataResourceId" from-field="drDataResourceId"/>
</hyperlink>
</field>
- <field name="drObjectInfo" title="${uiLabelMap.CommonContent}" entry-name="drDataResourceId" encode-output="true" use-when="${groovy: drDataResourceTypeId != null && drDataResourceTypeId.equals("ELECTRONIC_TEXT")}">
- <display-entity entity-name="ElectronicText" key-field-name="dataResourceId" description="${textData}"></display-entity>
+ <field name="drObjectInfo" title="${uiLabelMap.CommonContent}" entry-name="drDataResourceId" encode-output="true" use-when="${drDataResourceTypeId == 'ELECTRONIC_TEXT'}">
+ <display-entity entity-name="ElectronicText" key-field-name="dataResourceId" description="${textData}"/>
</field>
<field name="deleteLink" title=" " widget-style="smallSubmit">
<hyperlink description="${uiLabelMap.CommonDelete}" target="deleteProductionRunContent" also-hidden="false">
diff --git a/applications/marketing/widget/ContactListForms.xml b/applications/marketing/widget/ContactListForms.xml
index e5f0d15351..662314916e 100644
--- a/applications/marketing/widget/ContactListForms.xml
+++ b/applications/marketing/widget/ContactListForms.xml
@@ -623,7 +623,7 @@ under the License.
<form name="CreateWebSiteContactList" type="single" target="createWebSiteContactList"
default-map-name="contactList" title="" header-row-style="header-row" default-table-style="basic-table">
<actions>
- <set field="fromDate" value="${groovy: import org.apache.ofbiz.base.util.UtilDateTime; return UtilDateTime.nowTimestamp();}" type="Timestamp"/>
+ <set field="fromDate" value="${date:nowTimestamp()}" type="Timestamp"/>
</actions>
<field name="contactListId"><display/></field>
<field name="contactListName"><display/></field>
diff --git a/applications/order/widget/ordermgr/OrderEntryForms.xml b/applications/order/widget/ordermgr/OrderEntryForms.xml
index 90d60a55b1..c225b58938 100644
--- a/applications/order/widget/ordermgr/OrderEntryForms.xml
+++ b/applications/order/widget/ordermgr/OrderEntryForms.xml
@@ -154,7 +154,7 @@ under the License.
<row-actions>
<entity-one entity-name="Product" value-field="product" auto-field-map="true"/>
<set field=""/>
- <set field="hasAmount" value="${groovy:product.getString('requireAmount')?:'N'}"/>
+ <set field="hasAmount" from-field="product.requireAmount" default-value="N"/>
</row-actions>
<field name="productId" title="${uiLabelMap.ProductProductId}" widget-style="buttontext">
<hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems" target-type="inter-app">
diff --git a/applications/party/widget/partymgr/PartyForms.xml b/applications/party/widget/partymgr/PartyForms.xml
index 1e1e5bfb30..1c12f16d56 100644
--- a/applications/party/widget/partymgr/PartyForms.xml
+++ b/applications/party/widget/partymgr/PartyForms.xml
@@ -137,16 +137,17 @@ under the License.
<entity-and entity-name="UserLogin" list="logins" use-cache="true">
<field-map field-name="partyId" from-field="partyId"/>
</entity-and>
- <set field="userLoginSize" value="${groovy:logins.size()}" type="Integer"/>
+ <set field="userLoginSize" value="${util:size(logins)}" type="Integer"/>
<service service-name="getPartyMainRole" result-map="mainRole">
<field-map field-name="partyId" from-field="partyId"/>
<field-map field-name="userLogin" from-field="userLogin"/>
</service>
- <entity-and entity-name="PartyClassification" list="partyClassifications" use-cache="true">
- <field-map field-name="partyId" from-field="partyId"/>
- </entity-and>
- <set field="fieldId" value="partyClassificationGroupId"/>
- <set field="partyClassificationGroupIds" value="${groovy:org.apache.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(partyClassifications, fieldId, true);}"/>
+ <entity-condition entity-name="PartyClassification" list="partyClassifications" use-cache="true" distinct="true">
+ <condition-expr field-name="partyId" from-field="partyId"/>
+ <select-field field-name="partyClassificationGroupId"/>
+ </entity-condition>
+ <set field="partyClassificationGroupIds" value="${groovy: partyClassifications*.partyClassificationGroupId}"/>
+ <service service-name="getPartyNameForDate" result-map="partyName"/>
</row-actions>
<field name="partyId" sort-field="true" widget-style="buttontext">
<hyperlink description="${partyId}" target="viewprofile">
diff --git a/applications/product/widget/catalog/ImageManagementForms.xml b/applications/product/widget/catalog/ImageManagementForms.xml
index 568363c50c..2b029ba217 100644
--- a/applications/product/widget/catalog/ImageManagementForms.xml
+++ b/applications/product/widget/catalog/ImageManagementForms.xml
@@ -534,7 +534,8 @@ under the License.
<grid name="ListImageUpload" title="" list-name="productContent" odd-row-style="alternate-row" default-table-style="basic-table" use-row-submit="true" separate-columns="true">
<actions>
- <set field="dateNow" type="Timestamp" value="${groovy:import org.apache.ofbiz.base.util.UtilDateTime;UtilDateTime.nowTimestamp().getTime() - 18000;}"/>
+ <set field="dateNow" type="Timestamp" value="${date:nowTimestamp()}"/>
+ <set field="dateNow" type="Timestamp" value="${groovy: dateNow.getTime() - 18000}"/>
<entity-condition entity-name="ProductContentAndInfo">
<condition-list combine="and">
<condition-expr field-name="productId" from-field="parameters.productId"/>
diff --git a/framework/common/src/main/groovy/org/apache/ofbiz/common/GetUiLabels.groovy b/framework/common/src/main/groovy/org/apache/ofbiz/common/GetUiLabels.groovy
new file mode 100644
index 0000000000..e189db25b9
--- /dev/null
+++ b/framework/common/src/main/groovy/org/apache/ofbiz/common/GetUiLabels.groovy
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.ofbiz.common
+
+context.requiredLabels = new groovy.json.JsonSlurper().parseText(parameters.requiredLabels)
diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml
index 24b4c1e7ae..4a80694c0f 100644
--- a/themes/common-theme/widget/CommonScreens.xml
+++ b/themes/common-theme/widget/CommonScreens.xml
@@ -662,7 +662,7 @@ under the License.
<section>
<actions>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
- <set field="requiredLabels" value="${groovy: new groovy.json.JsonSlurper().parseText(parameters.requiredLabels)}"/>
+ <script location="component://common/src/main/groovy/org/apache/ofbiz/common/GetUiLabels.groovy"/>
</actions>
<widgets>
<platform-specific><text><html-template location="component://common-theme/template/GetUiLabels.ftl"/></text></platform-specific>