You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/04/08 07:22:57 UTC

svn commit: r1310955 - in /ofbiz/branches/release11.04: ./ applications/party/webapp/partymgr/party/editcontactmech.ftl applications/party/widget/partymgr/PartyScreens.xml

Author: jleroux
Date: Sun Apr  8 05:22:57 2012
New Revision: 1310955

URL: http://svn.apache.org/viewvc?rev=1310955&view=rev
Log:
"Applied fix from trunk for revision: 1310953 " 
------------------------------------------------------------------------
r1310953 | jleroux | 2012-04-08 07:15:29 +0200 (dim., 08 avr. 2012) | 26 lines

Fixes "Party Manager Default Country in Update" reported by Tom Burns at https://issues.apache.org/jira/browse/OFBIZ-4787

In Party Manager > Profile > Contact Information > Update the "Country" drop down always defaults to "United States".
This is misleading if the Country is not "United States".
If a user were to change some other address element he/she would have to also re-set "Country" to keep it from being changed to "United States".

To reproduce:
In Party Manager lookup a party with a "Postal Address" say "DemoSupplier"*
In Contact Information > Postal Address Click "Update"
In the Country field select any country but "United States" say Switzerland
Click "Save"

Note -
Expect drop down default after save = "Switzerland"
Actual drop down default after save = "United States"

Click "Go Back"
Expect "Postal Address" country = "Switzerland"
Actual "Postal Address" country = "Switzerland"

Click
Click "Update"
Expect drop down default to be "Switzerland"
Actual "United States"

jleroux: rather than using Tom's patch I reused setDependentDropdownValuesJs.ftl. There were no OOTB examples of its use in FTL templates so now there is one.The same could be done for other EditContactMech.ftl (eCommerce and Facility) I will ask Tom to try it
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/applications/party/webapp/partymgr/party/editcontactmech.ftl
    ofbiz/branches/release11.04/applications/party/widget/partymgr/PartyScreens.xml

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1310953

Modified: ofbiz/branches/release11.04/applications/party/webapp/partymgr/party/editcontactmech.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/party/webapp/partymgr/party/editcontactmech.ftl?rev=1310955&r1=1310954&r2=1310955&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/party/webapp/partymgr/party/editcontactmech.ftl (original)
+++ ofbiz/branches/release11.04/applications/party/webapp/partymgr/party/editcontactmech.ftl Sun Apr  8 05:22:57 2012
@@ -46,7 +46,7 @@ under the License.
       <p>(${uiLabelMap.PartyMsgContactHavePurpose} <b>"${contactMechPurposeType.get("description",locale)?if_exists}"</b>)</p>
     </#if>
     <table class="basic-table" cellspacing="0">
-      <form method="post" action="<@o...@ofbizUrl>" name="editcontactmechform">
+      <form method="post" action="<@o...@ofbizUrl>" name="editcontactmechform" id="editcontactmechform">
         <input type="hidden" name="DONE_PAGE" value="${donePage}" />
         <input type="hidden" name="contactMechTypeId" value="${mechMap.contactMechTypeId}" />
         <input type="hidden" name="partyId" value="${partyId}" />
@@ -54,7 +54,7 @@ under the License.
         <#if preContactMechTypeId?exists><input type="hidden" name="preContactMechTypeId" value="${preContactMechTypeId}" /></#if>
         <#if contactMechPurposeTypeId?exists><input type="hidden" name="contactMechPurposeTypeId" value="${contactMechPurposeTypeId?if_exists}" /></#if>
         <#if paymentMethodId?has_content><input type='hidden' name='paymentMethodId' value='${paymentMethodId}' /></#if>
-  <#else>
+  <#else>  
     <h1>${uiLabelMap.PartyEditContactInformation}</h1>
     <div id="mech-purpose-types">
       <table class="basic-table" cellspacing="0">
@@ -110,7 +110,7 @@ under the License.
             </table>
           </tr>
       </#if>
-      <form method="post" action="<@o...@ofbizUrl>" name="editcontactmechform">
+      <form method="post" action="<@o...@ofbizUrl>" name="editcontactmechform" id="editcontactmechform">
         <input type="hidden" name="contactMechId" value="${contactMechId}" />
         <input type="hidden" name="contactMechTypeId" value="${mechMap.contactMechTypeId}" />
         <input type="hidden" name="partyId" value="${partyId}" />
@@ -150,10 +150,7 @@ under the License.
     <tr>
       <td class="label">${uiLabelMap.PartyState}</td>
       <td>
-        <select name="stateProvinceGeoId">
-          <option>${(mechMap.postalAddress.stateProvinceGeoId)?if_exists}</option>
-          <option></option>
-          ${screens.render("component://common/widget/CommonScreens.xml#states")}
+        <select name="stateProvinceGeoId" id="editcontactmechform_stateProvinceGeoId">
         </select>
       </td>
     </tr>
@@ -163,22 +160,21 @@ under the License.
         <input type="text" size="30" maxlength="60" name="postalCode" value="${(mechMap.postalAddress.postalCode)?default(request.getParameter('postalCode')?if_exists)}" />
       </td>
     </tr>
