svn commit: r488041 - /incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r488041 - /incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml

jonesde
Author: jonesde
Date: Sun Dec 17 12:34:34 2006
New Revision: 488041

URL: http://svn.apache.org/viewvc?view=rev&rev=488041
Log:
Fixed update problem when there is no statusId on an existing Example, as an example

Modified:
    incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml

Modified: incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml?view=diff&rev=488041&r1=488040&r2=488041
==============================================================================
--- incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml (original)
+++ incubator/ofbiz/trunk/framework/example/script/org/ofbiz/example/example/ExampleServices.xml Sun Dec 17 12:34:34 2006
@@ -42,16 +42,19 @@
         <!-- handle statusId change stuff; first put the current statusId in the oldStatusId result -->
         <field-to-result field-name="lookedUpValue.statusId" result-name="oldStatusId"/>
         <if-compare-field field-name="lookedUpValue.statusId" operator="not-equals" to-field-name="parameters.statusId">
-            <!-- if statusId change is not in the StatusValidChange list, complain... -->
-            <entity-one entity-name="StatusValidChange" value-name="statusValidChange" auto-field-map="false">
-                <field-map field-name="statusId" env-name="lookedUpValue.statusId"/>
-                <field-map field-name="statusIdTo" env-name="parameters.statusId"/>
-            </entity-one>
-            <if-empty field-name="statusValidChange">
-                <!-- no valid change record found? return an error... -->
-                <add-error><fail-property resource="ExampleUiLabels" property="ExampleErrorNoExampleStatusValidChange"/></add-error>
-                <check-errors/>
-            </if-empty>
+            <!-- if the Example record exists there should be a statusId, but just in case make it so it won't blow up -->
+            <if-not-empty field-name="lookedUpValue.statusId">
+                <!-- if statusId change is not in the StatusValidChange list, complain... -->
+                <entity-one entity-name="StatusValidChange" value-name="statusValidChange" auto-field-map="false">
+                    <field-map field-name="statusId" env-name="lookedUpValue.statusId"/>
+                    <field-map field-name="statusIdTo" env-name="parameters.statusId"/>
+                </entity-one>
+                <if-empty field-name="statusValidChange">
+                    <!-- no valid change record found? return an error... -->
+                    <add-error><fail-property resource="ExampleUiLabels" property="ExampleErrorNoExampleStatusValidChange"/></add-error>
+                    <check-errors/>
+                </if-empty>
+            </if-not-empty>
             
             <!-- before we set the nonpk fields, if the statusId is different save a ExampleStatus history record -->
             <set-service-fields service-name="createExampleStatus" map-name="parameters" to-map-name="createExampleStatusMap"/>