svn commit: r561708 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml servicedef/secas.xml servicedef/services_fixedasset.xml

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

svn commit: r561708 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml servicedef/secas.xml servicedef/services_fixedasset.xml

hansbak-2
Author: hansbak
Date: Wed Aug  1 01:37:31 2007
New Revision: 561708

URL: http://svn.apache.org/viewvc?view=rev&rev=561708
Log:
automatically create and link a fixed asset when a 'asset_usage' type product is created.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas.xml
    ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml?view=diff&rev=561708&r1=561707&r2=561708
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Wed Aug  1 01:37:31 2007
@@ -57,6 +57,30 @@
         <create-value value-name="newEntity"/>
     </simple-method>
 
+    <simple-method method-name="createFixedAssetAndLinkToProduct" short-description="Create an FixedAsset and link the asset to the product">
+        <check-permission permission="ACCOUNTING" action="_CREATE">
+            <alt-permission permission="ACCOUNTING_ROLE" action="_CREATE"/>
+            <fail-message message="Security Error: to run createFixedAssetAndLinkToProduct you must have the ACCOUNTING_CREATE or ACCOUNTING_ADMIN permission, or the limited ACCOUNTING_ROLE_CREATE permission"/>
+        </check-permission>        
+        <check-errors/>
+
+ <set field="createFixedAsset.fixedAssetTypeId" value="PROPERTY"/>
+ <if-not-empty field-name="parameters.productName">
+ <set field="createFixedAsset.fixedAssetName" from-field="parameters.productName"/>
+ </if-not-empty>
+ <if-not-empty field-name="parameters.internalName">
+ <set field="createFixedAsset.fixedAssetName" from-field="parameters.internalName"/>
+ </if-not-empty>
+ <call-service service-name="createFixedAsset" in-map-name="createFixedAsset">
+ <result-to-field result-name="fixedAssetId" field-name="newLink.fixedAssetId"/>
+ </call-service>
+
+ <set field="newLink.fixedAssetProductTypeId" value="FAPT_USE"/>
+ <set field="newLink.productId" from-field="parameters.productId"/>
+ <call-service service-name="addFixedAssetProduct" in-map-name="newLink"/>
+        
+    </simple-method>
+
     <!-- update an existing Fixed Asset header Record -->
     <simple-method method-name="updateFixedAsset" short-description="Update an existing FixedAsset">
         <check-permission permission="ACCOUNTING" action="_UPDATE" >

Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?view=diff&rev=561708&r1=561707&r2=561708
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Wed Aug  1 01:37:31 2007
@@ -141,4 +141,13 @@
         <action service="sampleInvoiceAffiliateCommission" mode="sync"/>
     </eca>
     -->
+    
+    <!--  automatically create a fixed asset when a 'asset usage' type product
+   is created and create the link between them -->
+    <eca service="createProduct" event="commit">
+        <condition field-name="productTypeId" operator="equals" value="ASSET_USAGE"/>
+        <action service="createFixedAssetAndLinkToProduct" mode="sync"/>
+    </eca>
+    
+    
 </service-eca>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml?view=diff&rev=561708&r1=561707&r2=561708
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_fixedasset.xml Wed Aug  1 01:37:31 2007
@@ -32,6 +32,13 @@
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="fixedAssetTypeId" optional="false"/>
     </service>
+    <service name="createFixedAssetAndLinkToProduct" default-entity-name="FixedAsset" engine="simple"
+                location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetAndLinkToProduct" auth="true">
+        <description>Create an FixedAsset and link to an existing product</description>
+        <attribute name="productId" mode="IN" type="String"/>
+        <auto-attributes include="pk" mode="INOUT" optional="true"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
     <service name="updateFixedAsset" default-entity-name="FixedAsset" engine="simple"
                 location="org/ofbiz/accounting/fixedasset/FixedAssetServices.xml" invoke="updateFixedAsset" auth="true">
         <description>Update an FixedAsset</description>