You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2009/12/19 14:50:39 UTC
svn commit: r892470 - in /ofbiz/trunk:
applications/party/script/org/ofbiz/party/party/
applications/party/servicedef/ framework/common/src/org/ofbiz/common/
framework/common/webcommon/includes/
Author: mrisaliti
Date: Sat Dec 19 13:50:39 2009
New Revision: 892470
URL: http://svn.apache.org/viewvc?rev=892470&view=rev
Log:
Add the possibility to sort the associated states to a country in a different way than by geoId (OFBIZ-3370)
Modified:
ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
ofbiz/trunk/applications/party/servicedef/services_view.xml
ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
ofbiz/trunk/framework/common/webcommon/includes/states.ftl
Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=892470&r1=892469&r2=892470&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Sat Dec 19 13:50:39 2009
@@ -1045,9 +1045,11 @@
<simple-method method-name="getAssociatedStateList" short-description="set the state options for selected country" login-required="false">
<set field="countryGeoId" from-field="parameters.countryGeoId"/>
+ <set field="listOrderBy" from-field="parameters.listOrderBy"/>
<call-class-method method-name="getAssociatedStateList" class-name="org.ofbiz.common.CommonWorkers" ret-field="geoList">
<field field="delegator" type="org.ofbiz.entity.Delegator"/>
<field field="countryGeoId" type="String"/>
+ <field field="listOrderBy" type="String"/>
</call-class-method>
<iterate list="geoList" entry="stateGeo">
<set field="stateName" value="${stateGeo.geoName}: ${stateGeo.geoId}"/>
Modified: ofbiz/trunk/applications/party/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services_view.xml?rev=892470&r1=892469&r2=892470&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services_view.xml Sat Dec 19 13:50:39 2009
@@ -185,6 +185,7 @@
<service name="getAssociatedStateList" engine="simple" auth="false"
location="component://party/script/org/ofbiz/party/party/PartyServices.xml" invoke="getAssociatedStateList">
<attribute name="countryGeoId" mode="IN" type="String" optional="false"/>
+ <attribute name="listOrderBy" mode="IN" type="String" optional="true"/>
<attribute name="stateList" mode="OUT" type="java.util.List"/>
</service>
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=892470&r1=892469&r2=892470&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Sat Dec 19 13:50:39 2009
@@ -100,10 +100,14 @@
return geoList;
}
+ public static List<GenericValue> getAssociatedStateList(Delegator delegator, String country) {
+ return getAssociatedStateList(delegator, country, null);
+ }
+
/**
* Returns a list of regional geo associations.
*/
- public static List<GenericValue> getAssociatedStateList(Delegator delegator, String country) {
+ public static List<GenericValue> getAssociatedStateList(Delegator delegator, String country, String listOrderBy) {
if (UtilValidate.isEmpty(country)) {
// Load the system default country
country = UtilProperties.getPropertyValue("general.properties", "country.geo.id.default");
@@ -115,7 +119,11 @@
EntityCondition.makeCondition("geoTypeId", "STATE"),
EntityCondition.makeCondition("geoTypeId", "PROVINCE"),
EntityCondition.makeCondition("geoTypeId", "COUNTY")));
- List<String> sortList = UtilMisc.toList("geoId");
+
+ if (UtilValidate.isEmpty(listOrderBy)) {
+ listOrderBy = "geoId";
+ }
+ List<String> sortList = UtilMisc.toList(listOrderBy);
List<GenericValue> geoList = FastList.newInstance();
try {
Modified: ofbiz/trunk/framework/common/webcommon/includes/states.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/states.ftl?rev=892470&r1=892469&r2=892470&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/states.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/states.ftl Sat Dec 19 13:50:39 2009
@@ -25,7 +25,7 @@
<#if requestParameters.CUSTOMER_COUNTRY?exists>
<#assign stateAssocs = Static["org.ofbiz.common.CommonWorkers"].getAssociatedStateList(delegator,requestParameters.CUSTOMER_COUNTRY)>
<#else>
- <#assign stateAssocs = Static["org.ofbiz.common.CommonWorkers"].getAssociatedStateList(delegator,defaultCountryId)>
+ <#assign stateAssocs = Static["org.ofbiz.common.CommonWorkers"].getAssociatedStateList(delegator,null)>
</#if>
<#list stateAssocs as stateAssoc>