IDEMPIERE-42 - fixes Translation in MPaymentTerm exception in PaymentTermValidate
http://jira.idempiere.com/browse/IDEMPIERE-42
This commit is contained in:
parent
7157594458
commit
3ae076965e
|
@ -0,0 +1,13 @@
|
||||||
|
-- Jul 4, 2011 12:21:51 PM COT
|
||||||
|
-- IDEMPIERE-42 5Translation in MPaymentTerm exception in PaymentTermValidate
|
||||||
|
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53136,0,TO_DATE('2011-07-04 12:21:51','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Total','I',TO_DATE('2011-07-04 12:21:51','YYYY-MM-DD HH24:MI:SS'),100,'Total')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 4, 2011 12:21:51 PM COT
|
||||||
|
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=53136 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 4, 2011 12:21:54 PM COT
|
||||||
|
UPDATE AD_Message_Trl SET IsTranslated='Y',Updated=TO_DATE('2011-07-04 12:21:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=53136 AND AD_Language LIKE 'es_%'
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Jul 4, 2011 12:21:51 PM COT
|
||||||
|
-- IDEMPIERE-42 5Translation in MPaymentTerm exception in PaymentTermValidate
|
||||||
|
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53136,0,TO_TIMESTAMP('2011-07-04 12:21:51','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Total','I',TO_TIMESTAMP('2011-07-04 12:21:51','YYYY-MM-DD HH24:MI:SS'),100,'Total')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 4, 2011 12:21:51 PM COT
|
||||||
|
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=53136 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 4, 2011 12:21:54 PM COT
|
||||||
|
UPDATE AD_Message_Trl SET IsTranslated='Y',Updated=TO_TIMESTAMP('2011-07-04 12:21:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Message_ID=53136 AND AD_Language LIKE 'es_%'
|
||||||
|
;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.MPaymentTerm;
|
import org.compiere.model.MPaymentTerm;
|
||||||
import org.compiere.util.AdempiereUserError;
|
import org.compiere.util.AdempiereUserError;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate Payment Term and Schedule
|
* Validate Payment Term and Schedule
|
||||||
|
@ -57,7 +58,8 @@ public class PaymentTermValidate extends SvrProcess
|
||||||
String msg = pt.validate();
|
String msg = pt.validate();
|
||||||
pt.saveEx();
|
pt.saveEx();
|
||||||
//
|
//
|
||||||
if ("@OK@".equals(msg))
|
String validMsg = Msg.parseTranslation(getCtx(), "@OK@");
|
||||||
|
if (validMsg.equals(msg))
|
||||||
return msg;
|
return msg;
|
||||||
throw new AdempiereUserError (msg);
|
throw new AdempiereUserError (msg);
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
|
@ -137,12 +137,13 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
||||||
*/
|
*/
|
||||||
public String validate()
|
public String validate()
|
||||||
{
|
{
|
||||||
|
String validMsg = Msg.parseTranslation(getCtx(), "@OK@");
|
||||||
getSchedule(true);
|
getSchedule(true);
|
||||||
if (m_schedule.length == 0)
|
if (m_schedule.length == 0)
|
||||||
{
|
{
|
||||||
if (! isValid())
|
if (! isValid())
|
||||||
setIsValid(true);
|
setIsValid(true);
|
||||||
return "@OK@";
|
return validMsg;
|
||||||
}
|
}
|
||||||
// Allow schedules with just one record
|
// Allow schedules with just one record
|
||||||
// if (m_schedule.length == 1)
|
// if (m_schedule.length == 1)
|
||||||
|
@ -175,10 +176,9 @@ public class MPaymentTerm extends X_C_PaymentTerm
|
||||||
m_schedule[i].saveEx();
|
m_schedule[i].saveEx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String msg = "@OK@";
|
if (valid)
|
||||||
if (!valid)
|
return validMsg;
|
||||||
msg = "@Total@ = " + total + " - @Difference@ = " + HUNDRED.subtract(total);
|
return "@Total@ = " + total + " - @Difference@ = " + HUNDRED.subtract(total);
|
||||||
return Msg.parseTranslation(getCtx(), msg);
|
|
||||||
} // validate
|
} // validate
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue