svn commit: r643923 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/admin/AcctgAdminServices.xml servicedef/services_admin.xml

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

svn commit: r643923 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/admin/AcctgAdminServices.xml servicedef/services_admin.xml

jacopoc
Author: jacopoc
Date: Wed Apr  2 07:43:11 2008
New Revision: 643923

URL: http://svn.apache.org/viewvc?rev=643923&view=rev
Log:
Applied patch by Rashko Rejmer to implement new service to get an aggregate set of accounting preferences for a company (and its parent organizations) OFBIZ-1630.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/admin/AcctgAdminServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_admin.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/admin/AcctgAdminServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/admin/AcctgAdminServices.xml?rev=643923&r1=643922&r2=643923&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/admin/AcctgAdminServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/admin/AcctgAdminServices.xml Wed Apr  2 07:43:11 2008
@@ -49,6 +49,67 @@
         <store-value value-name="newEntity"/>
     </simple-method>
     
+    <simple-method method-name="getPartyAccountingPreferences"
+            short-description="Get the accounting preference settings for a party (organization)">
+        <make-value entity-name="PartyAcctgPreference" value-name="aggregatedPartyAcctgPref" />
+        <set field="currentOrganizationPartyId" from-field="parameters.organizationPartyId"/>
+        <set field="containsEmptyFields" type="Boolean" value="true"/>
+        <while>
+            <condition>
+                <and>
+                    <not><if-empty field-name="currentOrganizationPartyId"></if-empty></not>
+                    <if-compare field-name="containsEmptyFields" operator="equals" value="true"/>
+                </and>
+            </condition>
+            <then>
+                <clear-field field-name="parentPartyRelationship"/>
+                <clear-field field-name="entityKey"/>
+                <clear-field field-name="entityValue"/>
+                <entity-one entity-name="PartyAcctgPreference" value-name="currentPartyAcctgPref">
+                    <field-map field-name="partyId" env-name="currentOrganizationPartyId"/>
+                </entity-one>
+                <set field="containsEmptyFields" type="Boolean" value="false"/>
+                
+                <if-not-empty field-name="currentPartyAcctgPref">
+                    <iterate-map map-name="currentPartyAcctgPref" key-name="entityKey" value-name="entityValue">
+                        <if-empty field-name="aggregatedPartyAcctgPref.${entityKey}">
+                            <if-not-empty field-name="entityValue">
+                                <set field="aggregatedPartyAcctgPref.${entityKey}" from-field="entityValue"/>
+                            <else>
+                                <set field="containsEmptyFields" type="Boolean" value="true"/>
+                            </else>
+                            </if-not-empty>
+                        </if-empty>
+                    </iterate-map>
+                <else>
+                    <set field="containsEmptyFields" type="Boolean" value="true"/>
+                </else>
+                </if-not-empty>
+                
+                <entity-and entity-name="PartyRelationship" list-name="parentPartyRelationships">
+                    <field-map field-name="partyIdTo" env-name="currentOrganizationPartyId"/>
+                    <field-map field-name="partyRelationshipTypeId" value="GROUP_ROLLUP"/>
+                    <field-map field-name="roleTypeIdFrom" value="_NA_"/>
+                    <field-map field-name="roleTypeIdTo" value="_NA_"/>
+                </entity-and>
+                <filter-list-by-date list-name="parentPartyRelationships"/>
+                
+                <if-not-empty field-name="parentPartyRelationships">
+                    <first-from-list list-name="parentPartyRelationships" entry-name="parentPartyRelationship"/>
+                    <set field="currentOrganizationPartyId" from-field="parentPartyRelationship.partyIdFrom"/>
+                <else>
+                    <clear-field field-name="currentOrganizationPartyId"/>
+                </else>    
+                </if-not-empty>
+            </then>
+        </while>
+        
+        <if-not-empty field-name="aggregatedPartyAcctgPref">
+            <set field="aggregatedPartyAcctgPref.partyId" from-field="parameters.organizationPartyId"/>
+            <field-to-result field-name="aggregatedPartyAcctgPref" result-name="partyAccountingPreference"/>
+        </if-not-empty>
+    </simple-method>
+    
     <!-- update currency conversion rates in the UomConversionDated entity -->
     <simple-method method-name="updateFXConversion" short-description="Update Foreign Exchange conversion rate">
         <!-- set the FX rate changes as of now -->

Modified: ofbiz/trunk/applications/accounting/servicedef/services_admin.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_admin.xml?rev=643923&r1=643922&r2=643923&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_admin.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_admin.xml Wed Apr  2 07:43:11 2008
@@ -56,6 +56,13 @@
             <exclude field-name="lastOrderNumber"/>
         </auto-attributes>
     </service>
+    <service name="getPartyAccountingPreferences" default-entity-name="PartyAcctgPreference" engine="simple"
+            location="org/ofbiz/accounting/admin/AcctgAdminServices.xml" invoke="getPartyAccountingPreferences" auth="true">
+        <description>Get accounting preferences for a party (organization)</description>
+        <permission-service service-name="acctgPrefPermissionCheck" main-action="VIEW"/>
+        <attribute type="String" mode="IN" name="organizationPartyId" optional="false"/>
+        <attribute name="partyAccountingPreference" type="GenericValue" mode="OUT" optional="true"/>
+    </service>
     
     <service name="updateFXConversion" engine="simple"
         location="org/ofbiz/accounting/admin/AcctgAdminServices.xml" invoke="updateFXConversion">