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 2010/09/24 21:43:38 UTC

svn commit: r1001050 - /ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml

Author: jleroux
Date: Fri Sep 24 19:43:38 2010
New Revision: 1001050

URL: http://svn.apache.org/viewvc?rev=1001050&view=rev
Log:
In linkGeos service I reversed the 2 geos (geoId and GeoIdTo) in GeoAssoc creation (backported from jQuery branch)

Modified:
    ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml?rev=1001050&r1=1001049&r2=1001050&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Fri Sep 24 19:43:38 2010
@@ -271,35 +271,35 @@ under the License.
 
     <simple-method method-name="linkGeos" short-description="Link Geos to another Geo">
         <entity-and entity-name="GeoAssoc" list="geoAssocs">
-            <field-map field-name="geoIdTo" from-field="parameters.geoId"/>
+            <field-map field-name="geoId" from-field="parameters.geoId"/>
         </entity-and>
         <!-- Current list contains old values? -->
         <iterate list="geoAssocs" entry="geoAssoc">
-            <if-compare-field field="parameters.geoIds" operator="contains" to-field="geoAssoc.geoId">
+            <if-compare-field field="parameters.geoIds" operator="contains" to-field="geoAssoc.geoIdTo">
                 <!-- Yes, nothing to do, it already exists and we keep it -->
                 <else><!-- Remove -->
                     <entity-one entity-name="GeoAssoc" value-field="oldGeoAssoc">
-                        <field-map field-name="geoId" from-field="geoAssoc.geoId"/>
-                        <field-map field-name="geoIdTo" from-field="parameters.geoId"/>
+                        <field-map field-name="geoId" from-field="parameters.geoId"/>
+                        <field-map field-name="geoIdTo" from-field="geoAssoc.geoIdTo"/>
                     </entity-one>
                     <remove-value value-field="oldGeoAssoc"/>
                 </else>                
             </if-compare-field>
         </iterate>
         <!-- Old list contains current values -->
-        <iterate list="parameters.geoIds" entry="geoId">            
-            <if-compare-field field="oldGeoIds" operator="contains" to-field="geoId">
+        <iterate list="parameters.geoIds" entry="geoIdTo">            
+            <if-compare-field field="oldGeoIds" operator="contains" to-field="geoIdTo">
                 <!-- Yes, nothing to do, it already exists and we keep it -->
                 <else> 
                     <entity-one entity-name="GeoAssoc" value-field="oldGeoAssoc">
-                        <field-map field-name="geoId" from-field="geoId"/>
-                        <field-map field-name="geoIdTo" from-field="parameters.geoId"/>
+                        <field-map field-name="geoId" from-field="parameters.geoId"/>
+                        <field-map field-name="geoIdTo" from-field="geoIdTo"/>
                     </entity-one>
                     <if-empty field="oldGeoAssoc">                    
                         <!-- Add as it does not exist -->
                         <make-value value-field="newGeoAssoc" entity-name="GeoAssoc"/>
-                        <set field="newGeoAssoc.geoId" from-field="geoId"/>
-                        <set field="newGeoAssoc.geoIdTo" from-field="parameters.geoId"/>
+                        <set field="newGeoAssoc.geoId" from-field="parameters.geoId"/>
+                        <set field="newGeoAssoc.geoIdTo" from-field="geoIdTo"/>
                         <set field="newGeoAssoc.geoAssocTypeId" from-field="parameters.geoAssocTypeId"/>
                         <create-value value-field="newGeoAssoc"/>
                     </if-empty>
@@ -311,15 +311,17 @@ under the License.
 
     <simple-method method-name="getRelatedGeos" short-description="get related geos to a geo through a geoAssoc" login-required="false">      
         <entity-and entity-name="GeoAssoc" list="geoAssoc">
-            <field-map field-name="geoIdTo" from-field="parameters.geoId"/>
+            <field-map field-name="geoId" from-field="parameters.geoId"/>
             <field-map field-name="geoAssocTypeId" from-field="parameters.geoAssocTypeId"/>
         </entity-and>
-        <iterate list="geoAssoc" entry="geo">
-            <field-to-list list="geoList" field="geo.geoId"/>
-        </iterate>
-        <if-empty field="geoList">
-            <property-to-field resource="CommonUiLabels" property="CommonNoOptions" field="noOptions"/>
+        <if-empty field="geoAssoc">
+            <set field="noOptions" value="____"/>
             <field-to-list list="geoList" field="noOptions"/>
+            <else>
+                <iterate list="geoAssoc" entry="geo">
+                    <field-to-list list="geoList" field="geo.geoIdTo"/>
+                </iterate>
+            </else>
         </if-empty>
         <field-to-result field="geoList"/>
     </simple-method>