svn commit: r1754656 - in /ofbiz/trunk/specialpurpose/scrum: groovyScripts/FindProductBacklogItem.groovy widget/scrumForms.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1754656 - in /ofbiz/trunk/specialpurpose/scrum: groovyScripts/FindProductBacklogItem.groovy widget/scrumForms.xml

jleroux@apache.org
Author: jleroux
Date: Sun Jul 31 12:13:03 2016
New Revision: 1754656

URL: http://svn.apache.org/viewvc?rev=1754656&view=rev
Log:
An improving patch from Florian Montalbano for "Scrum find Total Backlog Item is not working in non-English language" https://issues.apache.org/jira/browse/OFBIZ-7929

I put it all in this new version of the patch :
    Changed UtilValidate test to Groovy Truth test on string
    Changed the big first test by a test on "noConditionFind"
    Added some comments
    Harmonization of the "if tests"
    Removed the uiLabelMap.CommonAny in the file (the two others belonged to another form --> "FindTotalBacklog")
    Added a "noConditionFind" field to this form --> "FindTotalBacklog"

jleroux: I removed all remaining tabs in FindProductBacklogItem.groovy

Modified:
    ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
    ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml

Modified: ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy?rev=1754656&r1=1754655&r2=1754656&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy (original)
+++ ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy Sun Jul 31 12:13:03 2016
@@ -32,58 +32,60 @@ conditionBacklogList = [];
 orConditionBacklogList = [];
 mainConditionBacklogList = [];
 orConditionsBacklog =  null;
-description = parameters.description;
-custRequestId = parameters.custRequestId;
 orderBy = "custRequestDate";
 
-if ((parameters.billed != null)||(parameters.parentCustRequestId != null)||(parameters.description != null)
-    ||(parameters.fromPartyId != null)||(parameters.custRequestDate != null)||(parameters.custRequestId != null)||(viewIndex > 0)) {
-    if(UtilValidate.isNotEmpty(parameters.productId)){
+// Prevents the query on all records when loading the screen for the first time
+if ("Y".equals(parameters.noConditionFind)) {
+    if(parameters.productId){
         conditionBacklogList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId));
     }
-    if(UtilValidate.isEmpty(parameters.custRequestTypeId)){
+    
+    if(parameters.custRequestTypeId){
+        conditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, parameters.custRequestTypeId));
+    }else{
+        // Adding both possibilities to the condition
         orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_UNPLAN_BACKLOG"));
         orConditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, "RF_PROD_BACKLOG"));
         orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR);
-    }else{
-        conditionBacklogList.add(EntityCondition.makeCondition("custRequestTypeId", EntityOperator.EQUALS, parameters.custRequestTypeId));
     }
     
-    if(UtilValidate.isEmpty(parameters.billed)){
-     orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "Y"));
-     orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "N"));
-     orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR);
+    if(parameters.billed){
+        conditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, parameters.billed));
     }else{
-     conditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, parameters.billed));
+        // Adding both choices to the condition
+        orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "Y"));
+        orConditionBacklogList.add(EntityCondition.makeCondition("billed", EntityOperator.EQUALS, "N"));
+        orConditionsBacklog = EntityCondition.makeCondition(orConditionBacklogList, EntityOperator.OR);
     }
     
-    if(UtilValidate.isNotEmpty(parameters.statusId)){
+    if(parameters.statusId){
         orderBy = "custSequenceNum";
         conditionBacklogList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameters.statusId));
     }
     
-    if(UtilValidate.isNotEmpty(parameters.parentCustRequestId)){
-     conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId));
+    if(parameters.parentCustRequestId){
+        conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId));
     }
-    if(UtilValidate.isNotEmpty(parameters.description)){
-     conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + description + "%"));
+    
+    if(parameters.description){
+        conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + parameters.description + "%"));
     }
     
