(ofbiz-framework) branch trunk updated: Fixed: Error when calling EntityQuery.from() with a dve via groovy DSL (OFBIZ-13077)

2024-05-13 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8aa27e3b4d Fixed: Error when calling EntityQuery.from() with a dve via 
groovy DSL (OFBIZ-13077)
8aa27e3b4d is described below

commit 8aa27e3b4d08c0471c201fc83fd494399b1586d7
Author: MLeila 
AuthorDate: Mon May 13 18:06:42 2024 +0200

Fixed: Error when calling EntityQuery.from() with a dve via groovy DSL 
(OFBIZ-13077)

This add the Groovy DSL for EntityQuery.from(DynamicViewEntity dve)
---
 .../org/apache/ofbiz/service/engine/GroovyBaseScript.groovy  | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
index 5351b744bb..fa7c9bae5a 100644
--- 
a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
+++ 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
@@ -21,6 +21,7 @@ package org.apache.ofbiz.service.engine
 import org.apache.ofbiz.base.util.Debug
 import org.apache.ofbiz.base.util.UtilProperties
 import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.model.DynamicViewEntity
 import org.apache.ofbiz.entity.util.EntityQuery
 import org.apache.ofbiz.service.DispatchContext
 import org.apache.ofbiz.service.ExecutionServiceException
@@ -90,8 +91,12 @@ abstract class GroovyBaseScript extends Script {
 return binding.getVariable('delegator').makeValidValue(entityName, 
inputMap)
 }
 
