svn commit: r429000 - /incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml

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

svn commit: r429000 - /incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml

jleroux@apache.org
Author: jleroux
Date: Sat Aug  5 06:57:23 2006
New Revision: 429000

URL: http://svn.apache.org/viewvc?rev=429000&view=rev
Log:
Deprecated operations replaced by set operations in PromoServices.xml (Apache OFBIZ-90)

Modified:
    incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml

Modified: incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml?rev=429000&r1=428999&r2=429000&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml (original)
+++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml Sat Aug  5 06:57:23 2006
@@ -29,14 +29,13 @@
         <sequenced-id-to-env sequence-name="ProductPromo" env-name="newEntity.productPromoId"/>
         <field-to-result field-name="productPromoId" map-name="newEntity"/>
 
-        <if-empty field-name="newEntity.userEntered">
-            <string-to-field string="Y" field-name="newEntity.userEntered"/>
-        </if-empty>
+        <set value="Y" set-if-empty="true" field="newEntity.userEntered"/>
+
         <now-timestamp-to-env env-name="nowTimestamp"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.createdDate"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.lastModifiedDate"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.lastModifiedByUserLogin"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.createdByUserLogin"/>
+        <set from-field="nowTimestamp" field="newEntity.createdDate"/>
+        <set from-field="nowTimestamp" field="newEntity.lastModifiedDate"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.lastModifiedByUserLogin"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.createdByUserLogin"/>
 
         <create-value value-name="newEntity"/>
     </simple-method>
@@ -45,16 +44,15 @@
         <check-permission permission="CATALOG_PRICE_MAINT"><fail-property resource="ProductUiLabels" property="ProductPriceMaintPermissionError"/></check-permission>
         <check-errors/>
 
-        <field-to-field field-name="productPromoId" map-name="parameters" to-map-name="lookupPKMap"/>
+        <set from-field="parameters.productPromoId" field="lookupPKMap.productPromoId"/>
         <find-by-primary-key entity-name="ProductPromo" map-name="lookupPKMap" value-name="lookedUpValue"/>
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
 
-        <if-empty field-name="newEntity.userEntered">
-            <string-to-field string="Y" field-name="newEntity.userEntered"/>
-        </if-empty>
+        <set value="Y" set-if-empty="true" field="newEntity.userEntered"/>
+
         <now-timestamp-to-env env-name="nowTimestamp"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.lastModifiedDate"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.lastModifiedByUserLogin"/>
+        <set from-field="nowTimestamp" field="newEntity.lastModifiedDate"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.lastModifiedByUserLogin"/>
 
         <store-value value-name="lookedUpValue"/>
     </simple-method>
@@ -65,7 +63,7 @@
 
         <!-- TODO: if a force remove flag is passed, remove related info first, maybe just rules, store assocs, etc -->
 
-        <field-to-field field-name="productPromoId" map-name="parameters" to-map-name="lookupPKMap"/>
+        <set from-field="parameters.productPromoId" field="lookupPKMap.productPromoId"/>
         <find-by-primary-key entity-name="ProductPromo" map-name="lookupPKMap" value-name="lookedUpValue"/>
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
@@ -152,10 +150,10 @@
         <field-to-result field-name="productPromoCodeId" map-name="newEntity"/>
 
         <now-timestamp-to-env env-name="nowTimestamp"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.createdDate"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.lastModifiedDate"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.lastModifiedByUserLogin"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.createdByUserLogin"/>
+        <set from-field="nowTimestamp" field="newEntity.createdDate"/>
+        <set from-field="nowTimestamp" field="newEntity.lastModifiedDate"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.lastModifiedByUserLogin"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.createdByUserLogin"/>
 
         <create-value value-name="newEntity"/>
     </simple-method>
@@ -170,8 +168,8 @@
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
 
         <now-timestamp-to-env env-name="nowTimestamp"/>
-        <env-to-env env-name="nowTimestamp" to-env-name="newEntity.lastModifiedDate"/>
-        <env-to-env env-name="userLogin.userLoginId" to-env-name="newEntity.lastModifiedByUserLogin"/>
+        <set from-field="nowTimestamp" field="newEntity.lastModifiedDate"/>
+        <set from-field="userLogin.userLoginId" field="newEntity.lastModifiedByUserLogin"/>
 
         <store-value value-name="lookedUpValue"/>
     </simple-method>
@@ -348,10 +346,9 @@
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
         <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
 
-        <if-empty field-name="fromDate" map-name="newEntity">
-            <now-timestamp-to-env env-name="nowTimestamp"/>
-            <env-to-field env-name="nowTimestamp" field-name="fromDate" map-name="newEntity"/>
-        </if-empty>
+        <now-timestamp-to-env env-name="nowTimestamp"/>
+        <set from-field="nowTimestamp.fromDate" set-if-empty="true" field="newEntity.fromDate"/>
+
 
         <create-value value-name="newEntity"/>
     </simple-method>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r429000 - /incubator/ofbiz/trunk/applications/product/script/org/ofbiz/product/promo/PromoServices.xml

David E Jones-2

On Aug 5, 2006, at 7:57 AM, [hidden email] wrote:

> Modified: incubator/ofbiz/trunk/applications/product/script/org/
> ofbiz/product/promo/PromoServices.xml
> URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/ 
> applications/product/script/org/ofbiz/product/promo/
> PromoServices.xml?rev=429000&r1=428999&r2=429000&view=diff
> ======================================================================
> ========
> --- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/
> product/promo/PromoServices.xml (original)
> +++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/
> product/promo/PromoServices.xml Sat Aug  5 06:57:23 2006
> @@ -29,14 +29,13 @@
>          <sequenced-id-to-env sequence-name="ProductPromo" env-
> name="newEntity.productPromoId"/>
>          <field-to-result field-name="productPromoId" map-
> name="newEntity"/>
>
> -        <if-empty field-name="newEntity.userEntered">
> -            <string-to-field string="Y" field-
> name="newEntity.userEntered"/>
> -        </if-empty>
> +        <set value="Y" set-if-empty="true"  
> field="newEntity.userEntered"/>
> +

There was at least one more of these in this commit, but I'll just  
use this one as an example.

There is a problem with this because the set operation is not  
equivalent to the if-empty + string-to-field. In other words, you  
still need the if-empty around the set operation.

The reason is that if newEntity.userEntered is NOT empty then with  
the if-empty tag it will do nothing, but without the if-empty tag it  
will still do the set operation!

In other words, the set-if-empty attribute does not mean "set only if  
empty" it means "set if empty or not empty".

-David