Fixes issue 26833 Cannot change goods shipments / receipts if there are lines
authorRafa Roda Palacios <rafa.roda@ubiquads.com>
Tue, 26 Aug 2014 15:47:51 +0200
changeset 24336 7b37c370246d
parent 24335 c22e6843737d
child 24337 976a64153145
child 24338 b0e6e54d6a80
Fixes issue 26833 Cannot change goods shipments / receipts if there are lines
src-db/database/model/triggers/M_INOUT_CHK_RESTRICTIONS_TRG.xml
src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/model/triggers/M_INOUT_CHK_RESTRICTIONS_TRG.xml	Tue Aug 26 15:14:14 2014 +0000
+++ b/src-db/database/model/triggers/M_INOUT_CHK_RESTRICTIONS_TRG.xml	Tue Aug 26 15:47:51 2014 +0200
@@ -18,12 +18,13 @@
     * under the License.
     * The Original Code is Openbravo ERP.
     * The Initial Developer of the Original Code is Openbravo SLU
-    * All portions are Copyright (C) 2001-2012 Openbravo SLU
+    * All portions are Copyright (C) 2001-2014 Openbravo SLU
     * All Rights Reserved.
     * Contributor(s):  ______________________________________.
     ************************************************************************/
 
   v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
+  v_n NUMBER;
 
      
 BEGIN
@@ -68,6 +69,16 @@
       OR(COALESCE(:old.USER2_ID, '0') <> COALESCE(:new.USER2_ID, '0')))) THEN
       RAISE_APPLICATION_ERROR(-20000, '@20501@') ;
     END IF;
+    IF (COALESCE(:OLD.C_BPartner_ID, '0')!=COALESCE(:NEW.C_BPartner_ID, '0')) THEN
+      SELECT COUNT(*)
+        INTO v_n
+        FROM M_INOUTLINE
+       WHERE M_Inout_ID = :NEW.M_Inout_ID;
+
+       IF v_n>0 THEN
+         RAISE_APPLICATION_ERROR(-20000, '@20552@') ;
+       END IF;
+     END IF;
   END IF;
   IF(DELETING) THEN
     IF(:old.Processed='Y') THEN
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Aug 26 15:14:14 2014 +0000
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Aug 26 15:47:51 2014 +0200
@@ -19796,6 +19796,18 @@
 <!--657E957FEC7243E7AD58A2A009292C26-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--657E957FEC7243E7AD58A2A009292C26--></AD_MESSAGE>
 
+<!--65C05BD368ED471CB1E6AE97DD911EDF--><AD_MESSAGE>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <AD_MESSAGE_ID><![CDATA[65C05BD368ED471CB1E6AE97DD911EDF]]></AD_MESSAGE_ID>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <VALUE><![CDATA[20552]]></VALUE>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <MSGTEXT><![CDATA[Cannot change business partner if there are lines.]]></MSGTEXT>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--65C05BD368ED471CB1E6AE97DD911EDF-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--65C05BD368ED471CB1E6AE97DD911EDF--></AD_MESSAGE>
+
 <!--66BEE4A0FBD44C96B2967716918A1318--><AD_MESSAGE>
 <!--66BEE4A0FBD44C96B2967716918A1318-->  <AD_MESSAGE_ID><![CDATA[66BEE4A0FBD44C96B2967716918A1318]]></AD_MESSAGE_ID>
 <!--66BEE4A0FBD44C96B2967716918A1318-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>