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/28 22:58:21 UTC

svn commit: r1002353 - in /ofbiz/trunk/framework: common/script/org/ofbiz/common/CommonServices.xml common/servicedef/services.xml common/webcommon/WEB-INF/common-controller.xml images/webapp/images/getDependentDropdownValues.js

Author: jleroux
Date: Tue Sep 28 20:58:21 2010
New Revision: 1002353

URL: http://svn.apache.org/viewvc?rev=1002353&view=rev
Log:
Introduces a new checkUomConversion service which returns a boolean if UomConversion exists.

It may be used by a checkUomConversion javascript which uses the getServiceResult. I put it in the getDependentDropdownValues.js file for the moment. But anyway at term I will refactor all these Ajax related scripts (like in selectall.js) in a specific file.

Modified:
    ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
    ofbiz/trunk/framework/common/servicedef/services.xml
    ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
    ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js

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=1002353&r1=1002352&r2=1002353&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Tue Sep 28 20:58:21 2010
@@ -326,4 +326,17 @@ under the License.
         <field-to-result field="geoList"/>
     </simple-method>    
     
+    <simple-method method-name="checkUomConversion" short-description="Returns true if an UomConversion exists">
+        <entity-one entity-name="UomConversion" value-field="uomConversion">
+            <field-map field-name="uomId" from-field="parameters.uomId"/>
+            <field-map field-name="uomIdTo" from-field="parameters.uomIdTo"/>
+        </entity-one>
+        <if-not-empty field="uomConversion">
+            <set field="exist" value="true" type="Boolean"/>
+            <else>
+                <set field="exist" value="false" type="Boolean"/>                
+            </else>
+        </if-not-empty>
+        <field-to-result field="exist"/>
+    </simple-method>    
 </simple-methods>

Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1002353&r1=1002352&r2=1002353&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Tue Sep 28 20:58:21 2010
@@ -754,6 +754,14 @@ under the License.
         <attribute name="stateList" mode="OUT" type="java.util.List"/>
     </service>
     
+    <service name="checkUomConversion" engine="simple" default-entity-name="UomConversion"
+        location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="checkUomConversion">
+        <description>Returns true if an UomConversion exists</description>
+        <permission-service service-name="commonGenericPermission" main-action="VIEW"/>
+        <auto-attributes include="pk" mode="IN"/>
+        <attribute name="exist" mode="OUT" type="Boolean"/>
+    </service>    
+    
     <service name="getRelatedGeos" engine="simple" auth="false"
         location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="getRelatedGeos">
         <attribute name="geoId" mode="IN" type="String"/>

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml?rev=1002353&r1=1002352&r2=1002353&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/common-controller.xml Tue Sep 28 20:58:21 2010
@@ -190,13 +190,13 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="main"/>
     </request-map>
-    
+
     <!-- Lookup requests -->
     <request-map uri="LookupGeo"><security https="true" auth="true"/><response name="success" type="view" value="LookupGeo"/></request-map>
     <request-map uri="LookupGeoName"><security https="true" auth="true"/><response name="success" type="view" value="LookupGeoName"/></request-map>
     
     <!--========================== AJAX events =====================-->
-    <!-- to dynamically get products related to a product category -->
+    <!-- Get products related to a product category -->
     <request-map uri="getAssociatedProductsList">
         <security https="true" auth="false"/>
         <event type="service" invoke="getAssociatedProductsList"/>
@@ -204,7 +204,7 @@ under the License.
         <response name="error" type="request" value="json"/>
     </request-map>
     
-    <!-- to dynamically get states related to a country -->
+    <!-- Get states related to a country -->
     <request-map uri="getAssociatedStateList">
         <security https="true" auth="false"/>
         <event type="service" invoke="getAssociatedStateList"/>
@@ -212,6 +212,14 @@ under the License.
         <response name="error" type="request" value="json"/>
     </request-map>    
 
+    <!-- Check if an UomConversion exists -->
+    <request-map uri="checkUomConversion">
+        <security https="true" auth="false"/>
+        <event type="service" invoke="checkUomConversion"/>
+        <response name="success" type="request" value="json"/>
+        <response name="error" type="request" value="json"/>
+    </request-map>
+
     <request-map uri="getRelatedGeos">
         <security https="true" auth="true"/>
         <event type="service" invoke="getRelatedGeos"/>
@@ -220,7 +228,6 @@ under the License.
     </request-map>
     <!--========================== AJAX events =====================-->
 
-
     <!-- View Mappings -->
     <view-map name="error" page="/error/error.jsp"/>
     <view-map name="main" type="none"/>

Modified: ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js?rev=1002353&r1=1002352&r2=1002353&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js Tue Sep 28 20:58:21 2010
@@ -90,7 +90,7 @@ function getDependentDropdownValues(requ
     });
 }
 
-// calls any service already mounted as an event
+//*** calls any service already mounted as an event
 function getServiceResult(request, params) {
 	var data;
 	new Ajax.Request(request, {
@@ -102,3 +102,9 @@ function getServiceResult(request, param
 	});
 	return data;
 }
+
+//*** checkUomConversion returns true if an UomConversion exists 
+function checkUomConversion(request, params) {
+    data = getServiceResult(request, params);    
+    return data['exist']; 
+}