Rollbacks previous two commits
authorPandeeswari Ramakrishnan <pandeeswari.ramakrishnan@openbravo.com>
Thu, 20 Sep 2012 11:50:46 +0200
changeset 18806 3649e55d90c1
parent 18805 8b84f4786ba6
child 18807 0c021a2f2c49
Rollbacks previous two commits
src-db/database/model/functions/C_INVOICE_POST.xml
src-db/database/model/functions/C_ORDER_POST1.xml
src-db/database/model/functions/M_INOUT_POST.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
--- a/src-db/database/model/functions/C_INVOICE_POST.xml	Tue Apr 24 11:17:02 2012 +0200
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Thu Sep 20 11:50:46 2012 +0200
@@ -441,16 +441,11 @@
     END;--FOR  COMMIT
     BEGIN -- FOR COMMIT
 
-      SELECT COUNT(*)
-        INTO v_Count
-      FROM C_INVOICE I, C_INVOICELINE IL
-      WHERE I.C_INVOICE_ID = IL.C_INVOICE_ID
-        AND AD_ISORGINCLUDED(IL.AD_Org_ID, I.AD_Org_ID, I.AD_Client_ID) <> -1
-        AND I.C_INVOICE_ID = v_Record_ID;
-      IF (v_Count=0) THEN
-        RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgLines@') ;
-      END IF;
-
+      -- Set org lines like the headear
+      UPDATE C_INVOICELINE
+      SET AD_ORG_ID = (SELECT AD_ORG_ID FROM C_INVOICE WHERE C_INVOICE_ID = v_Record_ID),Updated=now(),
+          UpdatedBy=v_UpdatedBy
+      WHERE C_INVOICE_ID = v_Record_ID;
 
       SELECT COUNT(*) INTO v_Count
       FROM C_INVOICE C,
@@ -1259,7 +1254,12 @@
     SET AD_Client_ID=v_Client_ID
     WHERE C_Invoice_ID=v_Record_ID
       AND AD_Client_ID<>v_Client_ID;
