details: /erp/devel/pi/rev/c3569eb5762a
changeset: 11302:c3569eb5762a
user: Ainhoa Pagola <ainhoa.pagola <at> openbravo.com>
date: Thu Mar 17 10:33:26 2011 +0100
summary: Fixes issue 0015570. Periods can be deleted.
diffstat:
src-db/database/model/triggers/C_PERIOD_TRG2.xml | 25 ++++++++++++++++++-----
src-db/database/sourcedata/AD_MESSAGE.xml | 11 ++++++++++
2 files changed, 30 insertions(+), 6 deletions(-)
diffs (70 lines):
diff -r 145749e3f704 -r c3569eb5762a
src-db/database/model/triggers/C_PERIOD_TRG2.xml
--- a/src-db/database/model/triggers/C_PERIOD_TRG2.xml Fri Mar 18 11:33:49
2011 +0100
+++ b/src-db/database/model/triggers/C_PERIOD_TRG2.xml Thu Mar 17 10:33:26
2011 +0100
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<database name="TRIGGER C_PERIOD_TRG2">
- <trigger name="C_PERIOD_TRG2" table="C_PERIOD" fires="before"
insert="true" update="true" delete="false" foreach="row">
+ <trigger name="C_PERIOD_TRG2" table="C_PERIOD" fires="before"
insert="true" update="true" delete="true" foreach="row">
<body><![CDATA[
/*************************************************************************
* The contents of this file are subject to the Compiere Public
@@ -17,7 +17,7 @@
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
* All Rights Reserved.
* Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.U.
+ * Contributions are Copyright (C) 2001-2011 Openbravo, S.L.U.
*
* Specifically, this derivative work is based upon the following Compiere
* file and version.
@@ -36,11 +36,23 @@
IF(UPDATING) THEN
IF NOT((COALESCE(:old.StartDate, v_DateNull) <> COALESCE(:NEW.StartDate,
v_DateNull))) THEN
- RETURN;
- END IF;
- END IF;
--- UPDATE C_Period SET EndDate= ADD_MONTHS(TRUNC(StartDate, 'MM'), 1) -1;
- :new.EndDate:= ADD_MONTHS(TRUNC(:new.StartDate, 'MM'), 1) -1;
+ RETURN;
+ END IF;
+ :new.EndDate:= ADD_MONTHS(TRUNC(:new.StartDate, 'MM'), 1) -1;
+ END IF;
+
+ IF(INSERTING) THEN
+ :new.EndDate:= ADD_MONTHS(TRUNC(:new.StartDate, 'MM'), 1) -1;
+ END IF;
+
+ IF DELETING THEN
+ DELETE FROM C_PeriodControl_log
+ WHERE periodno=:old.C_Period_ID;
+
+ DELETE FROM C_PeriodControl
+ WHERE C_Period_ID=:old.C_Period_ID;
+ END IF;
+
END C_PERIOD_TRG2
]]></body>
</trigger>
diff -r 145749e3f704 -r c3569eb5762a src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Fri Mar 18 11:33:49 2011 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Thu Mar 17 10:33:26 2011 +0100
@@ -32049,6 +32049,17 @@
<!--81AE8943B83A4BFA92ACB6BA2F7FC4A8-->
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
<!--81AE8943B83A4BFA92ACB6BA2F7FC4A8--></AD_MESSAGE>
+<!--81B47DEBF9E94A369C4629562A90A2B2--><AD_MESSAGE>
+<!--81B47DEBF9E94A369C4629562A90A2B2-->
<AD_MESSAGE_ID><![CDATA[81B47DEBF9E94A369C4629562A90A2B2]]></AD_MESSAGE_ID>
+<!--81B47DEBF9E94A369C4629562A90A2B2-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--81B47DEBF9E94A369C4629562A90A2B2--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--81B47DEBF9E94A369C4629562A90A2B2--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--81B47DEBF9E94A369C4629562A90A2B2-->
<VALUE><![CDATA[FACT_ACCT_C_PERIOD]]></VALUE>
+<!--81B47DEBF9E94A369C4629562A90A2B2--> <MSGTEXT><![CDATA[This record cannot
be deleted because it is associated with other existing elements. Please see
Linked Items]]></MSGTEXT>
+<!--81B47DEBF9E94A369C4629562A90A2B2--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--81B47DEBF9E94A369C4629562A90A2B2-->
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--81B47DEBF9E94A369C4629562A90A2B2--></AD_MESSAGE>
+
<!--82C113B8F4134B57A4791BAC35B03ADC--><AD_MESSAGE>
<!--82C113B8F4134B57A4791BAC35B03ADC-->
<AD_MESSAGE_ID><![CDATA[82C113B8F4134B57A4791BAC35B03ADC]]></AD_MESSAGE_ID>
<!--82C113B8F4134B57A4791BAC35B03ADC-->
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits