[open close period] Not allow to edit Period in a status that is
authorDavid Miguelez <david.miguelez@openbravo.com>
Wed, 20 Mar 2013 11:39:14 +0100
changeset 19985 e2c5698411c8
parent 19984 2b3788d009be
child 19986 01be4b3a3ea0
[open close period] Not allow to edit Period in a status that is
not Never Opened.
src-db/database/model/triggers/C_PERIOD_TRG2.xml
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/model/triggers/C_PERIOD_TRG2.xml	Tue Mar 19 17:06:12 2013 +0100
+++ b/src-db/database/model/triggers/C_PERIOD_TRG2.xml	Wed Mar 20 11:39:14 2013 +0100
@@ -26,6 +26,7 @@
     */
     v_DateNull DATE := TO_DATE('01-01-1900','DD-MM-YYYY');
     V_COUNT NUMBER:= 0;
+    V_NEVER_OPENED NUMBER;
 
 BEGIN
 
@@ -58,6 +59,27 @@
 		End If;
 	END IF;
    END IF;
+   
+   IF (UPDATING) THEN
+     IF((COALESCE(:OLD.STARTDATE, v_DateNull) <> COALESCE(:NEW.STARTDATE, v_DateNull))
+      OR (COALESCE(:OLD.ENDDATE, v_DateNull) <> COALESCE(:NEW.ENDDATE, v_DateNull))
+      OR (COALESCE(:OLD.PERIODNO, '0') <> COALESCE(:NEW.PERIODNO, '0'))
+      OR (COALESCE(:OLD.PERIODTYPE, '0') <> COALESCE(:NEW.PERIODTYPE, '0')))
+    THEN
+    
+      SELECT 1
+      INTO V_NEVER_OPENED
+      FROM DUAL
+      WHERE EXISTS (SELECT C_PERIODCONTROL_ID
+                    FROM C_PERIODCONTROL
+                    WHERE C_PERIOD_ID = COALESCE(:OLD.C_PERIOD_ID, :NEW.C_PERIOD_ID)
+                    AND PERIODSTATUS <> 'N');
+      IF (V_NEVER_OPENED IS NOT NULL) THEN
+        RAISE_APPLICATION_ERROR(-20000, '@PeriodAlreadyUsed@') ;
+      END IF;
+      
+    END IF;
+   END IF;
 
    IF DELETING THEN
         DELETE FROM C_PeriodControl_log
--- a/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Tue Mar 19 17:06:12 2013 +0100
+++ b/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Wed Mar 20 11:39:14 2013 +0100
@@ -555,9 +555,14 @@
 <!--800046-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--800046-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--800046-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--800046-->  <AD_TAB_ID><![CDATA[800117]]></AD_TAB_ID>
-<!--800046-->  <NAME><![CDATA[AD_Org_Forced]]></NAME>
-<!--800046-->  <CODE><![CDATA[@SQL=SELECT AD_ORG_ID FROM M_PRODUCTION WHERE M_PRODUCTION_ID = @M_PRODUCTION_ID@]]></CODE>
+<!--800046-->  <AD_TAB_ID><![CDATA[130]]></AD_TAB_ID>
+<!--800046-->  <NAME><![CDATA[C_Period_Not_Editable]]></NAME>
+<!--800046-->  <CODE><![CDATA[@SQL=SELECT 'Y'
+      FROM DUAL
+      WHERE EXISTS (SELECT C_PERIODCONTROL_ID
+                    FROM C_PERIODCONTROL
+                    WHERE C_PERIOD_ID =@C_PERIOD_ID@
+                    AND PERIODSTATUS <> 'N')]]></CODE>
 <!--800046-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800046--></AD_AUXILIARINPUT>
 
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Tue Mar 19 17:06:12 2013 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Mar 20 11:39:14 2013 +0100
@@ -6434,6 +6434,7 @@
 <!--484-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--484-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--484-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--484-->  <READONLYLOGIC><![CDATA[@C_Period_Not_Editable@='Y']]></READONLYLOGIC>
 <!--484-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--484-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--484-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -13818,6 +13819,7 @@
 <!--845-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--845-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--845-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--845-->  <READONLYLOGIC><![CDATA[@C_Period_Not_Editable@='Y']]></READONLYLOGIC>
 <!--845-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--845-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--845-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -13888,6 +13890,7 @@
 <!--847-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--847-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--847-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--847-->  <READONLYLOGIC><![CDATA[@C_Period_Not_Editable@='Y']]></READONLYLOGIC>
 <!--847-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--847-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
 <!--847-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -88676,6 +88679,7 @@
 <!--5943-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--5943-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
 <!--5943-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--5943-->  <READONLYLOGIC><![CDATA[@C_Period_Not_Editable@='Y']]></READONLYLOGIC>
 <!--5943-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--5943-->  <SEQNO><![CDATA[0]]></SEQNO>
 <!--5943-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Tue Mar 19 17:06:12 2013 +0100
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Mar 20 11:39:14 2013 +0100
@@ -7441,7 +7441,7 @@
 <!--481-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--481-->  <GRID_SEQNO><![CDATA[20]]></GRID_SEQNO>
 <!--481-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
-<!--481-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--481-->  <STARTNEWLINE><![CDATA[Y]]></STARTNEWLINE>
 <!--481-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--481-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--481--></AD_FIELD>
@@ -7460,14 +7460,14 @@
 <!--482-->  <AD_TAB_ID><![CDATA[130]]></AD_TAB_ID>
 <!--482-->  <AD_COLUMN_ID><![CDATA[840]]></AD_COLUMN_ID>
 <!--482-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
-<!--482-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--482-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--482-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--482-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--482-->  <SEQNO><![CDATA[60]]></SEQNO>
 <!--482-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--482-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--482-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
-<!--482-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--482-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
 <!--482-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
 <!--482-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--482-->  <GRID_SEQNO><![CDATA[60]]></GRID_SEQNO>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 19 17:06:12 2013 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Mar 20 11:39:14 2013 +0100
@@ -19883,6 +19883,17 @@
 <!--A8B0478C875F48B084292E54B8F6B72B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--A8B0478C875F48B084292E54B8F6B72B--></AD_MESSAGE>
 
+<!--A9185C7650FC4205AEEAFE6792593EC3--><AD_MESSAGE>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <AD_MESSAGE_ID><![CDATA[A9185C7650FC4205AEEAFE6792593EC3]]></AD_MESSAGE_ID>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <VALUE><![CDATA[PeriodAlreadyUsed]]></VALUE>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <MSGTEXT><![CDATA[Only Periods that have never been opened can be modified]]></MSGTEXT>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--A9185C7650FC4205AEEAFE6792593EC3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A9185C7650FC4205AEEAFE6792593EC3--></AD_MESSAGE>
+
 <!--A93D0507BFC54CA9ABEC60029F73E143--><AD_MESSAGE>
 <!--A93D0507BFC54CA9ABEC60029F73E143-->  <AD_MESSAGE_ID><![CDATA[A93D0507BFC54CA9ABEC60029F73E143]]></AD_MESSAGE_ID>
 <!--A93D0507BFC54CA9ABEC60029F73E143-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>