-
+    v_ResultStr:='SyncOwnershipOrg';
+    UPDATE C_INVOICELINE
+    SET AD_Org_ID=v_Org_ID
+    WHERE C_Invoice_ID=v_Record_ID
+      AND C_Charge_ID IS NULL -- sync for products
+      AND AD_Org_ID<>v_Org_ID;
   END IF;--FINISH_PROCESS
   IF (NOT FINISH_PROCESS AND NOT END_PROCESSING) THEN
     /**************************************************************************
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Tue Apr 24 11:17:02 2012 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Thu Sep 20 11:50:46 2012 +0200
@@ -409,16 +409,10 @@
         RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgDoctypeOrder@') ;
       END IF;
 
-      SELECT COUNT(*)
-        INTO v_Count
-      FROM C_ORDER C, C_ORDERLINE OL
-      WHERE C.C_ORDER_ID = OL.C_ORDER_ID
-        AND AD_ISORGINCLUDED(OL.AD_Org_ID, C.AD_Org_ID, C.AD_Client_ID) <> -1
-        AND C.C_ORDER_ID = v_Record_ID;
-      IF (v_Count=0) THEN
-        RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgLines@') ;
-      END IF;
-      
+      -- Set org lines like the headear
+      UPDATE C_ORDERLINE
+      SET AD_ORG_ID = (SELECT AD_ORG_ID FROM C_ORDER WHERE C_ORDER_ID = v_Record_ID)
+      WHERE C_ORDER_ID = v_Record_ID;
 
       /**
       * Close Order - prepare
@@ -1021,9 +1015,10 @@
       END; -- Calculate Tax and Totals
       -- Synchronize Client/Org Ownership
       UPDATE C_ORDERLINE
-      SET AD_Client_ID=v_Client_ID
+      SET AD_Client_ID=v_Client_ID,
+          AD_Org_ID=v_Org_ID
       WHERE C_Order_ID=v_Record_ID
-        AND (AD_Client_ID<>v_Client_ID) ;
+        AND (AD_Client_ID<>v_Client_ID OR AD_Org_ID<>v_Org_ID) ;
 
     /**************************************************************************
      * Order Complete:5 - Something to do:6
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Tue Apr 24 11:17:02 2012 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Thu Sep 20 11:50:46 2012 +0200
@@ -224,15 +224,12 @@
     END IF;
         -- Process Shipments
   
-      SELECT COUNT(*)
-        INTO v_Count
-      FROM M_INOUT IO, M_INOUTLINE IOL
-      WHERE IO.M_INOUT_ID = IOL.M_INOUT_ID
-        AND AD_ISORGINCLUDED(IOL.AD_Org_ID, IO.AD_Org_ID, IO.AD_Client_ID) <> -1
-        AND IO.M_INOUT_ID = v_Record_ID;
-      IF (v_Count=0) THEN
-        RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgLines@') ;
-      END IF;
+     -- Set org lines like the header
+       UPDATE M_INOUTLINE
+        SET AD_ORG_ID = (SELECT AD_ORG_ID FROM M_INOUT WHERE M_INOUT_ID = v_Record_ID),
+        Updated=now(),
+        UpdatedBy=v_User
+      WHERE M_INOUT_ID = v_Record_ID;
       
       -- Check the header belongs to a organization where transactions are posible and ready to use
       SELECT AD_Org.IsReady, Ad_OrgType.IsTransactionsAllowed
--- a/src-db/database/sourcedata/AD_FIELD.xml	Tue Apr 24 11:17:02 2012 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Thu Sep 20 11:50:46 2012 +0200
@@ -22639,8 +22639,7 @@
 <!--2053-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2053-->  <AD_TAB_ID><![CDATA[187]]></AD_TAB_ID>
 <!--2053-->  <AD_COLUMN_ID><![CDATA[2207]]></AD_COLUMN_ID>
-<!--2053-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--2053-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--2053-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--2053-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--2053-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--2053-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
@@ -32743,8 +32742,7 @@
 <!--2712-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2712-->  <AD_TAB_ID><![CDATA[258]]></AD_TAB_ID>
 <!--2712-->  <AD_COLUMN_ID><![CDATA[3531]]></AD_COLUMN_ID>
-<!--2712-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--2712-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--2712-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--2712-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--2712-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--2712-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
@@ -36224,8 +36222,7 @@
 <!--2983-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2983-->  <AD_TAB_ID><![CDATA[270]]></AD_TAB_ID>
 <!--2983-->  <AD_COLUMN_ID><![CDATA[3830]]></AD_COLUMN_ID>
-<!--2983-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--2983-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--2983-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--2983-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--2983-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--2983-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
@@ -41058,8 +41055,7 @@
 <!--3359-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--3359-->  <AD_TAB_ID><![CDATA[291]]></AD_TAB_ID>
 <!--3359-->  <AD_COLUMN_ID><![CDATA[3830]]></AD_COLUMN_ID>
-<!--3359-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--3359-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--3359-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--3359-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--3359-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--3359-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
@@ -42345,8 +42341,7 @@
 <!--3409-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--3409-->  <AD_TAB_ID><![CDATA[293]]></AD_TAB_ID>
 <!--3409-->  <AD_COLUMN_ID><![CDATA[2207]]></AD_COLUMN_ID>
-<!--3409-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--3409-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--3409-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--3409-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--3409-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--3409-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
@@ -44921,8 +44916,7 @@
 <!--3509-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--3509-->  <AD_TAB_ID><![CDATA[297]]></AD_TAB_ID>
 <!--3509-->  <AD_COLUMN_ID><![CDATA[3531]]></AD_COLUMN_ID>
-<!--3509-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
-<!--3509-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--3509-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--3509-->  <DISPLAYLENGTH><![CDATA[44]]></DISPLAYLENGTH>
 <!--3509-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--3509-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Apr 24 11:17:02 2012 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Sep 20 11:50:46 2012 +0200
@@ -14552,17 +14552,6 @@
 <!--07E963D65B7F47BE81150448C5019E0D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--07E963D65B7F47BE81150448C5019E0D--></AD_MESSAGE>
 
-<!--0BA839D8B467422AB19C8E1B3B033051--><AD_MESSAGE>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <AD_MESSAGE_ID><![CDATA[0BA839D8B467422AB19C8E1B3B033051]]></AD_MESSAGE_ID>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <VALUE><![CDATA[NotCorrectOrgLines]]></VALUE>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <MSGTEXT><![CDATA[The organization of the  lines  is different and does not depend on the organization associated with the header.]]></MSGTEXT>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
-<!--0BA839D8B467422AB19C8E1B3B033051-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--0BA839D8B467422AB19C8E1B3B033051--></AD_MESSAGE>
-
 <!--0C093B834C3948E1B8D84E54FC6B284E--><AD_MESSAGE>
 <!--0C093B834C3948E1B8D84E54FC6B284E-->  <AD_MESSAGE_ID><![CDATA[0C093B834C3948E1B8D84E54FC6B284E]]></AD_MESSAGE_ID>
 <!--0C093B834C3948E1B8D84E54FC6B284E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java	Tue Apr 24 11:17:02 2012 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java	Thu Sep 20 11:50:46 2012 +0200
@@ -1529,9 +1529,9 @@
                 data[i].id));
             LineNetAmt = LineNetAmt.setScale(curPrecision, BigDecimal.ROUND_HALF_UP);
             try {
-              //final String strOrg2 = vars.getGlobalVariable("inpadOrgId", "CreateFrom|adOrgId", "");
+              final String strOrg2 = vars.getGlobalVariable("inpadOrgId", "CreateFrom|adOrgId", "");
               CreateFromInvoiceData.insert(conn, this, strSequence, strKey, vars.getClient(),
-            		  data[i].adOrgId, vars.getUser(), data[i].cOrderlineId, data[i].mInoutlineId,
+                  strOrg2, vars.getUser(), data[i].cOrderlineId, data[i].mInoutlineId,
                   data[i].description, data[i].mProductId, data[i].cUomId, data[i].id, priceList,
                   priceActual, priceLimit, LineNetAmt.toString(), C_Tax_ID, data[i].quantityorder,
                   data[i].mProductUomId, data[i].mAttributesetinstanceId, priceStd,