-EntityQuery from(String entity) {
-return EntityQuery.use(binding.getVariable('delegator')).from(entity)
+EntityQuery from(String entityName) {
+return 
EntityQuery.use(binding.getVariable('delegator')).from(entityName)
+}
+
+EntityQuery from(DynamicViewEntity dynamicViewEntity) {
+return 
EntityQuery.use(binding.getVariable('delegator')).from(dynamicViewEntity)
 }
 
 EntityQuery select(String... fields) {



(ofbiz-framework) branch trunk updated: Fixed: Issue when caching a query with a selectField (OFBIZ-13072) (#787)

2024-05-02 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 0748e67e5e Fixed: Issue when caching a query with a selectField 
(OFBIZ-13072) (#787)
0748e67e5e is described below

commit 0748e67e5eee689425bcb08f73024d659b7007a2
Author: MLeila 
AuthorDate: Thu May 2 09:44:48 2024 +0200

Fixed: Issue when caching a query with a selectField (OFBIZ-13072) (#787)

When a query with a field selection and a cache() option is done, the
result is put in cache with the incomplete genericValue (I mean without
all the fields).

Then when an other query with the same condition and cache option is
done, even whitout the field selection, the result returned is the
incomplete version of the GenericValue that has been stored in cache.

This prevent from adding in cache an incomplete genericValue and filter
the cached value when necessary
---
 .../org/apache/ofbiz/entity/GenericDelegator.java  |  2 +-
 .../ofbiz/entity/test/EntityQueryTestSuite.java| 38 ++
 .../org/apache/ofbiz/entity/util/EntityQuery.java  |  5 ++-
 .../org/apache/ofbiz/entity/util/EntityUtil.java   | 15 +
 4 files changed, 58 insertions(+), 2 deletions(-)

diff --git 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
index 1ad455082c..512a3634d6 100644
--- 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
+++ 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
@@ -1649,7 +1649,7 @@ public class GenericDelegator implements Delegator {
 list = eli.getCompleteList();
 }
 
-if (useCache) {
+if (useCache && UtilValidate.isEmpty(fieldsToSelect)) {
 ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_PUT, 
EntityEcaHandler.OP_FIND, dummyValue, false);
 this.cache.put(entityName, entityCondition, orderBy, list);
 }
diff --git 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
index b0d55db27c..66b16f542d 100644
--- 
a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
+++ 
b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
@@ -18,6 +18,7 @@
  
***/
 package org.apache.ofbiz.entity.test;
 
+import java.sql.Timestamp;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -469,6 +470,43 @@ public class EntityQueryTestSuite extends EntityTestCase {
 }
 }
 
+/**
+ * testCache(): When cache() is activated, the result of a query is set to 
cache for a given condition.
+ * assert: Ensure that a request with a select or a date filter stored in 
cache is not retrieved by a query
+ * without select nor date filter having the same condition.
+ */
+public void testCache() throws GenericEntityException {
+Timestamp now = UtilDateTime.nowTimestamp();
+Delegator delegator = getDelegator();
+
+delegator.create("TestingType", "testingTypeId", "cacheWithSelect", 
"description", "cache with selection One");
+delegator.create("TestingType", "testingTypeId", "cacheWithDate", 
"description", "cache with filterByDate One");
+
+delegator.create("TestingNode", "testingNodeId", "testingCacheNode1");
+delegator.create("TestingNode", "testingNodeId", "testingCacheNode2");
+
+delegator.create("Testing", "testingId", "testingCache1", 
"testingTypeId", "cacheWithDate");
+
+delegator.create("TestingNodeMember", "testingNodeId", 
"testingCacheNode1", "testingId", "testingCache1", "fromDate",
+now, "thruDate", UtilDateTime.getNextDayStart(now));
+delegator.create("TestingNodeMember", "testingNodeId", 
"testingCacheNode2", "testingId", "testingCache1", "fromDate",
+now, "thruDate", now);
+
+List cachedResultWithFilterByDate = 
EntityQuery.use(delegator).from("TestingNodeMember").filterByDate()
+.where("testingId", "testingCache1").cache().queryList();
+assertEquals("testCache(): Number of record

(ofbiz-framework) branch trunk updated: Fixed: invoiceOverview generates an error (OFBIZ-13017) (#780)

2024-04-23 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new edcf41917c Fixed: invoiceOverview generates an error (OFBIZ-13017) 
(#780)
edcf41917c is described below

commit edcf41917c3e6fbeaa832f63cd98daf78d3fd34a
Author: MLeila 
AuthorDate: Tue Apr 23 08:55:24 2024 +0200

Fixed: invoiceOverview generates an error (OFBIZ-13017) (#780)

Update fix to combine  OFBIZ-12966 and OFBIZ-13011 updates with
modifications brought by jira OFBIZ-12994

It brings back the changes introduced by OFBIZ-12994 and adapt it with
the change of invoiceOverview screen name
---
 applications/accounting/widget/InvoiceScreens.xml | 550 +-
 1 file changed, 17 insertions(+), 533 deletions(-)

diff --git a/applications/accounting/widget/InvoiceScreens.xml 
b/applications/accounting/widget/InvoiceScreens.xml
index 7dabb105e5..b93e852c75 100644
--- a/applications/accounting/widget/InvoiceScreens.xml
+++ b/applications/accounting/widget/InvoiceScreens.xml
@@ -41,6 +41,10 @@ under the License.
 
 
 
+
+
+
+
 
 ${uiLabelMap.CommonInvoice}: ${invoiceId}
 
@@ -83,27 +87,7 @@ under the License.
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
 
 
 
@@ -111,24 +95,10 @@ under the License.
 
 
 
-
-
-
-
-
 
 
 
-
-
-
-
-
-
-
-
-
-
+
 
 
 
@@ -175,141 +145,10 @@ under the License

(ofbiz-framework) branch release22.01 updated: Fixed: Broken draggable/resizable modals in Helveticus (OFBIZ-12992)

2024-04-05 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
 new d5fc4ff71b Fixed: Broken draggable/resizable modals in Helveticus 
(OFBIZ-12992)
d5fc4ff71b is described below

commit d5fc4ff71b3eeef8a2c5ac93bb1e3d9db3d363f7
Author: Florian Motteau 
AuthorDate: Fri Apr 5 10:17:36 2024 +0200

Fixed: Broken draggable/resizable modals in Helveticus (OFBIZ-12992)

CSS rules were preventing jQuery UI Dialogs to be draggable
(!important in CSS overriding top/left inline styles).
Removes "transition: .5s" on dialog elements : it causes
slowdowns on drag/resize (a CSS animation is triggered each
time the user moves/resizes the dialog)

Thanks: Gavinju for reporting and Florian Motteau for providing the PR.
---
 .../helveticus/webapp/helveticus/helveticus-main-theme.less  | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/themes/helveticus/webapp/helveticus/helveticus-main-theme.less 
b/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
index 0ff04c666e..460f68037d 100644
--- a/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
+++ b/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
@@ -97,7 +97,10 @@ span.label{
 }
 
 /*** BUTTON /LINK / NAV STYLES ***/
-a, a:hover, * {
+// * { transition: .5s } is very (too) broad, it causes slowdowns on 
draggable/resizable elements like modals
+// (leads to animations for each new size/position, eventually each pixel...)
+// We should invert the logic here : transitions on chosen elements instead of 
everywhere except some elements.
+a, a:hover, *:not(.ui-dialog, .ui-dialog-content) {
   text-decoration:none;
   -o-transition:.5s;
   -ms-transition:.5s;
@@ -1391,8 +1394,6 @@ form .basic-table,
   }
 }
 .ui-dialog{
-  left: ~"calc(50% - 320px)" !important;
-  top: 2rem !important;
   box-shadow: 0 0 15px 15px @shadow-color !important;
 }
 
@@ -1496,11 +1497,6 @@ form .basic-table,
 }
   }
 }
-.ui-dialog{
-  left: ~"calc(50% - 320px)" !important;
-  top: 2rem !important;
-  box-shadow: 0 0 15px 15px @shadow-color !important;
-}
 
 .hidden{
   display: none;



(ofbiz-framework) branch trunk updated: Fixed: Broken draggable/resizable modals in Helveticus (OFBIZ-12992)

2024-04-05 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new fc8fcfec43 Fixed: Broken draggable/resizable modals in Helveticus 
(OFBIZ-12992)
fc8fcfec43 is described below

commit fc8fcfec4311f77ea6f273514de756338befbefa
Author: Florian Motteau 
AuthorDate: Fri Apr 5 10:17:36 2024 +0200

Fixed: Broken draggable/resizable modals in Helveticus (OFBIZ-12992)

CSS rules were preventing jQuery UI Dialogs to be draggable
(!important in CSS overriding top/left inline styles).
Removes "transition: .5s" on dialog elements : it causes
slowdowns on drag/resize (a CSS animation is triggered each
time the user moves/resizes the dialog)

Thanks: Gavinju for reporting and Florian Motteau for providing the PR.
---
 .../helveticus/webapp/helveticus/helveticus-main-theme.less  | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/themes/helveticus/webapp/helveticus/helveticus-main-theme.less 
b/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
index b8503bce3c..ca2d5094f8 100644
--- a/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
+++ b/themes/helveticus/webapp/helveticus/helveticus-main-theme.less
@@ -97,7 +97,10 @@ span.label{
 }
 
 /*** BUTTON /LINK / NAV STYLES ***/
-a, a:hover, * {
+// * { transition: .5s } is very (too) broad, it causes slowdowns on 
draggable/resizable elements like modals
+// (leads to animations for each new size/position, eventually each pixel...)
+// We should invert the logic here : transitions on chosen elements instead of 
everywhere except some elements.
+a, a:hover, *:not(.ui-dialog, .ui-dialog-content) {
   text-decoration:none;
   -o-transition:.5s;
   -ms-transition:.5s;
@@ -1390,8 +1393,6 @@ form .basic-table,
   }
 }
 .ui-dialog{
-  left: ~"calc(50% - 320px)" !important;
-  top: 2rem !important;
   box-shadow: 0 0 15px 15px @shadow-color !important;
 }
 
@@ -1501,11 +1502,6 @@ form .basic-table,
 }
   }
 }
-.ui-dialog{
-  left: ~"calc(50% - 320px)" !important;
-  top: 2rem !important;
-  box-shadow: 0 0 15px 15px @shadow-color !important;
-}
 
 .hidden{
   display: none;



(ofbiz-framework) branch trunk updated: Fixed: Fix problems with Eclipse about multi module dependencies (OFBIZ-12963)

2024-03-26 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new ced48a61ce Fixed: Fix problems with Eclipse about multi module 
dependencies (OFBIZ-12963)
ced48a61ce is described below

commit ced48a61cee2600f0a6cb93a2d98c4139faa2b94
Author: MLeila 
AuthorDate: Tue Mar 26 14:21:20 2024 +0100

Fixed: Fix problems with Eclipse about multi module dependencies
(OFBIZ-12963)

Correction of java problems signaled by Eclipse due to the presence of
the same classes in different module

Thanks: Gil Portenseigne for reporting and providing the patch.
---
 dependencies.gradle | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dependencies.gradle b/dependencies.gradle
index b49965fbb9..714bcda0a0 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -81,7 +81,10 @@ dependencies {
 implementation 'org.jdom:jdom:1.1.3' // don't upgrade above 1.1.3, makes a 
lot of not obvious and useless complications, see last commits of OFBIZ-12092 
for more
 implementation 'com.google.re2j:re2j:1.7'
 implementation 'xerces:xercesImpl:2.12.2'
-implementation 'org.mustangproject:library:2.8.0' // 2.10.0 did not work, 
cf. OFBIZ-12920 
(https://github.com/apache/ofbiz-framework/pull/712#issuecomment-1968960963)
+implementation('org.mustangproject:library:2.8.0') { // 2.10.0 did not 
work, cf. OFBIZ-12920 
(https://github.com/apache/ofbiz-framework/pull/712#issuecomment-1968960963)
+  exclude group: 'pull-parser', module: 'pull-parser'
+  exclude group: 'xpp3', module: 'xpp3'
+}
 
 testImplementation 'org.hamcrest:hamcrest-library:2.2' // Enable junit4 to 
not depend on hamcrest-1.3
 testImplementation 'org.mockito:mockito-core:5.10.0'



(ofbiz-framework) branch trunk updated: Fixed: Corrections based on Codenarc and Checkstyle errors (OFBIZ-12869)

2024-03-15 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 85e28a9559 Fixed: Corrections based on Codenarc and Checkstyle errors 
(OFBIZ-12869)
85e28a9559 is described below

commit 85e28a9559daaa0d3ee2dc152b3f365ab53b0e05
Author: MLeila 
AuthorDate: Fri Mar 15 08:58:10 2024 +0100

Fixed: Corrections based on Codenarc and Checkstyle errors (OFBIZ-12869)
---
 .../webtools/service/SetServiceParameters.groovy   | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git 
a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
 
b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
index 7f5e44634b..d6e1faf507 100644
--- 
a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
+++ 
b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
@@ -34,7 +34,6 @@ import org.apache.ofbiz.widget.model.ModelFormFieldBuilder
 import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
 import org.w3c.dom.Document
 
-
 savedSyncResult = null
 if (session.getAttribute('_SAVED_SYNC_RESULT_') != null) {
 savedSyncResult = session.getAttribute('_SAVED_SYNC_RESULT_')
@@ -66,9 +65,10 @@ if (serviceName) {
 context.uiLabelMap = UtilProperties.getResourceBundleMap('CommonUiLabels', 
locale)
 String formRendererLocationTheme = 
context.visualTheme.getModelTheme().getFormRendererLocation('screen')
 MacroFormRenderer renderer = new 
MacroFormRenderer(formRendererLocationTheme, request, response)
-String dynamicServiceForm = """"""
+String dynamicServiceForm = ''
 Document dynamicServiceFormXml = 
UtilXml.readXmlDocument(dynamicServiceForm, true, true)
-Map modelFormMap = 
FormFactory.readFormDocument(dynamicServiceFormXml, null, context.visualTheme, 
dispatcher.getDispatchContext(), null)
+Map modelFormMap = 
FormFactory.readFormDocument(dynamicServiceFormXml, null, context.visualTheme,
+dispatcher.getDispatchContext(), null)
 ModelForm form
 if (modelFormMap) {
 Map.Entry entry = 
modelFormMap.entrySet().iterator().next()
@@ -86,7 +86,8 @@ if (serviceName) {
 serviceParam = [name: modelParam.name, type: modelParam.type, 
optional: modelParam.optional ? 'Y' : 'N',
 defaultValue: modelParam.defaultValue, value: 
savedSyncResult.get(modelParam.name)]
 } else {
-serviceParam = [name: modelParam.name, type: modelParam.type, 
optional: modelParam.optional ? 'Y' : 'N', defaultValue: 
modelParam.defaultValue]
+serviceParam = [name: modelParam.name, type: modelParam.type, 
optional: modelParam.optional ? 'Y' : 'N',
+defaultValue: modelParam.defaultValue]
 }
 serviceParam.field = prepareServiceParamFieldHtml(delegator, 
modelParam, form, context, renderer, modelService)
 
@@ -97,7 +98,8 @@ if (serviceName) {
 context.serviceParameters = serviceParameters
 
 
-private String prepareServiceParamFieldHtml(Delegator delegator, ModelParam 
modelParam, ModelForm form, Map context, MacroFormRenderer renderer, 
ModelService modelService) {
+private String prepareServiceParamFieldHtml(Delegator delegator, ModelParam 
modelParam, ModelForm form,
+Map context, MacroFormRenderer renderer, ModelService modelService) {
 Writer writer = new StringWriter()
 ModelFormFieldBuilder builder = new ModelFormFieldBuilder()
 boolean isEntityField = false
@@ -110,10 +112,12 @@ private String prepareServiceParamFieldHtml(Delegator 
delegator, ModelParam mode
 prepareEntityFieldBuilder(builder, modelField, modelEntity)
 }
 } catch (GenericEntityException e) {
-Debug.logError(e, "SetServiceParameters.groovy")
+Debug.logError(e, 'SetServiceParameters.groovy')
 }
 }
-if (!isEntityField) prepareServiceFieldBuilder(builder, modelParam, 
modelService)
+if (!isEntityField) {
+prepareServiceFieldBuilder(builder, modelParam, modelService)
+}
 builder.setModelForm(form)
 builder.setAttributeName(modelParam.getName())
 builder.setTitle(modelParam.getFormLabel())
@@ -122,14 +126,14 @@ private String prepareServiceParamFieldHtml(Delegator 
delegator, ModelParam mode
 return writer.toString()
 }
 
-private prepareEntityFieldBuilder(ModelFormFieldBuilder builder, ModelField 
modelField, ModelEntity modelEntity) {
+private void prepareEntityFieldBuilder(ModelFormFieldBuilder builder, 
ModelField modelField, ModelEntity modelEntity) {
 builder.setName(modelField.getName())
 builder.setFieldName(modelFie

(ofbiz-framework) branch trunk updated: Improved: display Run Service forms with dynamic fields (OFBIZ-12869) (#675)

2024-03-15 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 7b24e2baa5 Improved: display Run Service forms with dynamic fields 
(OFBIZ-12869) (#675)
7b24e2baa5 is described below

commit 7b24e2baa5010e588d40c5f537788441451df31b
Author: MLeila 
AuthorDate: Fri Mar 15 08:28:24 2024 +0100

Improved: display Run Service forms with dynamic fields (OFBIZ-12869) (#675)

With this PR the run service forms will display service parameters
fields dynamically (for example a field for a Timestamp parameter will
be displayed as a datetime picker)
---
 .../webtools/service/SetServiceParameters.groovy   | 137 +
 .../template/service/SetServiceParameter.ftl   |   2 +-
 .../template/service/SetServiceParameterSync.ftl   |   2 +-
 framework/webtools/widget/ServiceScreens.xml   |   4 +-
 4 files changed, 141 insertions(+), 4 deletions(-)

diff --git 
a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
 
b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
new file mode 100644
index 00..7f5e44634b
--- /dev/null
+++ 
b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/service/SetServiceParameters.groovy
@@ -0,0 +1,137 @@
+/*
+ * 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.webtools.service
+
+import org.apache.ofbiz.base.util.Debug
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.base.util.UtilXml
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericEntityException
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelField
+import org.apache.ofbiz.service.ModelParam
+import org.apache.ofbiz.service.ModelService
+import org.apache.ofbiz.service.config.ServiceConfigUtil
+import org.apache.ofbiz.widget.model.FormFactory
+import org.apache.ofbiz.widget.model.ModelForm
+import org.apache.ofbiz.widget.model.ModelFormFieldBuilder
+import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
+import org.w3c.dom.Document
+
+
+savedSyncResult = null
+if (session.getAttribute('_SAVED_SYNC_RESULT_') != null) {
+savedSyncResult = session.getAttribute('_SAVED_SYNC_RESULT_')
+}
+
+serviceName = parameters.SERVICE_NAME
+context.POOL_NAME = 
ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool()
+
+scheduleOptions = []
+serviceParameters = []
+e = request.getParameterNames()
+while (e.hasMoreElements()) {
+paramName = e.nextElement()
+paramValue = parameters[paramName]
+scheduleOptions.add([name: paramName, value: paramValue])
+}
+
+context.scheduleOptions = scheduleOptions
+
+if (serviceName) {
+dctx = dispatcher.getDispatchContext()
+ModelService modelService = null
+try {
+modelService = dctx.getModelService(serviceName)
+} catch (Exception exc) {
+context.errorMessageList = [exc.getMessage()]
+}
+
+context.uiLabelMap = UtilProperties.getResourceBundleMap('CommonUiLabels', 
locale)
+String formRendererLocationTheme = 
context.visualTheme.getModelTheme().getFormRendererLocation('screen')
+MacroFormRenderer renderer = new 
MacroFormRenderer(formRendererLocationTheme, request, response)
+String dynamicServiceForm = """"""
+Document dynamicServiceFormXml = 
UtilXml.readXmlDocument(dynamicServiceForm, true, true)
+Map modelFormMap = 
FormFactory.readFormDocument(dynamicServiceFormXml, null, context.visualTheme, 
dispatcher.getDispatchContext(), null)
+ModelForm form
+if (modelFormMap) {
+Map.Entry entry = 
modelFormMap.entrySet().iterator().next()
+form = entry.getValue()
+}
+
+if (modelService != null) {
+modelService.getInParamNames().each { paramName ->
+ModelParam modelParam = modelService.getParam(paramName)
+if (modelParam.internal) {
+return
+}
+serviceParam = null

(ofbiz-framework) branch release22.01 updated: Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)

2024-02-16 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
 new 768d0780af Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)
768d0780af is described below

commit 768d0780afb2e8a70acb9017a7ded9d4e72dfa30
Author: MLeila 
AuthorDate: Fri Feb 16 10:52:09 2024 +0100

Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)

Fix a jGrowlLabelObject undefined error when calling showjGrowlMessage
---
 themes/common-theme/webapp/common/js/util/OfbizUtil.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/themes/common-theme/webapp/common/js/util/OfbizUtil.js 
b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
index ba84c70a70..7ce594d2e8 100644
--- a/themes/common-theme/webapp/common/js/util/OfbizUtil.js
+++ b/themes/common-theme/webapp/common/js/util/OfbizUtil.js
@@ -1283,7 +1283,7 @@ function showjGrowlMessage(errMessage, classEvent, 
stickyValue, showAllLabel, co
 if (!showAllLabel || !collapseLabel || !hideAllLabel) {
 var jGrowlLabelObject = ["CommonHideAllNotifications", 
"CommonShowAll", "CommonCollapse"];
 getJSONuiLabels(jGrowlLabelObject, function (result) {
-jGrowlLabelObject = result.responseJSON.CommonUiLabels;
+jGrowlLabelObject = result.responseJSON;
 });
 
 if (!showAllLabel) showAllLabel = jGrowlLabelObject[2];



(ofbiz-framework) branch trunk updated: Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)

2024-02-16 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8813c75986 Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)
8813c75986 is described below

commit 8813c759866b2201bc87b8f20ad655f1bb036d00
Author: MLeila 
AuthorDate: Fri Feb 16 10:30:19 2024 +0100

Fixed: Jgrowl label are not well retrieved (OFBIZ-12875)

Fix a jGrowlLabelObject undefined error when calling showjGrowlMessage
---
 themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js 
b/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
index 765eb7f5cb..e4fb3dab21 100644
--- a/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
+++ b/themes/common-theme/webapp/common-theme/js/util/OfbizUtil.js
@@ -1299,7 +1299,7 @@ function showjGrowlMessage(errMessage, classEvent, 
stickyValue, showAllLabel, co
 if (!showAllLabel || !collapseLabel || !hideAllLabel) {
 var jGrowlLabelObject = ["CommonHideAllNotifications", 
"CommonShowAll", "CommonCollapse"];
 getJSONuiLabels(jGrowlLabelObject, function (result) {
-jGrowlLabelObject = result.responseJSON.CommonUiLabels;
+jGrowlLabelObject = result.responseJSON;
 });
 
 if (!showAllLabel) showAllLabel = jGrowlLabelObject[2];



(ofbiz-framework) branch trunk updated: Improved: Adds support for textarea placeholder attribute, using a FlexibleStringExpander (OFBIZ-12859)

2023-11-24 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 9935270fcc Improved: Adds support for textarea placeholder attribute, 
using a FlexibleStringExpander (OFBIZ-12859)
9935270fcc is described below

commit 9935270fcc1c883d4869e79e382df848737b8764
Author: Florian Motteau 
AuthorDate: Wed Oct 11 10:48:13 2023 +0200

Improved: Adds support for textarea placeholder attribute, using a 
FlexibleStringExpander (OFBIZ-12859)

With this PR we can add a "placeholder" attribute on "textarea" field 
widget. This attribute can be dynamic (FlexibleStringExpander). Its content is 
added in a "placeholder" attribute on the HTML textarea 
(https://developer.mozilla.org/fr/docs/Web/HTML/Element/textarea#placeholder).

Thanks: Florian Motteau
---
 framework/widget/dtd/widget-form.xsd |  7 +++
 .../apache/ofbiz/widget/model/ModelFormField.java| 20 
 .../ofbiz/widget/model/XmlWidgetFieldVisitor.java|  1 +
 .../macro/RenderableFtlFormElementsBuilder.java  |  2 ++
 .../template/macro/CsvFormMacroLibrary.ftl   |  2 +-
 .../template/macro/FoFormMacroLibrary.ftl|  2 +-
 .../template/macro/HtmlFormMacroLibrary.ftl  |  3 ++-
 .../template/macro/TextFormMacroLibrary.ftl  |  2 +-
 .../template/macro/XlsFormMacroLibrary.ftl   |  2 +-
 .../template/macro/XmlFormMacroLibrary.ftl   |  2 +-
 10 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/framework/widget/dtd/widget-form.xsd 
b/framework/widget/dtd/widget-form.xsd
index f7e3fa3997..188aeed46a 100644
--- a/framework/widget/dtd/widget-form.xsd
+++ b/framework/widget/dtd/widget-form.xsd
@@ -1512,6 +1512,13 @@ under the License.
 table clean html spellcheck |(separator) Default is 
that all buttons are shown
 
 
+
+
+
+Content of the HTML placeholder attribute 
(https://developer.mozilla.org/fr/docs/Web/HTML/Element/textarea#placeholder), 
text to be displayed to the user when textarea is empty. Similar to text input 
placeholder.
+
+
+
 
 
 
diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
index aef60ce782..2b1ced540a 100644
--- 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
+++ 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java
@@ -5074,6 +5074,7 @@ public final class ModelFormField {
 private final FlexibleStringExpander visualEditorButtons;
 private final boolean visualEditorEnable;
 private final Integer maxlength;
+private final FlexibleStringExpander placeholder;
 
 public TextareaField(Element element, ModelFormField modelFormField) {
 super(element, modelFormField);
@@ -5114,6 +5115,7 @@ public final class ModelFormField {
 this.maxlength = maxlength;
 this.visualEditorButtons = 
FlexibleStringExpander.getInstance(element.getAttribute("visual-editor-buttons"));
 this.visualEditorEnable = 
"true".equals(element.getAttribute("visual-editor-enable"));
+this.placeholder = 
FlexibleStringExpander.getInstance(element.getAttribute("placeholder"));
 }
 
 public TextareaField(int fieldSource, ModelFormField modelFormField) {
@@ -5125,6 +5127,7 @@ public final class ModelFormField {
 this.maxlength = null;
 this.visualEditorButtons = FlexibleStringExpander.getInstance("");
 this.visualEditorEnable = false;
+this.placeholder = FlexibleStringExpander.getInstance("");
 }
 
 public TextareaField(ModelFormField modelFormField) {
@@ -5140,6 +5143,7 @@ public final class ModelFormField {
 this.cols = original.cols;
 this.rows = original.rows;
 this.maxlength = original.maxlength;
+this.placeholder = original.placeholder;
 }
 
 @Override
@@ -5229,6 +5233,22 @@ public final class ModelFormField {
 return readOnly;
 }
 
+/**
+ * Returns the placeholder
+ * @return the placeholder
+ */
+public FlexibleStringExpander getPlaceholder() {
+return this.placeholder;
+}
+
+/**
+ * Returns the placeholder
+ * @return the placeholder
+ */
+public String getPlaceholder(Map context) {
+return this.placeholder.expandString(context);
+  

[ofbiz-framework] branch trunk updated: Improved: Automatic callback element propagation inside a modal tunnel process (OFBIZ-12664)

2023-10-02 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new d462fc88b6 Improved: Automatic callback element propagation inside a 
modal tunnel process (OFBIZ-12664)
d462fc88b6 is described below

commit d462fc88b6088baa25d02b09829df85fe6a176ca
Author: MLeila 
AuthorDate: Mon Oct 2 09:04:06 2023 +0200

Improved: Automatic callback element propagation inside a modal tunnel
process (OFBIZ-12664)
---
 framework/widget/dtd/widget-form.xsd   |  8 +
 .../java/org/apache/ofbiz/widget/WidgetWorker.java | 33 +--
 .../ofbiz/widget/model/CommonWidgetModels.java | 37 --
 .../org/apache/ofbiz/widget/model/ModelForm.java   |  8 ++---
 .../apache/ofbiz/widget/model/ModelFormField.java  | 12 +++
 .../apache/ofbiz/widget/renderer/FormRenderer.java | 30 +++---
 .../widget/renderer/macro/MacroFormRenderer.java   |  8 +++--
 .../template/macro/HtmlFormMacroLibrary.ftl| 13 
 .../webapp/common-theme/js/util/OfbizUtil.js   |  6 ++--
 9 files changed, 108 insertions(+), 47 deletions(-)

diff --git a/framework/widget/dtd/widget-form.xsd 
b/framework/widget/dtd/widget-form.xsd
index bb5c1d54c5..f7e3fa3997 100644
--- a/framework/widget/dtd/widget-form.xsd
+++ b/framework/widget/dtd/widget-form.xsd
@@ -1448,6 +1448,14 @@ under the License.
 The message displayed in confirmation 
box
 
 
+
+
+If you are on an edition process with 
different steps and you want to wait the end of the complete action before 
using the callback,
+use propagate-callback="true". The submit will 
understand that you want to continue your process and will not close the modal 
to refresh the screen.
+The callback action will be kept within the different 
steps
+
+
+
 
 
 
diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java 
b/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java
index 71bd8278e5..d13529a272 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java
@@ -35,6 +35,7 @@ import org.apache.ofbiz.service.LocalDispatcher;
 import org.apache.ofbiz.webapp.control.ConfigXMLReader;
 import org.apache.ofbiz.webapp.control.RequestHandler;
 import org.apache.ofbiz.webapp.taglib.ContentUrlTag;
+import org.apache.ofbiz.widget.model.CommonWidgetModels;
 import org.apache.ofbiz.widget.model.ModelForm;
 import org.apache.ofbiz.widget.model.ModelFormField;
 import org.apache.ofbiz.widget.renderer.ScreenRenderer;
@@ -100,17 +101,18 @@ public final class WidgetWorker {
 throw new RuntimeException(msg, e);
 }
 
-final String tokenValue = CsrfUtil.generateTokenForNonAjax(request, 
target);
-if (isNotEmpty(tokenValue)) {
-additionalParameters.put(CsrfUtil.getTokenNameNonAjax(), 
tokenValue);
-}
-
-if (UtilValidate.isNotEmpty(parameterMap)) {
-parameterMap.forEach(uriBuilder::addParameter);
-}
+if (!"plain".equals(targetType)) {
+final String tokenValue = 
CsrfUtil.generateTokenForNonAjax(request, target);
+if (isNotEmpty(tokenValue)) {
+additionalParameters.put(CsrfUtil.getTokenNameNonAjax(), 
tokenValue);
+}
 
-additionalParameters.forEach(uriBuilder::addParameter);
+if (UtilValidate.isNotEmpty(parameterMap)) {
+parameterMap.forEach(uriBuilder::addParameter);
+}
 
+additionalParameters.forEach(uriBuilder::addParameter);
+}
 try {
 return uriBuilder.build();
 } catch (URISyntaxException e) {
@@ -285,6 +287,19 @@ public final class WidgetWorker {
 return (ScreenRenderer.ScreenStack) context.get("screenStack");
 }
 
+/**
+ * Returns the jwt callback id if present on the context.
+ * @param context
+ * @return
+ */
+public static String getJwtCallback(Map context) {
+String jwtCallback = (String) 
context.get(CommonWidgetModels.JWT_CALLBACK);
+if (UtilValidate.isEmpty(jwtCallback) && 
context.containsKey("parameters")) {
+jwtCallback = (String) ((Map) 
context.get("parameters")).get(CommonWidgetModels.JWT_CALLBACK);
+}
+return jwtCallback;
+}
+
 public static int getPaginatorNumber(Map context) {
 int paginatorNumber = 0;
 if (context != null) {
diff --git 
a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/Comm

[ofbiz-framework] branch trunk updated: Fixed: Form html validation not working correctly inside a modal (OFBIZ-12825)

2023-05-25 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new af1a19596d Fixed: Form html validation not working correctly inside a 
modal (OFBIZ-12825)
af1a19596d is described below

commit af1a19596d704776d8cec3bd9cc66c3a94e9ab47
Author: MLeila 
AuthorDate: Thu May 25 17:49:15 2023 +0200

Fixed: Form html validation not working correctly inside a modal
(OFBIZ-12825)

Fix form html validation on submit inside a modal to avoid service call
when required fields are empty
---
 .../template/macro/HtmlFormMacroLibrary.ftl| 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl 
b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
index fba47ab0e5..a0d4bde2c5 100644
--- a/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
+++ b/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl
@@ -236,19 +236,27 @@ under the License.
 <#if title?has_content> alt="${title}"<#if event?has_content> 
${event}="${action}"
 <#if confirmation?has_content>onclick="return 
confirm('${confirmation?js_string}');"/>
   <#else>
- <@renderDisabled disabled />
+ <@renderDisabled 
disabled />
   <#if id?has_content> id="${id}"<#rt/>
   <#if name??> name="${name}"
   <#if title?has_content> value="${title}"
   <#if event?has_content> ${event}="${action}"
-  <#if containerId?has_content> onclick="<#if confirmation?has_content>if 
(confirm('${confirmation?js_string}')) 
ajaxSubmitFormUpdateAreas('${formName}', '${ajaxUrl}')"
-<#else><#if confirmation?has_content> onclick="return 
confirm('${confirmation?js_string}');"
-  <#if tabindex?has_content> tabindex="${tabindex}"<#rt/>
+  <#if !containerId?has_content>
+  <#if confirmation?has_content> onclick="return 
confirm('${confirmation?js_string}');"
+  <#if tabindex?has_content> tabindex="${tabindex}"<#rt/>
   />
   <#if containerId?has_content>
 <#-- the form will be submit by ajax, we inform that perss enter need 
to call  -->
 

[ofbiz-framework] branch trunk updated: Fixed: RuntimeData and RecurrenceInfo not cleaned after job purge (OFBIZ-12679)

2022-12-22 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new b80e411bb8 Fixed: RuntimeData and RecurrenceInfo not cleaned after job 
purge (OFBIZ-12679)
b80e411bb8 is described below

commit b80e411bb827134e995bdaeb7857feb07c6beb28
Author: MLeila 
AuthorDate: Thu Dec 22 12:14:17 2022 +0100

Fixed: RuntimeData and RecurrenceInfo not cleaned after job purge
(OFBIZ-12679)

Add jobSandbox related runtimeDataId and recurrenceInfoId fields when
searching for jobs to purge so that the PurgeJob can retrieve and clean
job related entities (JobUtil.removeJob)
Also add a test that validate the complete purge

Thanks: Gaëtan Chaboussie for report and corrective patch
---
 .../ofbiz/service/test/ServicePurgeTest.groovy | 38 
 .../org/apache/ofbiz/service/job/JobManager.java   | 42 +-
 .../org/apache/ofbiz/service/job/JobServices.java  | 25 ++---
 framework/service/testdef/servicetests.xml |  4 +++
 4 files changed, 70 insertions(+), 39 deletions(-)

diff --git 
a/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
new file mode 100644
index 00..1537fe2d4f
--- /dev/null
+++ 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
@@ -0,0 +1,38 @@
+package org.apache.ofbiz.service
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityQuery
+import org.apache.ofbiz.service.config.ServiceConfigUtil
+import org.apache.ofbiz.testtools.GroovyScriptTestCase
+
+class ServicePurgeTest extends GroovyScriptTestCase {
+
+// ./gradlew 'ofbiz -t component=service -t suitename=servicetests -t 
case=service-purge-test' --debug-jvm
+
+void testRuntimeDataIsCleanedAfterServicePurge() {
+GenericValue sysUserLogin = delegator.findOne('UserLogin', true, 
'userLoginId', 'system')
+String jobId = delegator.getNextSeqId('JobSandbox')
+
+def createRuntimeResult = dispatcher.runSync('createRuntimeData', [
+runtimeInfo: 'This is a runtimeInfo',
+userLogin  : sysUserLogin
+])
+String runtimeDataId = createRuntimeResult.runtimeDataId
+
+dispatcher.runSync('createJobSandbox', [
+userLogin : sysUserLogin,
+poolId: 
ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool(),
+jobId : jobId,
+runtimeDataId : runtimeDataId,
+statusId  : 'SERVICE_FINISHED',
+serviceName   : 'sendMail',
+finishDateTime: 
UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -10)
+])
+
+dispatcher.runSync('purgeOldJobs', [userLogin: sysUserLogin])
+
+assert EntityQuery.use(delegator).from('JobSandbox').where('jobId', 
jobId).queryCount() == 0
+assert 
EntityQuery.use(delegator).from('RuntimeData').where('runtimeDataId', 
runtimeDataId).queryCount() == 0
+}
+}
diff --git 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
index 3016474812..ce82e0bcfd 100644
--- 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
+++ 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
@@ -253,16 +253,6 @@ public final class JobManager {
 Debug.logWarning(e, "Unable to get purge job days: ", MODULE);
 return Collections.emptyList();
 }
-List purgeCondition = UtilMisc.toList(
-EntityCondition.makeCondition("runByInstanceId", 
INSTANCE_ID),
-EntityCondition.makeCondition(UtilMisc.toList(
-EntityCondition.makeCondition(UtilMisc.toList(
-
EntityCondition.makeCondition("finishDateTime", EntityOperator.NOT_EQUAL, null),
-
EntityCondition.makeCondition("finishDateTime", EntityOperator.LESS_THAN, 
purgeTime))),
-EntityCondition.makeCondition(UtilMisc.toList(
-
EntityCondition.makeCondition("cancelDateTime", EntityOperator.NOT_EQUAL, null),
-
EntityCondition.makeCondition("cancelDateTime", EntityOperator.LESS_THAN, 
purgeTime,
-EntityOperator.OR));
 beganTransaction = false;
 try {
 beganTransaction = Tran

[ofbiz-framework] branch release22.01 updated: Fixed: RuntimeData and RecurrenceInfo not cleaned after job purge (OFBIZ-12679)

2022-12-22 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
 new d9d73419fa Fixed: RuntimeData and RecurrenceInfo not cleaned after job 
purge (OFBIZ-12679)
d9d73419fa is described below

commit d9d73419fae4c0b0a0ec43de3ce24e48a6342249
Author: MLeila 
AuthorDate: Thu Dec 22 11:28:37 2022 +0100

Fixed: RuntimeData and RecurrenceInfo not cleaned after job purge
(OFBIZ-12679)

Add jobSandbox related runtimeDataId and recurrenceInfoId fields when
searching for jobs to purge so that the PurgeJob can retrieve and clean
job related entities (JobUtil.removeJob)
Also add a test that validate the complete purge

Thanks: Gaëtan Chaboussie for report and corrective patch
---
 .../ofbiz/service/test/ServicePurgeTest.groovy | 36 +++
 .../org/apache/ofbiz/service/job/JobManager.java   | 42 +-
 .../org/apache/ofbiz/service/job/JobServices.java  | 25 ++---
 framework/service/testdef/servicetests.xml |  4 +++
 4 files changed, 68 insertions(+), 39 deletions(-)

diff --git 
a/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
new file mode 100644
index 00..96bfb8e131
--- /dev/null
+++ 
b/framework/service/src/main/groovy/org/apache/ofbiz/service/test/ServicePurgeTest.groovy
@@ -0,0 +1,36 @@
+package org.apache.ofbiz.service
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.util.EntityQuery
+import org.apache.ofbiz.service.config.ServiceConfigUtil
+import org.apache.ofbiz.testtools.GroovyScriptTestCase
+
+class ServicePurgeTest extends GroovyScriptTestCase {
+
+void testRuntimeDataIsCleanedAfterServicePurge() {
+GenericValue sysUserLogin = delegator.findOne('UserLogin', true, 
'userLoginId', 'system')
+String jobId = delegator.getNextSeqId('JobSandbox')
+
+def createRuntimeResult = dispatcher.runSync('createRuntimeData', [
+runtimeInfo: 'This is a runtimeInfo',
+userLogin  : sysUserLogin
+])
+String runtimeDataId = createRuntimeResult.runtimeDataId
+
+dispatcher.runSync('createJobSandbox', [
+userLogin : sysUserLogin,
+poolId: 
ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool(),
+jobId : jobId,
+runtimeDataId : runtimeDataId,
+statusId  : 'SERVICE_FINISHED',
+serviceName   : 'sendMail',
+finishDateTime: 
UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -10)
+])
+
+dispatcher.runSync('purgeOldJobs', [userLogin: sysUserLogin])
+
+assert EntityQuery.use(delegator).from('JobSandbox').where('jobId', 
jobId).queryCount() == 0
+assert 
EntityQuery.use(delegator).from('RuntimeData').where('runtimeDataId', 
runtimeDataId).queryCount() == 0
+}
+}
diff --git 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
index 3016474812..ce82e0bcfd 100644
--- 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
+++ 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java
@@ -253,16 +253,6 @@ public final class JobManager {
 Debug.logWarning(e, "Unable to get purge job days: ", MODULE);
 return Collections.emptyList();
 }
-List purgeCondition = UtilMisc.toList(
-EntityCondition.makeCondition("runByInstanceId", 
INSTANCE_ID),
-EntityCondition.makeCondition(UtilMisc.toList(
-EntityCondition.makeCondition(UtilMisc.toList(
-
EntityCondition.makeCondition("finishDateTime", EntityOperator.NOT_EQUAL, null),
-
EntityCondition.makeCondition("finishDateTime", EntityOperator.LESS_THAN, 
purgeTime))),
-EntityCondition.makeCondition(UtilMisc.toList(
-
EntityCondition.makeCondition("cancelDateTime", EntityOperator.NOT_EQUAL, null),
-
EntityCondition.makeCondition("cancelDateTime", EntityOperator.LESS_THAN, 
purgeTime,
-EntityOperator.OR));
 beganTransaction = false;
 try {
 beganTransaction = TransactionUtil.begin();
@@ -270,12 +260,8 @@ public final class JobManager {
 Debug.logW

[ofbiz-framework] branch trunk updated: Fixed: Correction of the updateCustRequestItem service engine definition (OFBIZ-12727)

2022-12-21 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 10a858af70 Fixed: Correction of the updateCustRequestItem service 
engine definition (OFBIZ-12727)
10a858af70 is described below

commit 10a858af701619ca6342319f7d796b64bffd27bb
Author: Leila 
AuthorDate: Wed Dec 21 17:21:43 2022 +0100

Fixed: Correction of the updateCustRequestItem service engine definition
(OFBIZ-12727)
---
 applications/order/servicedef/services_request.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/applications/order/servicedef/services_request.xml 
b/applications/order/servicedef/services_request.xml
index 0f765ffd8f..9982545586 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -91,7 +91,7 @@ under the License.
 
 
 
-
+
 Update a CustRequestItem record
 
 



[ofbiz-framework] branch release22.01 updated: Fixed: Correction of the updateCustRequestItem service engine definition (OFBIZ-12727)

2022-12-21 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
 new f1fcfb8676 Fixed: Correction of the updateCustRequestItem service 
engine definition (OFBIZ-12727)
f1fcfb8676 is described below

commit f1fcfb8676d5da5e315d9577ee09434f9beb3d9d
Author: Leila 
AuthorDate: Wed Dec 21 17:17:40 2022 +0100

Fixed: Correction of the updateCustRequestItem service engine definition
(OFBIZ-12727)
---
 applications/order/servicedef/services_request.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/applications/order/servicedef/services_request.xml 
b/applications/order/servicedef/services_request.xml
index 0f765ffd8f..9982545586 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -91,7 +91,7 @@ under the License.
 
 
 
-
+
 Update a CustRequestItem record
 
 



[ofbiz-framework] branch trunk updated: Fixed: Groovy script error when creating a communication event role (OFBIZ-12702)

2022-10-14 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 608e38c861 Fixed: Groovy script error when creating a communication 
event role (OFBIZ-12702)
608e38c861 is described below

commit 608e38c8618f512f98c14993b294f13e81f5751c
Author: Leila 
AuthorDate: Fri Oct 14 11:51:05 2022 +0200

Fixed: Groovy script error when creating a communication event role
(OFBIZ-12702)
---
 .../party/groovyScripts/communication/CommunicationEventServices.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
 
b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
index b2fb799d27..0e1d03c3d4 100644
--- 
a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
+++ 
b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
@@ -430,7 +430,7 @@ def createCommunicationEventRole() {
 .queryFirst()
 
 if (contactMech) {
-newEntity.contactMechId = contactMechs[0]
+newEntity.contactMechId = contactMech.contactMechId
 }
 }
 }



[ofbiz-framework] branch release22.01 updated: OFBIZ-12702 Fix groovy script error in createCommunicationEventRole

2022-10-14 Thread mleila
This is an automated email from the ASF dual-hosted git repository.

mleila pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
 new d003964906 OFBIZ-12702 Fix groovy script error in 
createCommunicationEventRole
d003964906 is described below

commit d003964906f473016e8db7f10fffa4c7fc5a3836
Author: Leila 
AuthorDate: Fri Oct 14 11:40:32 2022 +0200

OFBIZ-12702 Fix groovy script error in createCommunicationEventRole
---
 .../party/groovyScripts/communication/CommunicationEventServices.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
 
b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
index b2fb799d27..0e1d03c3d4 100644
--- 
a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
+++ 
b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy
@@ -430,7 +430,7 @@ def createCommunicationEventRole() {
 .queryFirst()
 
 if (contactMech) {
-newEntity.contactMechId = contactMechs[0]
+newEntity.contactMechId = contactMech.contactMechId
 }
 }
 }