Fixes issue 0016250: you can not select the accounting schema in copy accounts
authorEgoitz Castillo <egoitz.castillo@openbravo.com>
Tue, 31 May 2011 12:11:06 +0200
changeset 12561 fc96e8949434
parent 12560 f365887dc3ff
child 12562 d414cc5af0dc
Fixes issue 0016250: you can not select the accounting schema in copy accounts
src-db/database/model/functions/A_ASSET_GROUP_ACCT_COPY.xml
src-db/database/sourcedata/AD_PROCESS_PARA.xml
--- a/src-db/database/model/functions/A_ASSET_GROUP_ACCT_COPY.xml	Tue May 31 11:58:53 2011 +0200
+++ b/src-db/database/model/functions/A_ASSET_GROUP_ACCT_COPY.xml	Tue May 31 12:11:06 2011 +0200
@@ -29,6 +29,7 @@
     Cur_Parameter RECORD;
     --
     v_A_Asset_Group_ID VARCHAR2(32);
+    v_C_Acctschema_ID VARCHAR2(32);
     Cur_Acct RECORD;
     --
     v_Updated NUMBER:=0;
@@ -57,6 +58,9 @@
       IF(Cur_Parameter.ParameterName='A_Asset_Group_ID') THEN
         v_A_Asset_Group_ID:=Cur_Parameter.P_String;
         DBMS_OUTPUT.PUT_LINE('  A_Asset_Group_ID=' || v_A_Asset_Group_ID) ;
+      ELSIF(Cur_Parameter.ParameterName='C_AcctSchema_ID') THEN
+        v_C_Acctschema_ID:=Cur_Parameter.P_String;
+        DBMS_OUTPUT.PUT_LINE('  C_AcctSchema_ID=' || v_C_Acctschema_ID) ;
       ELSE
         DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
       END IF;
@@ -66,7 +70,15 @@
     * For all Accounting Schema of the Category
     */
     FOR Cur_Acct IN
-      (SELECT *  FROM A_Asset_Group_Acct  WHERE A_Asset_Group_ID=v_A_Asset_Group_ID)
+      (SELECT *
+      FROM A_Asset_Group_Acct
+      WHERE A_Asset_Group_ID=v_A_Asset_Group_ID
+      AND (A_Asset_Group_Acct.C_ACCTSCHEMA_ID = v_C_Acctschema_ID OR v_C_Acctschema_ID IS NULL)
+          AND EXISTS (SELECT 1 FROM AD_Org_AcctSchema oa
+	     WHERE A_Asset_Group_Acct.C_AcctSchema_ID = oa.C_AcctSchema_ID
+	    AND (AD_IsOrgIncluded(oa.AD_Org_ID, A_Asset_Group_Acct.AD_Org_ID, A_Asset_Group_Acct.AD_Client_ID)<>-1
+	    OR AD_IsOrgIncluded(A_Asset_Group_Acct.AD_Org_ID, oa.AD_Org_ID, A_Asset_Group_Acct.AD_Client_ID)<>-1))
+      )
     LOOP
       -- Update existing Assets
       UPDATE A_Asset_Acct
--- a/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue May 31 11:58:53 2011 +0200
+++ b/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue May 31 12:11:06 2011 +0200
@@ -4213,6 +4213,27 @@
 <!--83BBC36B706642A39448DD2342B291F3-->  <AD_ELEMENT_ID><![CDATA[800632]]></AD_ELEMENT_ID>
 <!--83BBC36B706642A39448DD2342B291F3--></AD_PROCESS_PARA>
 
+<!--A49C24DB7D4E423183D1C18CA79F4861--><AD_PROCESS_PARA>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_PROCESS_PARA_ID><![CDATA[A49C24DB7D4E423183D1C18CA79F4861]]></AD_PROCESS_PARA_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <NAME><![CDATA[Accounting Schema]]></NAME>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <DESCRIPTION><![CDATA[The structure used in accounting including costing methods, currencies, and the calendar.]]></DESCRIPTION>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <HELP><![CDATA[An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar]]></HELP>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_PROCESS_ID><![CDATA[800136]]></AD_PROCESS_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_VAL_RULE_ID><![CDATA[FF8081812F06A183012F07323A2A001C]]></AD_VAL_RULE_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <COLUMNNAME><![CDATA[C_AcctSchema_ID]]></COLUMNNAME>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <DEFAULTVALUE><![CDATA[@C_AcctSchema_ID@]]></DEFAULTVALUE>
+<!--A49C24DB7D4E423183D1C18CA79F4861-->  <AD_ELEMENT_ID><![CDATA[181]]></AD_ELEMENT_ID>
+<!--A49C24DB7D4E423183D1C18CA79F4861--></AD_PROCESS_PARA>
+
 <!--A88B1DDE069E49BE9AE84717B088156D--><AD_PROCESS_PARA>
 <!--A88B1DDE069E49BE9AE84717B088156D-->  <AD_PROCESS_PARA_ID><![CDATA[A88B1DDE069E49BE9AE84717B088156D]]></AD_PROCESS_PARA_ID>
 <!--A88B1DDE069E49BE9AE84717B088156D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>