Author: jleroux
Date: Mon Aug 1 08:22:36 2016 New Revision: 1754709 URL: http://svn.apache.org/viewvc?rev=1754709&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" Modified: ofbiz/branches/release14.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy ofbiz/branches/release14.12/specialpurpose/scrum/widget/scrumForms.xml ofbiz/branches/release15.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy ofbiz/branches/release15.12/specialpurpose/scrum/widget/scrumForms.xml Modified: ofbiz/branches/release14.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy?rev=1754709&r1=1754708&r2=1754709&view=diff ============================================================================== --- ofbiz/branches/release14.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy (original) +++ ofbiz/branches/release14.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy Mon Aug 1 08:22:36 2016 @@ -32,74 +32,77 @@ conditionBacklogList = []; orConditionBacklogList = []; mainConditionBacklogList = []; orConditionsBacklog = null; -parameters.custRequestTypeId = parameters.custRequestTypeId ?: "Any"; -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("Any".equals(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(!"Any".equals(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(UtilValidate.isNotEmpty(parameters.description)){ - conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + description + "%")); - } - - if(UtilValidate.isNotEmpty(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(UtilValidate.isNotEmpty(parameters.custRequestId)){ - conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, custRequestId + "%")); + + if(parameters.parentCustRequestId){ + conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId)); + } + + if(parameters.description){ + conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + parameters.description + "%")); } - + + if(parameters.fromPartyId){ + conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%")); + } + + 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(parameters.custRequestId){ + conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%")); + } + conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND); - + if(UtilValidate.isNotEmpty(orConditionsBacklog)){ mainConditionBacklogList.add(orConditionsBacklog); } - + 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(); + .from("CustRequestAndCustRequestItem") + .where(mainConditionBacklogList) + .orderBy("-custRequestTypeId", orderBy) + .queryList(); + def countSequenceBacklog = 1; def backlogItems = []; backlogList.each() { backlogItem -> @@ -126,8 +129,8 @@ if ((parameters.billed != null)||(parame backlogItems.add(tempBacklog); countSequenceBacklog ++; } - - //re-order category list item + + // re-order category list item if ("N".equals(parameters.sequence)) { backlogItems = UtilMisc.sortMaps(backlogItems, ["parentCustRequestId"]); } Modified: ofbiz/branches/release14.12/specialpurpose/scrum/widget/scrumForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/scrum/widget/scrumForms.xml?rev=1754709&r1=1754708&r2=1754709&view=diff ============================================================================== --- ofbiz/branches/release14.12/specialpurpose/scrum/widget/scrumForms.xml (original) +++ ofbiz/branches/release14.12/specialpurpose/scrum/widget/scrumForms.xml Mon Aug 1 08:22:36 2016 @@ -811,7 +811,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> @@ -835,15 +834,13 @@ under the License. </drop-down> </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> </field> <field name="statusId" title="${uiLabelMap.CommonStatus}" position="2"> - <drop-down allow-empty="false"> - <option key="${uiLabelMap.CommonAny}" description=" "/> + <drop-down allow-empty="true"> <entity-options entity-name="StatusItem" description="${description}" key-field-name="statusId"> <entity-constraint name="statusTypeId" value="CUSTREQ_STTS"/> <entity-constraint name="statusId" operator="not-equals" value="CRQ_PENDING"/> @@ -888,8 +885,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> @@ -901,8 +897,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" description="${description}" key-field-name="statusId"> <entity-constraint name="statusTypeId" value="CUSTREQ_STTS"/> <entity-constraint name="statusId" operator="not-equals" value="CRQ_PENDING"/> @@ -913,6 +908,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> Modified: ofbiz/branches/release15.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy?rev=1754709&r1=1754708&r2=1754709&view=diff ============================================================================== --- ofbiz/branches/release15.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy (original) +++ ofbiz/branches/release15.12/specialpurpose/scrum/webapp/scrum/WEB-INF/actions/FindProductBacklogItem.groovy Mon Aug 1 08:22:36 2016 @@ -32,74 +32,77 @@ conditionBacklogList = []; orConditionBacklogList = []; mainConditionBacklogList = []; orConditionsBacklog = null; -parameters.custRequestTypeId = parameters.custRequestTypeId ?: "Any"; -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("Any".equals(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(!"Any".equals(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(UtilValidate.isNotEmpty(parameters.description)){ - conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + description + "%")); - } - - if(UtilValidate.isNotEmpty(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(UtilValidate.isNotEmpty(parameters.custRequestId)){ - conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, custRequestId + "%")); + + if(parameters.parentCustRequestId){ + conditionBacklogList.add(EntityCondition.makeCondition("parentCustRequestId", EntityOperator.EQUALS, parameters.parentCustRequestId)); + } + + if(parameters.description){ + conditionBacklogList.add(EntityCondition.makeCondition("description", EntityOperator.LIKE, "%" + parameters.description + "%")); } - + + if(parameters.fromPartyId){ + conditionBacklogList.add(EntityCondition.makeCondition("fromPartyId", EntityOperator.LIKE, "%" + parameters.fromPartyId + "%")); + } + + 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(parameters.custRequestId){ + conditionBacklogList.add(EntityCondition.makeCondition("custRequestId", EntityOperator.LIKE, parameters.custRequestId + "%")); + } + conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND); - + if(UtilValidate.isNotEmpty(orConditionsBacklog)){ mainConditionBacklogList.add(orConditionsBacklog); } - + 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(); + .from("CustRequestAndCustRequestItem") + .where(mainConditionBacklogList) + .orderBy("-custRequestTypeId", orderBy) + .queryList(); + def countSequenceBacklog = 1; def backlogItems = []; backlogList.each() { backlogItem -> @@ -126,8 +129,8 @@ if ((parameters.billed != null)||(parame backlogItems.add(tempBacklog); countSequenceBacklog ++; } - - //re-order category list item + + // re-order category list item if ("N".equals(parameters.sequence)) { backlogItems = UtilMisc.sortMaps(backlogItems, ["parentCustRequestId"]); } Modified: ofbiz/branches/release15.12/specialpurpose/scrum/widget/scrumForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/specialpurpose/scrum/widget/scrumForms.xml?rev=1754709&r1=1754708&r2=1754709&view=diff ============================================================================== --- ofbiz/branches/release15.12/specialpurpose/scrum/widget/scrumForms.xml (original) +++ ofbiz/branches/release15.12/specialpurpose/scrum/widget/scrumForms.xml Mon Aug 1 08:22:36 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> @@ -812,15 +811,13 @@ under the License. </drop-down> </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> </field> <field name="statusId" title="${uiLabelMap.CommonStatus}" position="2"> - <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"/> @@ -865,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> @@ -878,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"/> @@ -890,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> |
Free forum by Nabble | Edit this page |