IDEMPIERE-4078 cph::erp Doc messages translation

This commit is contained in:
sjeffen 2019-12-11 15:49:01 +01:00 committed by Carlos Ruiz
parent 2099a8b1cb
commit 3a6b25ddec
3 changed files with 33 additions and 8 deletions

View File

@ -0,0 +1,11 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- CPH::ERP Comments:
-- 26. okt. 2019 14.51.26 CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Period Open',0,0,'Y',TO_DATE('2019-10-26 14:51:25','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-10-26 14:51:25','YYYY-MM-DD HH24:MI:SS'),100,200580,'PeriodOpen','D','cb274239-00ed-4a7f-b508-4a00436e6d70')
;
SELECT register_migration_script('201912111530_IDEMPIERE-4078.sql') FROM dual
;

View File

@ -0,0 +1,8 @@
-- CPH::ERP Comments:
-- 26. okt. 2019 14.51.26 CEST
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Period Open',0,0,'Y',TO_TIMESTAMP('2019-10-26 14:51:25','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-10-26 14:51:25','YYYY-MM-DD HH24:MI:SS'),100,200580,'PeriodOpen','D','cb274239-00ed-4a7f-b508-4a00436e6d70')
;
SELECT register_migration_script('201912111530_IDEMPIERE-4078.sql') FROM dual
;

View File

@ -22,6 +22,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@ -45,6 +47,7 @@ import org.compiere.model.MMatchInv;
import org.compiere.model.MMatchPO;
import org.compiere.model.MNote;
import org.compiere.model.MPeriod;
import org.compiere.model.MRefList;
import org.compiere.model.ModelValidationEngine;
import org.compiere.model.ModelValidator;
import org.compiere.model.PO;
@ -52,6 +55,7 @@ import org.compiere.process.DocumentEngine;
import org.compiere.util.AdempiereUserError;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
@ -653,6 +657,8 @@ public abstract class Doc
if (!p_Status.equals(STATUS_Posted) && !p_Status.equals(STATUS_Deferred))
{
// Insert Note
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
DecimalFormat numberFormat = DisplayType.getNumberFormat(DisplayType.Amount);
String AD_MessageValue = "PostingError-" + p_Status;
int AD_User_ID = p_po.getUpdatedBy();
MNote note = new MNote (getCtx(), AD_MessageValue, AD_User_ID,
@ -666,14 +672,14 @@ public abstract class Doc
Text.append(" (").append(p_Error).append(")");
String cn = getClass().getName();
Text.append(" - ").append(cn.substring(cn.lastIndexOf('.')))
.append(" (").append(getDocumentType())
.append(" - DocumentNo=").append(getDocumentNo())
.append(", DateAcct=").append(getDateAcct().toString().substring(0,10))
.append(", Amount=").append(getAmount())
.append(", Sta=").append(p_Status)
.append(" - PeriodOpen=").append(isPeriodOpen())
.append(", Balanced=").append(isBalanced())
.append(", Schema=").append(m_as.getName());
.append(" (").append(getDocumentType())
.append(" - " + Msg.getElement(Env.getCtx(),"DocumentNo") + "=").append(getDocumentNo())
.append(" - " + Msg.getElement(Env.getCtx(),"DateAcct") + "=").append(dateFormat.format(getDateAcct()))
.append(" - " + Msg.getMsg(Env.getCtx(),"Amount") + "=").append(numberFormat.format(getAmount()))
.append(" - " + Msg.getElement(Env.getCtx(),"DocStatus") + "=").append(MRefList.getListName(getCtx(), 131, m_DocStatus))
.append(" - " + Msg.getMsg(Env.getCtx(),"PeriodOpen") + "=").append(Msg.getMsg(Env.getCtx(), String.valueOf(isPeriodOpen())))
.append(" - " + Msg.getElement(Env.getCtx(),"IsBalanced") + "=").append( Msg.getMsg(Env.getCtx(), String.valueOf(isBalanced())))
.append(" - " + Msg.getElement(Env.getCtx(),"C_AcctSchema_ID") + "=").append(m_as.getName());
note.setTextMsg(Text.toString());
note.saveEx();
p_Error = Text.toString();