-    if(UtilValidate.isNotEmpty(parameters.fromPartyId)){
-     conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%"));
+    if(parameters.fromPartyId){
+        conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%"));
     }
     
-    if (UtilValidate.isNotEmpty(parameters.custRequestDate)){
-     fromDate = parameters.custRequestDate;
-     fromDate = fromDate + " " + "00:00:00.000";
-     conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
-     thruDate = parameters.custRequestDate;
-     thruDate = thruDate + " " + "23:59:59.999";
-     conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
+    if (parameters.custRequestDate){
+        fromDate = parameters.custRequestDate;
+        fromDate = fromDate + " " + "00:00:00.000";
+        conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.GREATER_THAN_EQUAL_TO, Timestamp.valueOf(fromDate)));
+        thruDate = parameters.custRequestDate;
+        thruDate = thruDate + " " + "23:59:59.999";
+        conditionBacklogList.add(EntityCondition.makeCondition("custRequestDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
     }
     
-    if(UtilValidate.isNotEmpty(parameters.custRequestId)){
-     conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, custRequestId + "%"));
+    if(parameters.custRequestId){
+        conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%"));
     }
     
     conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND);
@@ -94,11 +96,13 @@ if ((parameters.billed != null)||(parame
     
     mainConditionBacklogList.add(conditionsBacklog);
     
+    // Request
     backlogList = select("custRequestId","custRequestTypeId", "custSequenceNum", "statusId", "description", "custEstimatedMilliSeconds", "custRequestName", "parentCustRequestId","productId","billed","custRequestDate","fromPartyId")
                     .from("CustRequestAndCustRequestItem")
                     .where(mainConditionBacklogList)
                     .orderBy("-custRequestTypeId", orderBy)
                     .queryList();
+                    
     def countSequenceBacklog = 1;
     def backlogItems = [];
     backlogList.each() { backlogItem ->
@@ -126,7 +130,7 @@ if ((parameters.billed != null)||(parame
         countSequenceBacklog ++;
     }
     
-    //re-order category list item
+    // re-order category list item
     if ("N".equals(parameters.sequence)) {
         backlogItems = UtilMisc.sortMaps(backlogItems, ["parentCustRequestId"]);
     }

Modified: ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml?rev=1754656&r1=1754655&r2=1754656&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml (original)
+++ ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml Sun Jul 31 12:13:03 2016
@@ -788,7 +788,6 @@ under the License.
         <field name="custRequestId" title="${uiLabelMap.ScrumProductBacklogId}"><text-find/></field>
         <field name="fromPartyId" title="${uiLabelMap.ScrumRequesterName}" position="2">
             <drop-down allow-empty="true">
-                <option key=""/>
                 <list-options key-name="partyId" list-name="requesterList" description="${lastName} ${firstName} ${middleName}"/>
             </drop-down>
         </field>
@@ -863,8 +862,7 @@ under the License.
             <date-time type="date"/>
         </field>
         <field name="custRequestTypeId" title="${uiLabelMap.ScrumPlanned}">
-            <drop-down allow-empty="false">
-                <option key="${uiLabelMap.CommonAny}" description=" "/>
+            <drop-down allow-empty="true">
                 <option key="RF_PROD_BACKLOG" description="${uiLabelMap.CommonY}"/>
                 <option key="RF_UNPLAN_BACKLOG" description="${uiLabelMap.CommonN}"/>
             </drop-down>
@@ -876,8 +874,7 @@ under the License.
             </drop-down>
         </field>
         <field name="statusId" title="${uiLabelMap.CommonStatus}">
-            <drop-down allow-empty="false">
-                <option key="${uiLabelMap.CommonAny}" description=" "/>
+            <drop-down allow-empty="true">
                 <entity-options entity-name="StatusItem" key-field-name="statusId">
                     <entity-constraint name="statusTypeId" value="CUSTREQ_STTS"/>
                     <entity-constraint name="statusId" operator="not-equals" value="CRQ_PENDING"/>
@@ -888,6 +885,7 @@ under the License.
                 </entity-options>
             </drop-down>
         </field>
+        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
         <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>