Author: jleroux
Date: Mon Sep 12 16:47:53 2016 New Revision: 1760406 URL: http://svn.apache.org/viewvc?rev=1760406&view=rev Log: Fixes: Display of State/Province for non US entities in the customer's profile of ecommerce (OFBIZ-8231) When I access url https://localhost:8443/ecommerce/control/viewprofile for my profile, State/Province display in addresses shows the geo-id, which is fine for US entities where the GeoID is the state code, but for non-us entities, the GeoID is often something like CountryCode-StateCode, which isn't very nice. Thanks: fumiyoshi.to for report and patch jleroux: I have slightly changed the patch for 2 reasons: * check for null exceptions * use not deprecated version of getRelatedOne() Modified: ofbiz/trunk/framework/common/data/GeoData_JP.xml ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy ofbiz/trunk/specialpurpose/ecommerce/template/customer/ViewProfile.ftl Modified: ofbiz/trunk/framework/common/data/GeoData_JP.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/GeoData_JP.xml?rev=1760406&r1=1760405&r2=1760406&view=diff ============================================================================== --- ofbiz/trunk/framework/common/data/GeoData_JP.xml (original) +++ ofbiz/trunk/framework/common/data/GeoData_JP.xml Mon Sep 12 16:47:53 2016 @@ -20,53 +20,53 @@ under the License. <entity-engine-xml> - <Geo abbreviation="01" geoCode="01" geoId="JP-01" geoName="åæµ·é" geoTypeId="PROVINCE" wellKnownText="Hokkaido"/> - <Geo abbreviation="02" geoCode="02" geoId="JP-02" geoName="é森ç" geoTypeId="PROVINCE" wellKnownText="Aomori"/> - <Geo abbreviation="03" geoCode="03" geoId="JP-03" geoName="岩æç" geoTypeId="PROVINCE" wellKnownText="Iwate"/> - <Geo abbreviation="04" geoCode="04" geoId="JP-04" geoName="å®®åç" geoTypeId="PROVINCE" wellKnownText="Miyagi"/> - <Geo abbreviation="05" geoCode="05" geoId="JP-05" geoName="ç§ç°ç" geoTypeId="PROVINCE" wellKnownText="Akita"/> - <Geo abbreviation="06" geoCode="06" geoId="JP-06" geoName="山形ç" geoTypeId="PROVINCE" wellKnownText="Yamagata"/> - <Geo abbreviation="07" geoCode="07" geoId="JP-07" geoName="ç¦å³¶ç" geoTypeId="PROVINCE" wellKnownText="Fukushima"/> - <Geo abbreviation="08" geoCode="08" geoId="JP-08" geoName="è¨åç" geoTypeId="PROVINCE" wellKnownText="Ibaraki"/> - <Geo abbreviation="09" geoCode="09" geoId="JP-09" geoName="æ æ¨ç" geoTypeId="PROVINCE" wellKnownText="Tochigi"/> - <Geo abbreviation="10" geoCode="10" geoId="JP-10" geoName="群馬ç" geoTypeId="PROVINCE" wellKnownText="Gunma"/> - <Geo abbreviation="11" geoCode="11" geoId="JP-11" geoName="å¼çç" geoTypeId="PROVINCE" wellKnownText="Saitama"/> - <Geo abbreviation="12" geoCode="12" geoId="JP-12" geoName="åèç" geoTypeId="PROVINCE" wellKnownText="Chiba"/> - <Geo abbreviation="13" geoCode="13" geoId="JP-13" geoName="æ±äº¬é½" geoTypeId="PROVINCE" wellKnownText="Tokyo"/> - <Geo abbreviation="14" geoCode="14" geoId="JP-14" geoName="ç¥å¥å·ç" geoTypeId="PROVINCE" wellKnownText="Kanagawa"/> - <Geo abbreviation="15" geoCode="15" geoId="JP-15" geoName="æ°æ½ç" geoTypeId="PROVINCE" wellKnownText="Niigata"/> - <Geo abbreviation="16" geoCode="16" geoId="JP-16" geoName="å¯å±±ç" geoTypeId="PROVINCE" wellKnownText="Toyama"/> - <Geo abbreviation="17" geoCode="17" geoId="JP-17" geoName="ç³å·ç" geoTypeId="PROVINCE" wellKnownText="Ishikawa"/> - <Geo abbreviation="18" geoCode="18" geoId="JP-18" geoName="ç¦äºç" geoTypeId="PROVINCE" wellKnownText="Fukui"/> - <Geo abbreviation="19" geoCode="19" geoId="JP-19" geoName="山梨ç" geoTypeId="PROVINCE" wellKnownText="Yamanashi"/> - <Geo abbreviation="20" geoCode="20" geoId="JP-20" geoName="é·éç" geoTypeId="PROVINCE" wellKnownText="Nagano"/> - <Geo abbreviation="21" geoCode="21" geoId="JP-21" geoName="å²éç" geoTypeId="PROVINCE" wellKnownText="Gifu"/> - <Geo abbreviation="22" geoCode="22" geoId="JP-22" geoName="é岡ç" geoTypeId="PROVINCE" wellKnownText="Shizuoka"/> - <Geo abbreviation="23" geoCode="23" geoId="JP-23" geoName="æç¥ç" geoTypeId="PROVINCE" wellKnownText="Aichi"/> - <Geo abbreviation="24" geoCode="24" geoId="JP-24" geoName="ä¸éç" geoTypeId="PROVINCE" wellKnownText="Mie"/> - <Geo abbreviation="25" geoCode="25" geoId="JP-25" geoName="æ»è³ç" geoTypeId="PROVINCE" wellKnownText="Shiga"/> - <Geo abbreviation="26" geoCode="26" geoId="JP-26" geoName="京é½åº" geoTypeId="PROVINCE" wellKnownText="Kyoto"/> - <Geo abbreviation="27" geoCode="27" geoId="JP-27" geoName="大éªåº" geoTypeId="PROVINCE" wellKnownText="Osaka"/> - <Geo abbreviation="28" geoCode="28" geoId="JP-28" geoName="å µåº«ç" geoTypeId="PROVINCE" wellKnownText="Hyogo"/> - <Geo abbreviation="29" geoCode="29" geoId="JP-29" geoName="å¥è¯ç" geoTypeId="PROVINCE" wellKnownText="Nara"/> - <Geo abbreviation="30" geoCode="30" geoId="JP-30" geoName="åæå±±ç" geoTypeId="PROVINCE" wellKnownText="Wakayama"/> - <Geo abbreviation="31" geoCode="31" geoId="JP-31" geoName="é³¥åç" geoTypeId="PROVINCE" wellKnownText="Tottori"/> - <Geo abbreviation="32" geoCode="32" geoId="JP-32" geoName="å³¶æ ¹ç" geoTypeId="PROVINCE" wellKnownText="Shimane"/> - <Geo abbreviation="33" geoCode="33" geoId="JP-33" geoName="岡山ç" geoTypeId="PROVINCE" wellKnownText="Okayama"/> - <Geo abbreviation="34" geoCode="34" geoId="JP-34" geoName="åºå³¶ç" geoTypeId="PROVINCE" wellKnownText="Hiroshima"/> - <Geo abbreviation="35" geoCode="35" geoId="JP-35" geoName="å±±å£ç" geoTypeId="PROVINCE" wellKnownText="Yamaguchi"/> - <Geo abbreviation="36" geoCode="36" geoId="JP-36" geoName="徳島ç" geoTypeId="PROVINCE" wellKnownText="Tokushima"/> - <Geo abbreviation="37" geoCode="37" geoId="JP-37" geoName="é¦å·ç" geoTypeId="PROVINCE" wellKnownText="Kagawa"/> - <Geo abbreviation="38" geoCode="38" geoId="JP-38" geoName="æåªç" geoTypeId="PROVINCE" wellKnownText="Ehime"/> - <Geo abbreviation="39" geoCode="39" geoId="JP-39" geoName="é«ç¥ç" geoTypeId="PROVINCE" wellKnownText="Kochi"/> - <Geo abbreviation="40" geoCode="40" geoId="JP-40" geoName="ç¦å²¡ç" geoTypeId="PROVINCE" wellKnownText="Fukuoka"/> - <Geo abbreviation="41" geoCode="41" geoId="JP-41" geoName="ä½è³ç" geoTypeId="PROVINCE" wellKnownText="Saga"/> - <Geo abbreviation="42" geoCode="42" geoId="JP-42" geoName="é·å´ç" geoTypeId="PROVINCE" wellKnownText="Nagasaki"/> - <Geo abbreviation="43" geoCode="43" geoId="JP-43" geoName="çæ¬ç" geoTypeId="PROVINCE" wellKnownText="Kumamoto"/> - <Geo abbreviation="44" geoCode="44" geoId="JP-44" geoName="大åç" geoTypeId="PROVINCE" wellKnownText="Oita"/> - <Geo abbreviation="45" geoCode="45" geoId="JP-45" geoName="å®®å´ç" geoTypeId="PROVINCE" wellKnownText="Miyazaki"/> - <Geo abbreviation="46" geoCode="46" geoId="JP-46" geoName="鹿å 島ç" geoTypeId="PROVINCE" wellKnownText="Kagoshima"/> - <Geo abbreviation="47" geoCode="47" geoId="JP-47" geoName="æ²ç¸ç" geoTypeId="PROVINCE" wellKnownText="Okinawa"/> + <Geo abbreviation="HK" geoCode="01" geoId="JP-01" geoName="åæµ·é" geoTypeId="PROVINCE" wellKnownText="Hokkaido"/> + <Geo abbreviation="AO" geoCode="02" geoId="JP-02" geoName="é森ç" geoTypeId="PROVINCE" wellKnownText="Aomori"/> + <Geo abbreviation="IT" geoCode="03" geoId="JP-03" geoName="岩æç" geoTypeId="PROVINCE" wellKnownText="Iwate"/> + <Geo abbreviation="MG" geoCode="04" geoId="JP-04" geoName="å®®åç" geoTypeId="PROVINCE" wellKnownText="Miyagi"/> + <Geo abbreviation="AK" geoCode="05" geoId="JP-05" geoName="ç§ç°ç" geoTypeId="PROVINCE" wellKnownText="Akita"/> + <Geo abbreviation="YG" geoCode="06" geoId="JP-06" geoName="山形ç" geoTypeId="PROVINCE" wellKnownText="Yamagata"/> + <Geo abbreviation="FS" geoCode="07" geoId="JP-07" geoName="ç¦å³¶ç" geoTypeId="PROVINCE" wellKnownText="Fukushima"/> + <Geo abbreviation="IB" geoCode="08" geoId="JP-08" geoName="è¨åç" geoTypeId="PROVINCE" wellKnownText="Ibaraki"/> + <Geo abbreviation="TC" geoCode="09" geoId="JP-09" geoName="æ æ¨ç" geoTypeId="PROVINCE" wellKnownText="Tochigi"/> + <Geo abbreviation="GU" geoCode="10" geoId="JP-10" geoName="群馬ç" geoTypeId="PROVINCE" wellKnownText="Gunma"/> + <Geo abbreviation="ST" geoCode="11" geoId="JP-11" geoName="å¼çç" geoTypeId="PROVINCE" wellKnownText="Saitama"/> + <Geo abbreviation="CB" geoCode="12" geoId="JP-12" geoName="åèç" geoTypeId="PROVINCE" wellKnownText="Chiba"/> + <Geo abbreviation="TY" geoCode="13" geoId="JP-13" geoName="æ±äº¬é½" geoTypeId="PROVINCE" wellKnownText="Tokyo"/> + <Geo abbreviation="KN" geoCode="14" geoId="JP-14" geoName="ç¥å¥å·ç" geoTypeId="PROVINCE" wellKnownText="Kanagawa"/> + <Geo abbreviation="NI" geoCode="15" geoId="JP-15" geoName="æ°æ½ç" geoTypeId="PROVINCE" wellKnownText="Niigata"/> + <Geo abbreviation="TM" geoCode="16" geoId="JP-16" geoName="å¯å±±ç" geoTypeId="PROVINCE" wellKnownText="Toyama"/> + <Geo abbreviation="IS" geoCode="17" geoId="JP-17" geoName="ç³å·ç" geoTypeId="PROVINCE" wellKnownText="Ishikawa"/> + <Geo abbreviation="FI" geoCode="18" geoId="JP-18" geoName="ç¦äºç" geoTypeId="PROVINCE" wellKnownText="Fukui"/> + <Geo abbreviation="YN" geoCode="19" geoId="JP-19" geoName="山梨ç" geoTypeId="PROVINCE" wellKnownText="Yamanashi"/> + <Geo abbreviation="NA" geoCode="20" geoId="JP-20" geoName="é·éç" geoTypeId="PROVINCE" wellKnownText="Nagano"/> + <Geo abbreviation="GI" geoCode="21" geoId="JP-21" geoName="å²éç" geoTypeId="PROVINCE" wellKnownText="Gifu"/> + <Geo abbreviation="SZ" geoCode="22" geoId="JP-22" geoName="é岡ç" geoTypeId="PROVINCE" wellKnownText="Shizuoka"/> + <Geo abbreviation="AI" geoCode="23" geoId="JP-23" geoName="æç¥ç" geoTypeId="PROVINCE" wellKnownText="Aichi"/> + <Geo abbreviation="ME" geoCode="24" geoId="JP-24" geoName="ä¸éç" geoTypeId="PROVINCE" wellKnownText="Mie"/> + <Geo abbreviation="SI" geoCode="25" geoId="JP-25" geoName="æ»è³ç" geoTypeId="PROVINCE" wellKnownText="Shiga"/> + <Geo abbreviation="KY" geoCode="26" geoId="JP-26" geoName="京é½åº" geoTypeId="PROVINCE" wellKnownText="Kyoto"/> + <Geo abbreviation="OS" geoCode="27" geoId="JP-27" geoName="大éªåº" geoTypeId="PROVINCE" wellKnownText="Osaka"/> + <Geo abbreviation="HG" geoCode="28" geoId="JP-28" geoName="å µåº«ç" geoTypeId="PROVINCE" wellKnownText="Hyogo"/> + <Geo abbreviation="NR" geoCode="29" geoId="JP-29" geoName="å¥è¯ç" geoTypeId="PROVINCE" wellKnownText="Nara"/> + <Geo abbreviation="WA" geoCode="30" geoId="JP-30" geoName="åæå±±ç" geoTypeId="PROVINCE" wellKnownText="Wakayama"/> + <Geo abbreviation="TT" geoCode="31" geoId="JP-31" geoName="é³¥åç" geoTypeId="PROVINCE" wellKnownText="Tottori"/> + <Geo abbreviation="SM" geoCode="32" geoId="JP-32" geoName="å³¶æ ¹ç" geoTypeId="PROVINCE" wellKnownText="Shimane"/> + <Geo abbreviation="OY" geoCode="33" geoId="JP-33" geoName="岡山ç" geoTypeId="PROVINCE" wellKnownText="Okayama"/> + <Geo abbreviation="HS" geoCode="34" geoId="JP-34" geoName="åºå³¶ç" geoTypeId="PROVINCE" wellKnownText="Hiroshima"/> + <Geo abbreviation="YA" geoCode="35" geoId="JP-35" geoName="å±±å£ç" geoTypeId="PROVINCE" wellKnownText="Yamaguchi"/> + <Geo abbreviation="TK" geoCode="36" geoId="JP-36" geoName="徳島ç" geoTypeId="PROVINCE" wellKnownText="Tokushima"/> + <Geo abbreviation="KA" geoCode="37" geoId="JP-37" geoName="é¦å·ç" geoTypeId="PROVINCE" wellKnownText="Kagawa"/> + <Geo abbreviation="EH" geoCode="38" geoId="JP-38" geoName="æåªç" geoTypeId="PROVINCE" wellKnownText="Ehime"/> + <Geo abbreviation="KO" geoCode="39" geoId="JP-39" geoName="é«ç¥ç" geoTypeId="PROVINCE" wellKnownText="Kochi"/> + <Geo abbreviation="FO" geoCode="40" geoId="JP-40" geoName="ç¦å²¡ç" geoTypeId="PROVINCE" wellKnownText="Fukuoka"/> + <Geo abbreviation="SG" geoCode="41" geoId="JP-41" geoName="ä½è³ç" geoTypeId="PROVINCE" wellKnownText="Saga"/> + <Geo abbreviation="NS" geoCode="42" geoId="JP-42" geoName="é·å´ç" geoTypeId="PROVINCE" wellKnownText="Nagasaki"/> + <Geo abbreviation="KU" geoCode="43" geoId="JP-43" geoName="çæ¬ç" geoTypeId="PROVINCE" wellKnownText="Kumamoto"/> + <Geo abbreviation="OI" geoCode="44" geoId="JP-44" geoName="大åç" geoTypeId="PROVINCE" wellKnownText="Oita"/> + <Geo abbreviation="MZ" geoCode="45" geoId="JP-45" geoName="å®®å´ç" geoTypeId="PROVINCE" wellKnownText="Miyazaki"/> + <Geo abbreviation="KG" geoCode="46" geoId="JP-46" geoName="鹿å 島ç" geoTypeId="PROVINCE" wellKnownText="Kagoshima"/> + <Geo abbreviation="OK" geoCode="47" geoId="JP-47" geoName="æ²ç¸ç" geoTypeId="PROVINCE" wellKnownText="Okinawa"/> <GeoAssoc geoId="JPN" geoIdTo="JP-01" geoAssocTypeId="REGIONS"/> <GeoAssoc geoId="JPN" geoIdTo="JP-02" geoAssocTypeId="REGIONS"/> Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy?rev=1760406&r1=1760405&r2=1760406&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/customer/ViewProfile.groovy Mon Sep 12 16:47:53 2016 @@ -86,4 +86,18 @@ if (userLogin) { partyAndContactMechList = from("PartyAndContactMech").where("partyId", partyId).orderBy("-fromDate").filterByDate().queryList(); context.partyAndContactMechList = partyAndContactMechList; + + // state/province & country's name + if (partyContactMechValueMaps) { + partyContactMechValueMaps.each { + if (it.postalAddress) { + postalAddress = it.postalAddress; + countryGeo = postalAddress.getRelatedOne("CountryGeo", false); + if (countryGeo) it.countryGeoName = countryGeo.getString("geoName"); + stateProvinceGeo = postalAddress.getRelatedOne("StateProvinceGeo", false); + if (stateProvinceGeo) it.stateProvinceGeoName = stateProvinceGeo.getString("geoName"); + + } + } + } } Modified: ofbiz/trunk/specialpurpose/ecommerce/template/customer/ViewProfile.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/template/customer/ViewProfile.ftl?rev=1760406&r1=1760405&r2=1760406&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/template/customer/ViewProfile.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/template/customer/ViewProfile.ftl Mon Sep 12 16:47:53 2016 @@ -154,8 +154,8 @@ under the License. <#if postalAddress.attnName?has_content>${uiLabelMap.PartyAddrAttnName}: ${postalAddress.attnName}<br /></#if> ${postalAddress.address1}<br /> <#if postalAddress.address2?has_content>${postalAddress.address2}<br /></#if> - ${postalAddress.city}<#if postalAddress.stateProvinceGeoId?has_content>, ${postalAddress.stateProvinceGeoId}</#if> ${postalAddress.postalCode!} - <#if postalAddress.countryGeoId?has_content><br />${postalAddress.countryGeoId}</#if> + ${postalAddress.city}<#if partyContactMechValueMap.stateProvinceGeoName?has_content>, ${partyContactMechValueMap.stateProvinceGeoName}</#if> ${postalAddress.postalCode!} + <#if partyContactMechValueMap.countryGeoName?has_content><br />${partyContactMechValueMap.countryGeoName}</#if> <#if (!postalAddress.countryGeoId?has_content || postalAddress.countryGeoId! = "USA")> <#assign addr1 = postalAddress.address1! /> <#if (addr1.indexOf(" ") > 0)> |
Free forum by Nabble | Edit this page |