A couple of minor points:
1. It isn't necessary to use UtilValidate.isEmpty() in groovy for String
values, you can simply use: if (parameters.custRequestTypeId).  Google
"Groovy Truth" for more info
2. I notice there are actually 4 instances of <option
key="${uiLabelMap.CommonAny}" description=" "/> in the file, but only two
have been fixed.

Regards
Scott

On 26 July 2016 at 09:38, <jler...@apache.org> wrote:

> Author: jleroux
> Date: Mon Jul 25 21:38:11 2016
> New Revision: 1754051
>
> URL: http://svn.apache.org/viewvc?rev=1754051&view=rev
> Log:
> A 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
>
> The Find form for Product Backlog Item does not work in language other
> than English when no "statusId" or "custRequestTypeId" are selected.
>
> Step to reproduce :
> - Go to the Scrum component and select a product
> - Go to the "Total Backlog" tab
> or use this link :
> https://localhost:8443/scrum/control/ViewTotalBacklog?productId=DEMO-PRODUCT-1
>
> - Hit the search button, the find action is performed and return a
> non-empty list.
> - Set your language preference to a non english language (french for
> example).
> - Click again on the "Total Backlog" tab, and hit the  "Rechercher" button.
> - No results are found.
>
> Where does the problem come from ?
> The results displayed are from a list named "backlogList" which is built
> in the following script : FindProductBacklogItem.groovy .
> In this script, there were a check on the parameter "custRequestTypeId"
> and on the parameter "statusId".
> But the value was hardcoded :
>
> if("Any".equals(parameters.custRequestTypeId))
> and
> if(!"Any".equals(parameters.statusId))
>
> Obviously, when the form is in another language than English, those
> conditions aren't valid anymore (for example, "Any" is "Don't" in French")
>
> 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=1754051&r1=1754050&r2=1754051&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
> (original)
> +++
> ofbiz/trunk/specialpurpose/scrum/groovyScripts/FindProductBacklogItem.groovy
> Mon Jul 25 21:38:11 2016
> @@ -32,7 +32,6 @@ conditionBacklogList = [];
>  orConditionBacklogList = [];
>  mainConditionBacklogList = [];
>  orConditionsBacklog =  null;
> -parameters.custRequestTypeId = parameters.custRequestTypeId ?: "Any";
>  description = parameters.description;
>  custRequestId = parameters.custRequestId;
>  orderBy = "custRequestDate";
> @@ -42,7 +41,7 @@ if ((parameters.billed != null)||(parame
>      if(UtilValidate.isNotEmpty(parameters.productId)){
>
>  conditionBacklogList.add(EntityCondition.makeCondition("productId",
> EntityOperator.EQUALS, parameters.productId));
>      }
> -    if("Any".equals(parameters.custRequestTypeId)){
> +    if(UtilValidate.isEmpty(parameters.custRequestTypeId)){
>
>  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);
> @@ -58,7 +57,7 @@ if ((parameters.billed != null)||(parame
>         conditionBacklogList.add(EntityCondition.makeCondition("billed",
> EntityOperator.EQUALS, parameters.billed));
>      }
>
> -    if(!"Any".equals(parameters.statusId)){
> +    if(UtilValidate.isNotEmpty(parameters.statusId)){
>          orderBy = "custSequenceNum";
>
>  conditionBacklogList.add(EntityCondition.makeCondition("statusId",
> EntityOperator.EQUALS, parameters.statusId));
>      }
>
> Modified: ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml?rev=1754051&r1=1754050&r2=1754051&view=diff
>
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml (original)
> +++ ofbiz/trunk/specialpurpose/scrum/widget/scrumForms.xml Mon Jul 25
> 21:38:11 2016
> @@ -812,15 +812,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"/>
>
>
>

Reply via email to