-    <tr>
+    <tr>   
       <td class="label">${uiLabelMap.CommonCountry}</td>
-      <td>
-        <select name="countryGeoId">
+      
+      <td>     
+        <select name="countryGeoId" id="editcontactmechform_countryGeoId">
+          ${screens.render("component://common/widget/CommonScreens.xml#countries")}        
           <#if (mechMap.postalAddress?exists) && (mechMap.postalAddress.countryGeoId?exists)>
-            <#assign defaultCountryGeoId = (mechMap.postalAddress.countryGeoId)>
-            <option selected="selected" value="${defaultCountryGeoId}">
+            <#assign defaultCountryGeoId = mechMap.postalAddress.countryGeoId>
           <#else>
            <#assign defaultCountryGeoId = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("general.properties", "country.geo.id.default")>
-           <option selected="selected" value="${defaultCountryGeoId}">
           </#if>
-          <#assign countryGeo = delegator.findByPrimaryKey("Geo",Static["org.ofbiz.base.util.UtilMisc"].toMap("geoId",defaultCountryGeoId))>
-          ${countryGeo.get("geoName",locale)}
+          <option selected="selected" value="${defaultCountryGeoId}">
+            <#assign countryGeo = delegator.findByPrimaryKey("Geo",Static["org.ofbiz.base.util.UtilMisc"].toMap("geoId",defaultCountryGeoId))>
+            ${countryGeo.get("geoName",locale)}
           </option>
-          <option></option>
-          ${screens.render("component://common/widget/CommonScreens.xml#countries")}
         </select>
       </td>
     </tr>

Modified: ofbiz/branches/release11.04/applications/party/widget/partymgr/PartyScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/party/widget/partymgr/PartyScreens.xml?rev=1310955&r1=1310954&r2=1310955&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/party/widget/partymgr/PartyScreens.xml (original)
+++ ofbiz/branches/release11.04/applications/party/widget/partymgr/PartyScreens.xml Sun Apr  8 05:22:57 2012
@@ -421,6 +421,17 @@ under the License.
 
                 <script location="component://party/webapp/partymgr/WEB-INF/actions/HasPartyPermissions.groovy"/>
                 <script location="component://party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy"/>
+                
+                <set field="dependentForm" value="editcontactmechform"/>
+                <set field="paramKey" value="countryGeoId"/>
+                <set field="mainId" value="countryGeoId"/>
+                <set field="dependentId" value="stateProvinceGeoId"/>
+                <set field="requestName" value="getAssociatedStateList"/>
+                <set field="responseName" value="stateList"/>
+                <set field="dependentKeyName" value="geoId"/>
+                <set field="descName" value="geoName"/>
+                <set field="selectedDependentOption" from-field="mechMap.postalAddress.stateProvinceGeoId" default-value="_none_"/>                
+                
             </actions>
             <widgets>
                 <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
@@ -437,7 +448,10 @@ under the License.
                             </condition>
                             <widgets>
                                 <platform-specific>
-                                    <html><html-template location="component://party/webapp/partymgr/party/editcontactmech.ftl"/></html>
+                                    <html>
+                                        <html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/>
+                                        <html-template location="component://party/webapp/partymgr/party/editcontactmech.ftl"/>
+                                    </html>
                                 </platform-specific>
                             </widgets>
                             <fail-widgets>
@@ -693,7 +707,7 @@ under the License.
                                 <if-has-permission permission="PARTYMGR" action="_CREATE"/>
                             </condition>
                             <actions>
-                                <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization, if you need an example with more than one dropdown in a form have a look at EditProductPriceRules screen -->
+                                <!-- fields for setDependentDropdownValuesJs.ftl -->
                                 <set field="dependentForm" value="NewUser"/>
                                 <set field="paramKey" value="countryGeoId"/>                                        
                                 <set field="mainId" value="USER_COUNTRY"/>
@@ -738,7 +752,7 @@ under the License.
                                 <if-has-permission permission="PARTYMGR" action="_CREATE"/>
                             </condition>
                             <actions>
-                                <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization, if you need an example with more than one dropdown in a form have a look at EditProductPriceRules screen -->
+                                <!-- fields for setDependentDropdownValuesJs.ftl -->
                                 <set field="dependentForm" value="NewUser"/>
                                 <set field="paramKey" value="countryGeoId"/>                                        
                                 <set field="mainId" value="USER_COUNTRY"/>
@@ -783,7 +797,7 @@ under the License.
                                 <if-has-permission permission="PARTYMGR" action="_CREATE"/>
                             </condition>
                             <actions>
-                                <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization, if you need an example with more than one dropdown in a form have a look at EditProductPriceRules screen -->
+                                <!-- fields for setDependentDropdownValuesJs.ftl -->
                                 <set field="dependentForm" value="NewUser"/>
                                 <set field="paramKey" value="countryGeoId"/>                                        
                                 <set field="mainId" value="USER_COUNTRY"/>