svn commit: r1835599 - /ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy

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

svn commit: r1835599 - /ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy

pgil
Author: pgil
Date: Tue Jul 10 19:59:20 2018
New Revision: 1835599

URL: http://svn.apache.org/viewvc?rev=1835599&view=rev
Log:
Improved: GetLocaleList call can provide duplicate results
(OFBIZ-10458)

Just improve hasFilter condition to use .with groovy notation.

Thanks Mathieu Lirzin

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy

Modified: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy?rev=1835599&r1=1835598&r2=1835599&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetLocaleList.groovy Tue Jul 10 19:59:20 2018
@@ -25,13 +25,13 @@ boolean contains(String a, String b) {
     b && a.toUpperCase().contains(b.toUpperCase())
 }
 
-hasNoFilters = !parameters.localeString && !parameters.localeName
+hasFilter = parameters.with { localeString || localeName }
 
 context.locales = availableLocales()
     .stream()
     .map { [localeName: it.getDisplayName(it), localeString: it.toString()] }
     .filter {
-        hasNoFilters ||
+        !hasFilter ||
         contains(it.localeString, parameters.localeString) ||
         contains(it.localeName, parameters.localeName)
     }