From 055b35109989bcc6a6afd1b7cfae9520d7e38a28 Mon Sep 17 00:00:00 2001 From: redchris Date: Wed, 18 Nov 2009 11:32:41 +0000 Subject: [PATCH] BF [ 2889886 ] Net days in payment term https://sourceforge.net/tracker/index.php?func=detail&aid=2889886&group_id=176962&atid=879332 Please review --- base/src/org/compiere/model/MPaymentTerm.java | 10 ++++++++++ .../603_BF2889886_Net_days_in_payment_term.sql | 12 ++++++++++++ .../603_BF2889886_Net_days_in_payment_term.sql | 12 ++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 migration/354a-trunk/oracle/603_BF2889886_Net_days_in_payment_term.sql create mode 100644 migration/354a-trunk/postgresql/603_BF2889886_Net_days_in_payment_term.sql diff --git a/base/src/org/compiere/model/MPaymentTerm.java b/base/src/org/compiere/model/MPaymentTerm.java index ddf9df97ca..e01b837762 100644 --- a/base/src/org/compiere/model/MPaymentTerm.java +++ b/base/src/org/compiere/model/MPaymentTerm.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -33,6 +34,9 @@ import org.compiere.util.Msg; * * @author Jorg Janke * @version $Id: MPaymentTerm.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ + * @author Cristina Ghita, www.arhipac.ro + *
  • BF [ 2889886 ] Net days in payment term + * https://sourceforge.net/tracker/index.php?func=detail&aid=2889886&group_id=176962&atid=879332 */ public class MPaymentTerm extends X_C_PaymentTerm { @@ -312,6 +316,12 @@ public class MPaymentTerm extends X_C_PaymentTerm } } + if (Integer.signum(getNetDays()) < 0) + { + throw new AdempiereException(Msg.parseTranslation(getCtx(), "@NetDays@") + " " + + Msg.parseTranslation(getCtx(), "@positive.number@")); + } + if (!newRecord || !isValid()) validate(); return true; diff --git a/migration/354a-trunk/oracle/603_BF2889886_Net_days_in_payment_term.sql b/migration/354a-trunk/oracle/603_BF2889886_Net_days_in_payment_term.sql new file mode 100644 index 0000000000..e114d05b2b --- /dev/null +++ b/migration/354a-trunk/oracle/603_BF2889886_Net_days_in_payment_term.sql @@ -0,0 +1,12 @@ +-- Nov 18, 2009 11:28:06 AM EET +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,MsgTip,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('I','Must be a positive number!',0,'Y',TO_DATE('2009-11-18 11:28:01','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-11-18 11:28:01','YYYY-MM-DD HH24:MI:SS'),0,' ',0,0,'D','positive.number',53090) +; + +-- Nov 18, 2009 11:28:06 AM EET +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53090 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- Nov 18, 2009 11:28:34 AM EET +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Trebuie sa fie numar pozitiv!',Updated=TO_DATE('2009-11-18 11:28:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53090 AND AD_Language='ro_RO' +; + diff --git a/migration/354a-trunk/postgresql/603_BF2889886_Net_days_in_payment_term.sql b/migration/354a-trunk/postgresql/603_BF2889886_Net_days_in_payment_term.sql new file mode 100644 index 0000000000..a33dbb9796 --- /dev/null +++ b/migration/354a-trunk/postgresql/603_BF2889886_Net_days_in_payment_term.sql @@ -0,0 +1,12 @@ +-- Nov 18, 2009 11:28:06 AM EET +INSERT INTO AD_Message (MsgType,MsgText,CreatedBy,IsActive,Created,Updated,UpdatedBy,MsgTip,AD_Client_ID,AD_Org_ID,EntityType,Value,AD_Message_ID) VALUES ('I','Must be a positive number!',0,'Y',TO_TIMESTAMP('2009-11-18 11:28:01','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-11-18 11:28:01','YYYY-MM-DD HH24:MI:SS'),0,' ',0,0,'D','positive.number',53090) +; + +-- Nov 18, 2009 11:28:06 AM EET +INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53090 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID) +; + +-- Nov 18, 2009 11:28:34 AM EET +UPDATE AD_Message_Trl SET IsTranslated='Y',MsgText='Trebuie sa fie numar pozitiv!',Updated=TO_TIMESTAMP('2009-11-18 11:28:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Message_ID=53090 AND AD_Language='ro_RO' +; +