Fixes issue 20654: Should not be possible to create several periods for same date range in different years
authorJavier Etxarri <javier.echarri@openbravo.com>
Thu, 31 May 2012 11:30:47 +0200
changeset 9867 55c5e981efd3
parent 9866 6398e356f509
child 9868 e98b36a3ad92
Fixes issue 20654: Should not be possible to create several periods for same date range in different years
src-db/database/model/triggers/C_PERIOD_TRG2.xml
src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/model/triggers/C_PERIOD_TRG2.xml	Mon Apr 16 16:20:47 2012 +0000
+++ b/src-db/database/model/triggers/C_PERIOD_TRG2.xml	Thu May 31 11:30:47 2012 +0200
@@ -52,7 +52,12 @@
 		IF (:NEW.STARTDATE > :NEW.ENDDATE) THEN
 			RAISE_APPLICATION_ERROR(-20000, '@DatesWrong@');
 		END IF;
-		SELECT COUNT(*) INTO V_COUNT FROM C_PERIOD WHERE C_PERIOD_ID <> :NEW.C_PERIOD_ID AND C_YEAR_ID = :NEW.C_YEAR_ID AND :NEW.STARTDATE <= ENDDATE AND :NEW.ENDDATE >= STARTDATE;
+		SELECT COUNT(*) INTO V_COUNT 
+		FROM C_PERIOD 
+		WHERE C_PERIOD_ID <> :NEW.C_PERIOD_ID 
+			AND AD_ORG_ID = :NEW.AD_ORG_ID
+			AND :NEW.STARTDATE <= ENDDATE 
+			AND :NEW.ENDDATE >= STARTDATE;
 		IF (V_COUNT > 0) THEN
 			RAISE_APPLICATION_ERROR(-20000, '@DatesOverlapped@');
 		END IF;
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Apr 16 16:20:47 2012 +0000
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Thu May 31 11:30:47 2012 +0200
@@ -29868,7 +29868,7 @@
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <VALUE><![CDATA[DatesOverlapped]]></VALUE>
-<!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <MSGTEXT><![CDATA[The dates period defined is overlapped with another period of the same year.]]></MSGTEXT>
+<!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <MSGTEXT><![CDATA[Saving failed. The dates period defined is overlapped with another period of an existing year.]]></MSGTEXT>
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--0FF0EC6915A04F4EA5FB2FD09DA82F14--></AD_MESSAGE>