From e4c946215b98b484624d3f1017de66e8ba747fa9 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 6 Dec 2012 17:58:53 -0500 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-207=20GL=20Journal=20Generator=20/=20?= =?UTF-8?q?Improve=20error=20messages=20(thanks=20to=20David=20Pe=C3=B1uel?= =?UTF-8?q?a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/org/globalqss/process/GLJournalGenerate.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java index f5ff17f00c..1ca397d1a5 100644 --- a/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java +++ b/org.adempiere.base/src/org/globalqss/process/GLJournalGenerate.java @@ -55,6 +55,8 @@ import org.compiere.process.SvrProcess; import org.compiere.report.MReportTree; import org.compiere.util.DB; import org.compiere.util.Env; +import org.compiere.util.Language; +import org.compiere.util.Msg; /** * GL Journal Generator @@ -410,6 +412,9 @@ public class GLJournalGenerate extends SvrProcess j.setAD_Org_ID(journalGenerator.getAD_Org_ID()); else j.setAD_Org_ID(Env.getAD_Org_ID(getCtx())); + if (j.getAD_Org_ID() == 0) { + throw new AdempiereException(Msg.getMsg(Language.getBaseAD_Language(), "Org0NotAllowed")); + } j.setC_Currency_ID(as.getC_Currency_ID()); j.setC_DocType_ID(journalGenerator.getC_DocType_ID()); j.setControlAmt(Env.ZERO); @@ -512,11 +517,14 @@ public class GLJournalGenerate extends SvrProcess if (j != null && p_DocAction != null) { // DocAction if (!j.processIt(p_DocAction)) - throw new AdempiereException("Could not " + p_DocAction + " journal"); + throw new AdempiereException("Couldn't set docAction: " + p_DocAction + ((org.compiere.process.DocAction) j).getProcessMsg()+ " journal"); j.saveEx(); } + + StringBuilder msg = new StringBuilder(Msg.parseTranslation(getCtx(), "@Created@ @GL_Journal_ID@=")).append(j.getDocumentNo()); + addLog(j.get_ID(), null, null, msg.toString(), MJournal.Table_ID, j.get_ID()); - return "@OK@" + (j != null ? " @Created@ @GL_Journal_ID@=" + j.getDocumentNo() : ""); + return "@OK@"; } // doIt private BigDecimal applyMultiplierAndFactor(BigDecimal sourceAmt, BigDecimal amtMultiplier, int roundFactor) {