IDEMPIERE-308 Performance: Replace with StringBuilder / revert model classes affected by StringBuffer(null) raising NPE

This commit is contained in:
Carlos Ruiz 2012-10-02 11:41:11 -05:00
parent b8af84eb25
commit c37aea6dfb
8 changed files with 407 additions and 458 deletions

View File

@ -148,10 +148,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgsd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgsd.toString());
}
} // addDescription } // addDescription
/** /**
@ -164,10 +162,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
StringBuilder sql = new StringBuilder("UPDATE C_BankStatementLine SET Processed='") String sql = "UPDATE C_BankStatementLine SET Processed='"
.append((processed ? "Y" : "N")) + (processed ? "Y" : "N")
.append("' WHERE C_BankStatement_ID=").append(getC_BankStatement_ID()); + "' WHERE C_BankStatement_ID=" + getC_BankStatement_ID();
int noLine = DB.executeUpdate(sql.toString(), get_TrxName()); int noLine = DB.executeUpdate(sql, get_TrxName());
m_lines = null; m_lines = null;
log.fine("setProcessed - " + processed + " - Lines=" + noLine); log.fine("setProcessed - " + processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
@ -196,8 +194,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/ */
public String getDocumentInfo() public String getDocumentInfo()
{ {
StringBuilder msgreturn = new StringBuilder(getBankAccount().getName()).append(" ").append(getDocumentNo()); return getBankAccount().getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -208,8 +205,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -263,7 +259,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
} // processIt } // processIt
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -296,7 +292,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer( ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -305,7 +301,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MBankStatementLine[] lines = getLines(true); MBankStatementLine[] lines = getLines(true);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Lines // Lines
@ -326,7 +322,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, 0); MPeriod.testPeriodOpen(getCtx(), minDate, MDocType.DOCBASETYPE_BankStatement, 0);
MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, 0); MPeriod.testPeriodOpen(getCtx(), maxDate, MDocType.DOCBASETYPE_BankStatement, 0);
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -373,7 +369,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -405,7 +401,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// //
@ -422,7 +418,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -430,7 +426,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return false; return false;
} }
@ -464,16 +460,16 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MBankStatementLine line = lines[i]; MBankStatementLine line = lines[i];
if (line.getStmtAmt().compareTo(Env.ZERO) != 0) if (line.getStmtAmt().compareTo(Env.ZERO) != 0)
{ {
StringBuilder description = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (") String description = Msg.getMsg(getCtx(), "Voided") + " ("
.append(Msg.translate(getCtx(), "StmtAmt")).append("=").append(line.getStmtAmt()); + Msg.translate(getCtx(), "StmtAmt") + "=" + line.getStmtAmt();
if (line.getTrxAmt().compareTo(Env.ZERO) != 0) if (line.getTrxAmt().compareTo(Env.ZERO) != 0)
description.append(", ").append(Msg.translate(getCtx(), "TrxAmt")).append("=").append(line.getTrxAmt()); description += ", " + Msg.translate(getCtx(), "TrxAmt") + "=" + line.getTrxAmt();
if (line.getChargeAmt().compareTo(Env.ZERO) != 0) if (line.getChargeAmt().compareTo(Env.ZERO) != 0)
description.append(", ").append(Msg.translate(getCtx(), "ChargeAmt")).append("=").append(line.getChargeAmt()); description += ", " + Msg.translate(getCtx(), "ChargeAmt") + "=" + line.getChargeAmt();
if (line.getInterestAmt().compareTo(Env.ZERO) != 0) if (line.getInterestAmt().compareTo(Env.ZERO) != 0)
description.append(", ").append(Msg.translate(getCtx(), "InterestAmt")).append("=").append(line.getInterestAmt()); description += ", " + Msg.translate(getCtx(), "InterestAmt") + "=" + line.getInterestAmt();
description.append(")"); description += ")";
line.addDescription(description.toString()); line.addDescription(description);
// //
line.setStmtAmt(Env.ZERO); line.setStmtAmt(Env.ZERO);
line.setTrxAmt(Env.ZERO); line.setTrxAmt(Env.ZERO);
@ -493,7 +489,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
setStatementDifference(Env.ZERO); setStatementDifference(Env.ZERO);
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -510,14 +506,14 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
log.info("closeIt - " + toString()); log.info("closeIt - " + toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
@ -531,12 +527,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
log.info("reverseCorrectIt - " + toString()); log.info("reverseCorrectIt - " + toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -551,12 +547,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
log.info("reverseAccrualIt - " + toString()); log.info("reverseAccrualIt - " + toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -571,12 +567,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{ {
log.info("reActivateIt - " + toString()); log.info("reActivateIt - " + toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return false; return false;
@ -589,7 +585,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getName()); sb.append(getName());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -607,7 +603,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -159,9 +159,9 @@ public class MCash extends X_C_Cash implements DocAction
Timestamp today = TimeUtil.getDay(System.currentTimeMillis()); Timestamp today = TimeUtil.getDay(System.currentTimeMillis());
setStatementDate (today); // @#Date@ setStatementDate (today); // @#Date@
setDateAcct (today); // @#Date@ setDateAcct (today); // @#Date@
StringBuilder name = new StringBuilder(DisplayType.getDateFormat(DisplayType.Date).format(today)) String name = DisplayType.getDateFormat(DisplayType.Date).format(today)
.append(" ").append(MOrg.get(ctx, getAD_Org_ID()).getValue()); + " " + MOrg.get(ctx, getAD_Org_ID()).getValue();
setName (name.toString()); setName (name);
setIsApproved(false); setIsApproved(false);
setPosted (false); // N setPosted (false); // N
setProcessed (false); setProcessed (false);
@ -193,9 +193,9 @@ public class MCash extends X_C_Cash implements DocAction
{ {
setStatementDate (today); setStatementDate (today);
setDateAcct (today); setDateAcct (today);
StringBuilder name = new StringBuilder(DisplayType.getDateFormat(DisplayType.Date).format(today)) String name = DisplayType.getDateFormat(DisplayType.Date).format(today)
.append(" ").append(cb.getName()); + " " + cb.getName();
setName (name.toString()); setName (name);
} }
m_book = cb; m_book = cb;
} // MCash } // MCash
@ -254,8 +254,7 @@ public class MCash extends X_C_Cash implements DocAction
*/ */
public String getDocumentInfo() public String getDocumentInfo()
{ {
StringBuilder msgreturn = new StringBuilder(Msg.getElement(getCtx(), "C_Cash_ID")).append(" ").append(getDocumentNo()); return Msg.getElement(getCtx(), "C_Cash_ID") + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -266,8 +265,7 @@ public class MCash extends X_C_Cash implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -322,7 +320,7 @@ public class MCash extends X_C_Cash implements DocAction
} // process } // process
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -355,20 +353,20 @@ public class MCash extends X_C_Cash implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
// Std Period open? // Std Period open?
if (!MPeriod.isOpen(getCtx(), getDateAcct(), MDocType.DOCBASETYPE_CashJournal, getAD_Org_ID())) if (!MPeriod.isOpen(getCtx(), getDateAcct(), MDocType.DOCBASETYPE_CashJournal, getAD_Org_ID()))
{ {
m_processMsg = new StringBuffer("@PeriodClosed@"); m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
MCashLine[] lines = getLines(false); MCashLine[] lines = getLines(false);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Add up Amounts // Add up Amounts
@ -388,7 +386,7 @@ public class MCash extends X_C_Cash implements DocAction
getAD_Client_ID(), getAD_Org_ID()); getAD_Client_ID(), getAD_Org_ID());
if (amt == null) if (amt == null)
{ {
m_processMsg = new StringBuffer("No Conversion Rate found - @C_CashLine_ID@= ").append(line.getLine()); m_processMsg = "No Conversion Rate found - @C_CashLine_ID@= " + line.getLine();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
difference = difference.add(amt); difference = difference.add(amt);
@ -397,7 +395,7 @@ public class MCash extends X_C_Cash implements DocAction
setStatementDifference(difference); setStatementDifference(difference);
// setEndingBalance(getBeginningBalance().add(getStatementDifference())); // setEndingBalance(getBeginningBalance().add(getStatementDifference()));
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -443,7 +441,7 @@ public class MCash extends X_C_Cash implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -468,19 +466,19 @@ public class MCash extends X_C_Cash implements DocAction
&& !MInvoice.DOCSTATUS_Voided.equals(invoice.getDocStatus()) && !MInvoice.DOCSTATUS_Voided.equals(invoice.getDocStatus())
) )
{ {
m_processMsg = new StringBuffer("@Line@ ").append(line.getLine()).append(": @InvoiceCreateDocNotCompleted@"); m_processMsg = "@Line@ "+line.getLine()+": @InvoiceCreateDocNotCompleted@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// //
StringBuilder name = new StringBuilder(Msg.translate(getCtx(), "C_Cash_ID")).append(": ").append(getName()) String name = Msg.translate(getCtx(), "C_Cash_ID") + ": " + getName()
.append(" - ").append(Msg.translate(getCtx(), "Line")).append(" ").append(line.getLine()); + " - " + Msg.translate(getCtx(), "Line") + " " + line.getLine();
MAllocationHdr hdr = new MAllocationHdr(getCtx(), false, MAllocationHdr hdr = new MAllocationHdr(getCtx(), false,
getDateAcct(), line.getC_Currency_ID(), getDateAcct(), line.getC_Currency_ID(),
name.toString(), get_TrxName()); name, get_TrxName());
hdr.setAD_Org_ID(getAD_Org_ID()); hdr.setAD_Org_ID(getAD_Org_ID());
if (!hdr.save()) if (!hdr.save())
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Allocation Hdr")); m_processMsg = CLogger.retrieveErrorString("Could not create Allocation Hdr");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Allocation Line // Allocation Line
@ -490,16 +488,16 @@ public class MCash extends X_C_Cash implements DocAction
aLine.setC_CashLine_ID(line.getC_CashLine_ID()); aLine.setC_CashLine_ID(line.getC_CashLine_ID());
if (!aLine.save()) if (!aLine.save())
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Allocation Line")); m_processMsg = CLogger.retrieveErrorString("Could not create Allocation Line");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Should start WF // Should start WF
if(!hdr.processIt(DocAction.ACTION_Complete)) { if(!hdr.processIt(DocAction.ACTION_Complete)) {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not process Allocation")); m_processMsg = CLogger.retrieveErrorString("Could not process Allocation");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (!hdr.save()) { if (!hdr.save()) {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not save Allocation")); m_processMsg = CLogger.retrieveErrorString("Could not save Allocation");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -531,14 +529,14 @@ public class MCash extends X_C_Cash implements DocAction
pay.setProcessed(true); pay.setProcessed(true);
if (!pay.save()) if (!pay.save())
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Payment")); m_processMsg = CLogger.retrieveErrorString("Could not create Payment");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
line.setC_Payment_ID(pay.getC_Payment_ID()); line.setC_Payment_ID(pay.getC_Payment_ID());
if (!line.save()) if (!line.save())
{ {
m_processMsg = new StringBuffer("Could not update Cash Line"); m_processMsg = "Could not update Cash Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -548,7 +546,7 @@ public class MCash extends X_C_Cash implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// //
@ -566,7 +564,7 @@ public class MCash extends X_C_Cash implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -575,7 +573,7 @@ public class MCash extends X_C_Cash implements DocAction
if (retValue) { if (retValue) {
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
@ -596,7 +594,7 @@ public class MCash extends X_C_Cash implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return false; return false;
} }
@ -623,10 +621,9 @@ public class MCash extends X_C_Cash implements DocAction
cashline.setAmount(Env.ZERO); cashline.setAmount(Env.ZERO);
cashline.setDiscountAmt(Env.ZERO); cashline.setDiscountAmt(Env.ZERO);
cashline.setWriteOffAmt(Env.ZERO); cashline.setWriteOffAmt(Env.ZERO);
StringBuilder msgadd = new StringBuilder(Msg.getMsg(getCtx(), "Voided")) cashline.addDescription(Msg.getMsg(getCtx(), "Voided")
.append(" (Amount=").append(oldAmount).append(", Discount=").append(oldDiscount) + " (Amount=" + oldAmount + ", Discount=" + oldDiscount
.append(", WriteOff=").append(oldWriteOff).append(", )"); + ", WriteOff=" + oldWriteOff + ", )");
cashline.addDescription(msgadd.toString());
if (MCashLine.CASHTYPE_BankAccountTransfer.equals(cashline.getCashType())) if (MCashLine.CASHTYPE_BankAccountTransfer.equals(cashline.getCashType()))
{ {
if (cashline.getC_Payment_ID() == 0) if (cashline.getC_Payment_ID() == 0)
@ -662,10 +659,8 @@ public class MCash extends X_C_Cash implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgsd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgsd.toString());
}
} // addDescription } // addDescription
/** /**
@ -677,14 +672,14 @@ public class MCash extends X_C_Cash implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
@ -698,7 +693,7 @@ public class MCash extends X_C_Cash implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -707,7 +702,7 @@ public class MCash extends X_C_Cash implements DocAction
if (retValue) { if (retValue) {
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
} }
@ -723,12 +718,12 @@ public class MCash extends X_C_Cash implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -743,7 +738,7 @@ public class MCash extends X_C_Cash implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -752,7 +747,7 @@ public class MCash extends X_C_Cash implements DocAction
return true; return true;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return false; return false;
@ -765,10 +760,10 @@ public class MCash extends X_C_Cash implements DocAction
public void setProcessed (boolean processed) public void setProcessed (boolean processed)
{ {
super.setProcessed (processed); super.setProcessed (processed);
StringBuilder sql = new StringBuilder("UPDATE C_CashLine SET Processed='") String sql = "UPDATE C_CashLine SET Processed='"
.append((processed ? "Y" : "N")) + (processed ? "Y" : "N")
.append("' WHERE C_Cash_ID=").append(getC_Cash_ID()); + "' WHERE C_Cash_ID=" + getC_Cash_ID();
int noLine = DB.executeUpdate (sql.toString(), get_TrxName()); int noLine = DB.executeUpdate (sql, get_TrxName());
m_lines = null; m_lines = null;
log.fine(processed + " - Lines=" + noLine); log.fine(processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
@ -779,7 +774,7 @@ public class MCash extends X_C_Cash implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MCash["); StringBuffer sb = new StringBuffer ("MCash[");
sb.append (get_ID ()) sb.append (get_ID ())
.append ("-").append (getName()) .append ("-").append (getName())
.append(", Balance=").append(getBeginningBalance()) .append(", Balance=").append(getBeginningBalance())
@ -794,7 +789,7 @@ public class MCash extends X_C_Cash implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getName()); sb.append(getName());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -814,7 +809,7 @@ public class MCash extends X_C_Cash implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -564,10 +564,8 @@ public class MInOut extends X_M_InOut implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgsd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgsd.toString());
}
} // addDescription } // addDescription
/** /**
@ -576,7 +574,7 @@ public class MInOut extends X_M_InOut implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MInOut[") StringBuffer sb = new StringBuffer ("MInOut[")
.append (get_ID()).append("-").append(getDocumentNo()) .append (get_ID()).append("-").append(getDocumentNo())
.append(",DocStatus=").append(getDocStatus()) .append(",DocStatus=").append(getDocStatus())
.append ("]"); .append ("]");
@ -590,8 +588,7 @@ public class MInOut extends X_M_InOut implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo()); return dt.getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -602,8 +599,7 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -805,10 +801,10 @@ public class MInOut extends X_M_InOut implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
StringBuilder sql = new StringBuilder("UPDATE M_InOutLine SET Processed='") String sql = "UPDATE M_InOutLine SET Processed='"
.append((processed ? "Y" : "N")) + (processed ? "Y" : "N")
.append("' WHERE M_InOut_ID=").append(getM_InOut_ID()); + "' WHERE M_InOut_ID=" + getM_InOut_ID();
int noLine = DB.executeUpdate(sql.toString(), get_TrxName()); int noLine = DB.executeUpdate(sql, get_TrxName());
m_lines = null; m_lines = null;
log.fine(processed + " - Lines=" + noLine); log.fine(processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
@ -1049,12 +1045,12 @@ public class MInOut extends X_M_InOut implements DocAction
if (is_ValueChanged("AD_Org_ID")) if (is_ValueChanged("AD_Org_ID"))
{ {
StringBuilder sql = new StringBuilder("UPDATE M_InOutLine ol") String sql = "UPDATE M_InOutLine ol"
.append(" SET AD_Org_ID =") + " SET AD_Org_ID ="
.append("(SELECT AD_Org_ID") + "(SELECT AD_Org_ID"
.append(" FROM M_InOut o WHERE ol.M_InOut_ID=o.M_InOut_ID) ") + " FROM M_InOut o WHERE ol.M_InOut_ID=o.M_InOut_ID) "
.append("WHERE M_InOut_ID=").append(getC_Order_ID()); + "WHERE M_InOut_ID=" + getC_Order_ID();
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql, get_TrxName());
log.fine("Lines -> #" + no); log.fine("Lines -> #" + no);
} }
return true; return true;
@ -1074,7 +1070,7 @@ public class MInOut extends X_M_InOut implements DocAction
} // process } // process
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -1107,7 +1103,7 @@ public class MInOut extends X_M_InOut implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1116,13 +1112,13 @@ public class MInOut extends X_M_InOut implements DocAction
// Order OR RMA can be processed on a shipment/receipt // Order OR RMA can be processed on a shipment/receipt
if (getC_Order_ID() != 0 && getM_RMA_ID() != 0) if (getC_Order_ID() != 0 && getM_RMA_ID() != 0)
{ {
m_processMsg = new StringBuffer("@OrderOrRMA@"); m_processMsg = "@OrderOrRMA@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Std Period open? // Std Period open?
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID())) if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID()))
{ {
m_processMsg = new StringBuffer("@PeriodClosed@"); m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -1137,24 +1133,24 @@ public class MInOut extends X_M_InOut implements DocAction
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName()); MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), get_TrxName());
if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus())) if (MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()))
{ {
m_processMsg = new StringBuffer("@BPartnerCreditStop@ - @TotalOpenBalance@=") m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
.append(bp.getTotalOpenBalance()) + bp.getTotalOpenBalance()
.append(", @SO_CreditLimit@=").append(bp.getSO_CreditLimit()); + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus())) if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus()))
{ {
m_processMsg = new StringBuffer("@BPartnerCreditHold@ - @TotalOpenBalance@=") m_processMsg = "@BPartnerCreditHold@ - @TotalOpenBalance@="
.append(bp.getTotalOpenBalance()) + bp.getTotalOpenBalance()
.append(", @SO_CreditLimit@=").append(bp.getSO_CreditLimit()); + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID()); BigDecimal notInvoicedAmt = MBPartner.getNotInvoicedAmt(getC_BPartner_ID());
if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt))) if (MBPartner.SOCREDITSTATUS_CreditHold.equals(bp.getSOCreditStatus(notInvoicedAmt)))
{ {
m_processMsg = new StringBuffer("@BPartnerOverSCreditHold@ - @TotalOpenBalance@=") m_processMsg = "@BPartnerOverSCreditHold@ - @TotalOpenBalance@="
.append(bp.getTotalOpenBalance()).append(", @NotInvoicedAmt@=").append(notInvoicedAmt) + bp.getTotalOpenBalance() + ", @NotInvoicedAmt@=" + notInvoicedAmt
.append(", @SO_CreditLimit@=").append(bp.getSO_CreditLimit()); + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1164,7 +1160,7 @@ public class MInOut extends X_M_InOut implements DocAction
MInOutLine[] lines = getLines(true); MInOutLine[] lines = getLines(true);
if (lines == null || lines.length == 0) if (lines == null || lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
BigDecimal Volume = Env.ZERO; BigDecimal Volume = Env.ZERO;
@ -1185,8 +1181,8 @@ public class MInOut extends X_M_InOut implements DocAction
continue; continue;
if (product != null && product.isASIMandatory(isSOTrx())) if (product != null && product.isASIMandatory(isSOTrx()))
{ {
m_processMsg = new StringBuffer("@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #").append(lines[i].getLine()) m_processMsg = "@M_AttributeSet_ID@ @IsMandatory@ (@Line@ #" + lines[i].getLine() +
.append(", @M_Product_ID@=").append(product.getValue()).append(")"); ", @M_Product_ID@=" + product.getValue() + ")";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1198,7 +1194,7 @@ public class MInOut extends X_M_InOut implements DocAction
createConfirmation(); createConfirmation();
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1244,7 +1240,7 @@ public class MInOut extends X_M_InOut implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1258,8 +1254,8 @@ public class MInOut extends X_M_InOut implements DocAction
if (MInOutConfirm.CONFIRMTYPE_CustomerConfirmation.equals(confirm.getConfirmType())) if (MInOutConfirm.CONFIRMTYPE_CustomerConfirmation.equals(confirm.getConfirmType()))
continue; continue;
// //
m_processMsg = new StringBuffer("Open @M_InOutConfirm_ID@: ") m_processMsg = "Open @M_InOutConfirm_ID@: " +
.append(confirm.getConfirmTypeName()).append(" - ").append(confirm.getDocumentNo()); confirm.getConfirmTypeName() + " - " + confirm.getDocumentNo();
return DocAction.STATUS_InProgress; return DocAction.STATUS_InProgress;
} }
} }
@ -1269,7 +1265,7 @@ public class MInOut extends X_M_InOut implements DocAction
if (!isApproved()) if (!isApproved())
approveIt(); approveIt();
log.info(toString()); log.info(toString());
StringBuilder info = new StringBuilder(); StringBuffer info = new StringBuffer();
// For all lines // For all lines
MInOutLine[] lines = getLines(false); MInOutLine[] lines = getLines(false);
@ -1363,7 +1359,7 @@ public class MInOut extends X_M_InOut implements DocAction
get_TrxName())) get_TrxName()))
{ {
String lastError = CLogger.retrieveErrorString(""); String lastError = CLogger.retrieveErrorString("");
m_processMsg = new StringBuffer("Cannot correct Inventory (MA) - ").append(lastError); m_processMsg = "Cannot correct Inventory (MA) - " + lastError;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (!sameWarehouse) { if (!sameWarehouse) {
@ -1375,7 +1371,7 @@ public class MInOut extends X_M_InOut implements DocAction
ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID, ma.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Env.ZERO, reservedDiff, orderedDiff, get_TrxName())) Env.ZERO, reservedDiff, orderedDiff, get_TrxName()))
{ {
m_processMsg = new StringBuffer("Cannot correct Inventory (MA) in order warehouse"); m_processMsg = "Cannot correct Inventory (MA) in order warehouse";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1387,7 +1383,7 @@ public class MInOut extends X_M_InOut implements DocAction
mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID());
if (!mtrx.save()) if (!mtrx.save())
{ {
m_processMsg = new StringBuffer("Could not create Material Transaction (MA)"); m_processMsg = "Could not create Material Transaction (MA)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1405,7 +1401,7 @@ public class MInOut extends X_M_InOut implements DocAction
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID, sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Qty, reservedDiff, orderedDiff, get_TrxName())) Qty, reservedDiff, orderedDiff, get_TrxName()))
{ {
m_processMsg = new StringBuffer("Cannot correct Inventory"); m_processMsg = "Cannot correct Inventory";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (!sameWarehouse) { if (!sameWarehouse) {
@ -1417,7 +1413,7 @@ public class MInOut extends X_M_InOut implements DocAction
sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID, sLine.getM_AttributeSetInstance_ID(), reservationAttributeSetInstance_ID,
Env.ZERO, QtySO.negate(), QtyPO.negate(), get_TrxName())) Env.ZERO, QtySO.negate(), QtyPO.negate(), get_TrxName()))
{ {
m_processMsg = new StringBuffer("Cannot correct Inventory"); m_processMsg = "Cannot correct Inventory";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1429,7 +1425,7 @@ public class MInOut extends X_M_InOut implements DocAction
mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID()); mtrx.setM_InOutLine_ID(sLine.getM_InOutLine_ID());
if (!mtrx.save()) if (!mtrx.save())
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Material Transaction")); m_processMsg = CLogger.retrieveErrorString("Could not create Material Transaction");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1453,7 +1449,7 @@ public class MInOut extends X_M_InOut implements DocAction
} }
if (!oLine.save()) if (!oLine.save())
{ {
m_processMsg = new StringBuffer("Could not update Order Line"); m_processMsg = "Could not update Order Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
else else
@ -1473,7 +1469,7 @@ public class MInOut extends X_M_InOut implements DocAction
} }
if (!rmaLine.save()) if (!rmaLine.save())
{ {
m_processMsg = new StringBuffer("Could not update RMA Line"); m_processMsg = "Could not update RMA Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1500,7 +1496,7 @@ public class MInOut extends X_M_InOut implements DocAction
MAsset asset = new MAsset (this, sLine, deliveryCount); MAsset asset = new MAsset (this, sLine, deliveryCount);
if (!asset.save(get_TrxName())) if (!asset.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not create Asset"); m_processMsg = "Could not create Asset";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
info.append(asset.getValue()); info.append(asset.getValue());
@ -1537,7 +1533,7 @@ public class MInOut extends X_M_InOut implements DocAction
isNewMatchInv = true; isNewMatchInv = true;
if (!inv.save(get_TrxName())) if (!inv.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Inv Matching")); m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchInv) if (isNewMatchInv)
@ -1556,7 +1552,7 @@ public class MInOut extends X_M_InOut implements DocAction
isNewMatchPO = true; isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not create PO Matching"); m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchPO) if (isNewMatchPO)
@ -1584,7 +1580,7 @@ public class MInOut extends X_M_InOut implements DocAction
isNewMatchPO = true; isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not create PO(Inv) Matching"); m_processMsg = "Could not create PO(Inv) Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (isNewMatchPO) if (isNewMatchPO)
@ -1616,14 +1612,14 @@ public class MInOut extends X_M_InOut implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set the definite document number after completed (if needed) // Set the definite document number after completed (if needed)
setDefiniteDocumentNo(); setDefiniteDocumentNo();
m_processMsg = new StringBuffer(info.toString()); m_processMsg = info.toString();
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
@ -1946,7 +1942,7 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -1954,7 +1950,7 @@ public class MInOut extends X_M_InOut implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
return false; return false;
} }
@ -1974,8 +1970,7 @@ public class MInOut extends X_M_InOut implements DocAction
if (old.signum() != 0) if (old.signum() != 0)
{ {
line.setQty(Env.ZERO); line.setQty(Env.ZERO);
StringBuilder msgd = new StringBuilder("Void (").append(old).append(")"); line.addDescription("Void (" + old + ")");
line.addDescription(msgd.toString());
line.saveEx(get_TrxName()); line.saveEx(get_TrxName());
} }
} }
@ -1991,7 +1986,7 @@ public class MInOut extends X_M_InOut implements DocAction
} }
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2008,7 +2003,7 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2016,7 +2011,7 @@ public class MInOut extends X_M_InOut implements DocAction
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
@ -2030,14 +2025,14 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID())) if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID()))
{ {
m_processMsg = new StringBuffer("@PeriodClosed@"); m_processMsg = "@PeriodClosed@";
return false; return false;
} }
@ -2066,7 +2061,7 @@ public class MInOut extends X_M_InOut implements DocAction
getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true); getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true);
if (reversal == null) if (reversal == null)
{ {
m_processMsg = new StringBuffer("Could not create Ship Reversal"); m_processMsg = "Could not create Ship Reversal";
return false; return false;
} }
reversal.setReversal(true); reversal.setReversal(true);
@ -2084,7 +2079,7 @@ public class MInOut extends X_M_InOut implements DocAction
rLine.setReversalLine_ID(sLines[i].getM_InOutLine_ID()); rLine.setReversalLine_ID(sLines[i].getM_InOutLine_ID());
if (!rLine.save(get_TrxName())) if (!rLine.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not correct Ship Reversal Line"); m_processMsg = "Could not correct Ship Reversal Line";
return false; return false;
} }
// We need to copy MA // We need to copy MA
@ -2105,17 +2100,14 @@ public class MInOut extends X_M_InOut implements DocAction
if (asset != null) if (asset != null)
{ {
asset.setIsActive(false); asset.setIsActive(false);
StringBuilder msgd = new StringBuilder( asset.addDescription("(" + reversal.getDocumentNo() + " #" + rLine.getLine() + "<-)");
"(").append(reversal.getDocumentNo()).append(" #").append(rLine.getLine()).append("<-)");
asset.addDescription(msgd.toString());
asset.saveEx(); asset.saveEx();
} }
} }
reversal.setC_Order_ID(getC_Order_ID()); reversal.setC_Order_ID(getC_Order_ID());
// Set M_RMA_ID // Set M_RMA_ID
reversal.setM_RMA_ID(getM_RMA_ID()); reversal.setM_RMA_ID(getM_RMA_ID());
StringBuilder msgd = new StringBuilder("{->").append(getDocumentNo()).append(")"); reversal.addDescription("{->" + getDocumentNo() + ")");
reversal.addDescription(msgd.toString());
//FR1948157 //FR1948157
reversal.setReversal_ID(getM_InOut_ID()); reversal.setReversal_ID(getM_InOut_ID());
reversal.saveEx(get_TrxName()); reversal.saveEx(get_TrxName());
@ -2123,7 +2115,7 @@ public class MInOut extends X_M_InOut implements DocAction
if (!reversal.processIt(DocAction.ACTION_Complete) if (!reversal.processIt(DocAction.ACTION_Complete)
|| !reversal.getDocStatus().equals(DocAction.STATUS_Completed)) || !reversal.getDocStatus().equals(DocAction.STATUS_Completed))
{ {
m_processMsg = new StringBuffer("Reversal ERROR: ").append(reversal.getProcessMsg()); m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg();
return false; return false;
} }
reversal.closeIt(); reversal.closeIt();
@ -2132,8 +2124,7 @@ public class MInOut extends X_M_InOut implements DocAction
reversal.setDocAction(DOCACTION_None); reversal.setDocAction(DOCACTION_None);
reversal.saveEx(get_TrxName()); reversal.saveEx(get_TrxName());
// //
msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)"); addDescription("(" + reversal.getDocumentNo() + "<-)");
addDescription(msgd.toString());
// //
// Void Confirmations // Void Confirmations
@ -2144,11 +2135,11 @@ public class MInOut extends X_M_InOut implements DocAction
voidConfirmations(); voidConfirmations();
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
m_processMsg = new StringBuffer(reversal.getDocumentNo()); m_processMsg = reversal.getDocumentNo();
setProcessed(true); setProcessed(true);
setDocStatus(DOCSTATUS_Reversed); // may come from void setDocStatus(DOCSTATUS_Reversed); // may come from void
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
@ -2163,12 +2154,12 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2183,12 +2174,12 @@ public class MInOut extends X_M_InOut implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2202,7 +2193,7 @@ public class MInOut extends X_M_InOut implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(":") sb.append(":")
@ -2220,7 +2211,7 @@ public class MInOut extends X_M_InOut implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -174,10 +174,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -195,7 +193,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MInOutConfirm["); StringBuffer sb = new StringBuffer ("MInOutConfirm[");
sb.append(get_ID()).append("-").append(getSummary()) sb.append(get_ID()).append("-").append(getSummary())
.append ("]"); .append ("]");
return sb.toString (); return sb.toString ();
@ -207,8 +205,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/ */
public String getDocumentInfo() public String getDocumentInfo()
{ {
StringBuilder msgreturn = new StringBuilder(Msg.getElement(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo()); return Msg.getElement(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -219,8 +216,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -253,11 +249,11 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
int AD_User_ID = Env.getAD_User_ID(getCtx()); int AD_User_ID = Env.getAD_User_ID(getCtx());
MUser user = MUser.get(getCtx(), AD_User_ID); MUser user = MUser.get(getCtx(), AD_User_ID);
StringBuilder info = new StringBuilder(user.getName()) String info = user.getName()
.append(": ") + ": "
.append(Msg.translate(getCtx(), "IsApproved")) + Msg.translate(getCtx(), "IsApproved")
.append(" - ").append(new Timestamp(System.currentTimeMillis())); + " - " + new Timestamp(System.currentTimeMillis());
addDescription(info.toString()); addDescription(info);
} }
super.setIsApproved (IsApproved); super.setIsApproved (IsApproved);
} // setIsApproved } // setIsApproved
@ -276,7 +272,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} // processIt } // processIt
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -309,7 +305,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -327,7 +323,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
MInOutLineConfirm[] lines = getLines(true); MInOutLineConfirm[] lines = getLines(true);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Set dispute if not fully confirmed // Set dispute if not fully confirmed
@ -342,7 +338,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} }
setIsInDispute(difference); setIsInDispute(difference);
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
// //
@ -388,7 +384,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -408,7 +404,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
if (dt.getC_DocTypeDifference_ID() == 0) if (dt.getC_DocTypeDifference_ID() == 0)
{ {
m_processMsg = new StringBuffer("No Split Document Type defined for: ").append(dt.getName()); m_processMsg = "No Split Document Type defined for: " + dt.getName();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
splitInOut (inout, dt.getC_DocTypeDifference_ID(), lines); splitInOut (inout, dt.getC_DocTypeDifference_ID(), lines);
@ -423,7 +419,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
confirmLine.set_TrxName(get_TrxName()); confirmLine.set_TrxName(get_TrxName());
if (!confirmLine.processLine (inout.isSOTrx(), getConfirmType())) if (!confirmLine.processLine (inout.isSOTrx(), getConfirmType()))
{ {
m_processMsg = new StringBuffer("ShipLine not saved - ").append(confirmLine); m_processMsg = "ShipLine not saved - " + confirmLine;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (confirmLine.isFullyConfirmed()) if (confirmLine.isFullyConfirmed())
@ -448,9 +444,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} // for all lines } // for all lines
if (m_creditMemo != null) if (m_creditMemo != null)
m_processMsg.append(" @C_Invoice_ID@=").append(m_creditMemo.getDocumentNo()); m_processMsg += " @C_Invoice_ID@=" + m_creditMemo.getDocumentNo();
if (m_inventory != null) if (m_inventory != null)
m_processMsg.append(" @M_Inventory_ID@=").append(m_inventory.getDocumentNo()); m_processMsg += " @M_Inventory_ID@=" + m_inventory.getDocumentNo();
// Try to complete Shipment // Try to complete Shipment
@ -461,7 +457,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -494,12 +490,10 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (split == null) if (split == null)
{ {
split = new MInOut (original, C_DocType_ID, original.getMovementDate()); split = new MInOut (original, C_DocType_ID, original.getMovementDate());
StringBuilder msgd = new StringBuilder("Splitted from ").append(original.getDocumentNo()); split.addDescription("Splitted from " + original.getDocumentNo());
split.addDescription(msgd.toString());
split.setIsInDispute(true); split.setIsInDispute(true);
split.saveEx(); split.saveEx();
msgd = new StringBuilder("Split: ").append(split.getDocumentNo()); original.addDescription("Split: " + split.getDocumentNo());
original.addDescription(msgd.toString());
original.saveEx(); original.saveEx();
} }
// //
@ -514,14 +508,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
splitLine.setM_Product_ID(oldLine.getM_Product_ID()); splitLine.setM_Product_ID(oldLine.getM_Product_ID());
splitLine.setM_Warehouse_ID(oldLine.getM_Warehouse_ID()); splitLine.setM_Warehouse_ID(oldLine.getM_Warehouse_ID());
splitLine.setRef_InOutLine_ID(oldLine.getRef_InOutLine_ID()); splitLine.setRef_InOutLine_ID(oldLine.getRef_InOutLine_ID());
StringBuilder msgd = new StringBuilder("Split: from ").append(oldLine.getMovementQty()); splitLine.addDescription("Split: from " + oldLine.getMovementQty());
splitLine.addDescription(msgd.toString());
// Qtys // Qtys
splitLine.setQty(differenceQty); // Entered/Movement splitLine.setQty(differenceQty); // Entered/Movement
splitLine.saveEx(); splitLine.saveEx();
// Old // Old
msgd = new StringBuilder("Splitted: from ").append(oldLine.getMovementQty()); oldLine.addDescription("Splitted: from " + oldLine.getMovementQty());
oldLine.addDescription(msgd.toString());
oldLine.setQty(oldLine.getMovementQty().subtract(differenceQty)); oldLine.setQty(oldLine.getMovementQty().subtract(differenceQty));
oldLine.saveEx(); oldLine.saveEx();
// Update Confirmation Line // Update Confirmation Line
@ -536,8 +528,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
return ; return ;
} }
m_processMsg = new StringBuffer("Split @M_InOut_ID@=").append(split.getDocumentNo()) m_processMsg = "Split @M_InOut_ID@=" + split.getDocumentNo()
.append(" - @M_InOutConfirm_ID@="); + " - @M_InOutConfirm_ID@=";
MDocType dt = MDocType.get(getCtx(), original.getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), original.getC_DocType_ID());
if (!dt.isPrepareSplitDocument()) if (!dt.isPrepareSplitDocument())
@ -560,13 +552,13 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
index++; // try just next index++; // try just next
if (splitConfirms[index].isProcessed()) if (splitConfirms[index].isProcessed())
{ {
m_processMsg.append(splitConfirms[index].getDocumentNo()).append(" processed??"); m_processMsg += splitConfirms[index].getDocumentNo() + " processed??";
return; return;
} }
} }
splitConfirms[index].setIsInDispute(true); splitConfirms[index].setIsInDispute(true);
splitConfirms[index].saveEx(); splitConfirms[index].saveEx();
m_processMsg.append(splitConfirms[index].getDocumentNo()); m_processMsg += splitConfirms[index].getDocumentNo();
// Set Lines to unconfirmed // Set Lines to unconfirmed
MInOutLineConfirm[] splitConfirmLines = splitConfirms[index].getLines(false); MInOutLineConfirm[] splitConfirmLines = splitConfirms[index].getLines(false);
for (int i = 0; i < splitConfirmLines.length; i++) for (int i = 0; i < splitConfirmLines.length; i++)
@ -578,7 +570,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} }
} }
else else
m_processMsg.append("??"); m_processMsg += "??";
} // splitInOut } // splitInOut
@ -592,9 +584,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
private boolean createDifferenceDoc (MInOut inout, MInOutLineConfirm confirm) private boolean createDifferenceDoc (MInOut inout, MInOutLineConfirm confirm)
{ {
if (m_processMsg == null) if (m_processMsg == null)
m_processMsg = new StringBuffer(); m_processMsg = "";
else if (m_processMsg.length() > 0) else if (m_processMsg.length() > 0)
m_processMsg.append("; "); m_processMsg += "; ";
// Credit Memo if linked Document // Credit Memo if linked Document
if (confirm.getDifferenceQty().signum() != 0 if (confirm.getDifferenceQty().signum() != 0
&& !inout.isSOTrx() && inout.getRef_InOut_ID() != 0) && !inout.isSOTrx() && inout.getRef_InOut_ID() != 0)
@ -603,8 +595,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (m_creditMemo == null) if (m_creditMemo == null)
{ {
m_creditMemo = new MInvoice (inout, null); m_creditMemo = new MInvoice (inout, null);
StringBuilder msgd = new StringBuilder(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo()); m_creditMemo.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
m_creditMemo.setDescription(msgd.toString());
m_creditMemo.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APCreditMemo); m_creditMemo.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APCreditMemo);
m_creditMemo.saveEx(); m_creditMemo.saveEx();
setC_Invoice_ID(m_creditMemo.getC_Invoice_ID()); setC_Invoice_ID(m_creditMemo.getC_Invoice_ID());
@ -629,8 +620,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
MWarehouse wh = MWarehouse.get(getCtx(), inout.getM_Warehouse_ID()); MWarehouse wh = MWarehouse.get(getCtx(), inout.getM_Warehouse_ID());
m_inventory = new MInventory (wh, get_TrxName()); m_inventory = new MInventory (wh, get_TrxName());
StringBuilder msgd = new StringBuilder(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo()); m_inventory.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
m_inventory.setDescription(msgd.toString());
m_inventory.saveEx(); m_inventory.saveEx();
setM_Inventory_ID(m_inventory.getM_Inventory_ID()); setM_Inventory_ID(m_inventory.getM_Inventory_ID());
} }
@ -640,7 +630,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
confirm.getScrappedQty(), Env.ZERO); confirm.getScrappedQty(), Env.ZERO);
if (!line.save(get_TrxName())) if (!line.save(get_TrxName()))
{ {
m_processMsg.append("Inventory Line not created"); m_processMsg += "Inventory Line not created";
return false; return false;
} }
confirm.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); confirm.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
@ -649,7 +639,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
// //
if (!confirm.save(get_TrxName())) if (!confirm.save(get_TrxName()))
{ {
m_processMsg.append("Confirmation Line not saved"); m_processMsg += "Confirmation Line not saved";
return false; return false;
} }
return true; return true;
@ -663,7 +653,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -671,7 +661,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
return false; return false;
} }
@ -705,7 +695,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} }
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -723,14 +713,14 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -745,12 +735,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -765,12 +755,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -785,12 +775,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -804,7 +794,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -822,7 +812,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -162,10 +162,8 @@ public class MInventory extends X_M_Inventory implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgreturn = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgreturn.toString());
}
} // addDescription } // addDescription
/** /**
@ -184,7 +182,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MInventory["); StringBuffer sb = new StringBuffer ("MInventory[");
sb.append (get_ID()) sb.append (get_ID())
.append ("-").append (getDocumentNo()) .append ("-").append (getDocumentNo())
.append (",M_Warehouse_ID=").append(getM_Warehouse_ID()) .append (",M_Warehouse_ID=").append(getM_Warehouse_ID())
@ -199,8 +197,7 @@ public class MInventory extends X_M_Inventory implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo()); return dt.getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -211,8 +208,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -289,7 +285,7 @@ public class MInventory extends X_M_Inventory implements DocAction
} // processIt } // processIt
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -322,7 +318,7 @@ public class MInventory extends X_M_Inventory implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -331,14 +327,14 @@ public class MInventory extends X_M_Inventory implements DocAction
MInventoryLine[] lines = getLines(false); MInventoryLine[] lines = getLines(false);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// TODO: Add up Amounts // TODO: Add up Amounts
// setApprovalAmt(); // setApprovalAmt();
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -384,7 +380,7 @@ public class MInventory extends X_M_Inventory implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -444,7 +440,7 @@ public class MInventory extends X_M_Inventory implements DocAction
QtyMA.negate(), Env.ZERO, Env.ZERO, get_TrxName())) QtyMA.negate(), Env.ZERO, Env.ZERO, get_TrxName()))
{ {
String lastError = CLogger.retrieveErrorString(""); String lastError = CLogger.retrieveErrorString("");
m_processMsg = new StringBuffer("Cannot correct Inventory (MA) - ").append(lastError); m_processMsg = "Cannot correct Inventory (MA) - " + lastError;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -456,7 +452,7 @@ public class MInventory extends X_M_Inventory implements DocAction
storage.setDateLastInventory(getMovementDate()); storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName())) if (!storage.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Storage not updated(2)"); m_processMsg = "Storage not updated(2)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -474,7 +470,7 @@ public class MInventory extends X_M_Inventory implements DocAction
mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!mtrx.save()) if (!mtrx.save())
{ {
m_processMsg = new StringBuffer("Transaction not inserted(2)"); m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -494,7 +490,7 @@ public class MInventory extends X_M_Inventory implements DocAction
line.getM_AttributeSetInstance_ID(), 0, line.getM_AttributeSetInstance_ID(), 0,
qtyDiff, Env.ZERO, Env.ZERO, get_TrxName())) qtyDiff, Env.ZERO, Env.ZERO, get_TrxName()))
{ {
m_processMsg = new StringBuffer("Cannot correct Inventory (MA)"); m_processMsg = "Cannot correct Inventory (MA)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -507,7 +503,7 @@ public class MInventory extends X_M_Inventory implements DocAction
storage.setDateLastInventory(getMovementDate()); storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName())) if (!storage.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Storage not updated(2)"); m_processMsg = "Storage not updated(2)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -524,7 +520,7 @@ public class MInventory extends X_M_Inventory implements DocAction
mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID()); mtrx.setM_InventoryLine_ID(line.getM_InventoryLine_ID());
if (!mtrx.save()) if (!mtrx.save())
{ {
m_processMsg = new StringBuffer("Transaction not inserted(2)"); m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} // Fallback } // Fallback
@ -536,7 +532,7 @@ public class MInventory extends X_M_Inventory implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -661,7 +657,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -669,7 +665,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
return false; return false;
} }
@ -692,8 +688,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
line.setQtyInternalUse(Env.ZERO); line.setQtyInternalUse(Env.ZERO);
line.setQtyCount(line.getQtyBook()); line.setQtyCount(line.getQtyBook());
StringBuilder msgd = new StringBuilder("Void (").append(oldCount).append("/").append(oldInternal).append(")"); line.addDescription("Void (" + oldCount + "/" + oldInternal + ")");
line.addDescription(msgd.toString());
line.saveEx(get_TrxName()); line.saveEx(get_TrxName());
} }
} }
@ -704,7 +699,7 @@ public class MInventory extends X_M_Inventory implements DocAction
} }
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setProcessed(true); setProcessed(true);
@ -720,13 +715,13 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
@ -740,7 +735,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -755,8 +750,7 @@ public class MInventory extends X_M_Inventory implements DocAction
reversal.setIsApproved (false); reversal.setIsApproved (false);
reversal.setPosted(false); reversal.setPosted(false);
reversal.setProcessed(false); reversal.setProcessed(false);
StringBuilder msgd = new StringBuilder("{->").append(getDocumentNo()).append(")"); reversal.addDescription("{->" + getDocumentNo() + ")");
reversal.addDescription(msgd.toString());
//FR1948157 //FR1948157
reversal.setReversal_ID(getM_Inventory_ID()); reversal.setReversal_ID(getM_Inventory_ID());
reversal.saveEx(); reversal.saveEx();
@ -798,20 +792,19 @@ public class MInventory extends X_M_Inventory implements DocAction
// //
if (!reversal.processIt(DocAction.ACTION_Complete)) if (!reversal.processIt(DocAction.ACTION_Complete))
{ {
m_processMsg = new StringBuffer("Reversal ERROR: ").append(reversal.getProcessMsg()); m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg();
return false; return false;
} }
reversal.closeIt(); reversal.closeIt();
reversal.setDocStatus(DOCSTATUS_Reversed); reversal.setDocStatus(DOCSTATUS_Reversed);
reversal.setDocAction(DOCACTION_None); reversal.setDocAction(DOCACTION_None);
reversal.saveEx(); reversal.saveEx();
m_processMsg = new StringBuffer(reversal.getDocumentNo()); m_processMsg = reversal.getDocumentNo();
// Update Reversed (this) // Update Reversed (this)
msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)"); addDescription("(" + reversal.getDocumentNo() + "<-)");
addDescription(msgd.toString());
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
setProcessed(true); setProcessed(true);
@ -831,12 +824,12 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -851,12 +844,12 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -870,7 +863,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -888,7 +881,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -219,7 +219,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public static String getPDFFileName (String documentDir, int C_Invoice_ID) public static String getPDFFileName (String documentDir, int C_Invoice_ID)
{ {
StringBuilder sb = new StringBuilder (documentDir); StringBuffer sb = new StringBuffer (documentDir);
if (sb.length() == 0) if (sb.length() == 0)
sb.append("."); sb.append(".");
if (!sb.toString().endsWith(File.separator)) if (!sb.toString().endsWith(File.separator))
@ -825,10 +825,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -853,9 +851,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
StringBuilder set = new StringBuilder("SET Processed='") String set = "SET Processed='"
.append((processed ? "Y" : "N")) + (processed ? "Y" : "N")
.append("' WHERE C_Invoice_ID=").append(getC_Invoice_ID()); + "' WHERE C_Invoice_ID=" + getC_Invoice_ID();
int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName()); int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName());
int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName()); int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName());
m_lines = null; m_lines = null;
@ -1023,7 +1021,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MInvoice[") StringBuffer sb = new StringBuffer ("MInvoice[")
.append(get_ID()).append("-").append(getDocumentNo()) .append(get_ID()).append("-").append(getDocumentNo())
.append(",GrandTotal=").append(getGrandTotal()); .append(",GrandTotal=").append(getGrandTotal());
if (m_lines != null) if (m_lines != null)
@ -1039,8 +1037,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo()); return dt.getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
@ -1057,12 +1054,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (is_ValueChanged("AD_Org_ID")) if (is_ValueChanged("AD_Org_ID"))
{ {
StringBuilder sql = new StringBuilder("UPDATE C_InvoiceLine ol") String sql = "UPDATE C_InvoiceLine ol"
.append(" SET AD_Org_ID =") + " SET AD_Org_ID ="
.append("(SELECT AD_Org_ID") + "(SELECT AD_Org_ID"
.append(" FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) ") + " FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) "
.append("WHERE C_Invoice_ID=").append(getC_Invoice_ID()); + "WHERE C_Invoice_ID=" + getC_Invoice_ID();
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql, get_TrxName());
log.fine("Lines -> #" + no); log.fine("Lines -> #" + no);
} }
return true; return true;
@ -1258,8 +1255,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -1339,7 +1335,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
} // process } // process
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -1372,7 +1368,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1382,14 +1378,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
MInvoiceLine[] lines = getLines(true); MInvoiceLine[] lines = getLines(true);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// No Cash Book // No Cash Book
if (PAYMENTRULE_Cash.equals(getPaymentRule()) if (PAYMENTRULE_Cash.equals(getPaymentRule())
&& MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null) && MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null)
{ {
m_processMsg = new StringBuffer("@NoCashBook@"); m_processMsg = "@NoCashBook@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -1398,14 +1394,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
setC_DocType_ID(getC_DocTypeTarget_ID()); setC_DocType_ID(getC_DocTypeTarget_ID());
if (getC_DocType_ID() == 0) if (getC_DocType_ID() == 0)
{ {
m_processMsg = new StringBuffer("No Document Type"); m_processMsg = "No Document Type";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
explodeBOM(); explodeBOM();
if (!calculateTaxTotal()) // setTotals if (!calculateTaxTotal()) // setTotals
{ {
m_processMsg = new StringBuffer("Error calculating Tax"); m_processMsg = "Error calculating Tax";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -1414,13 +1410,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
if (!createPaySchedule()) if (!createPaySchedule())
{ {
m_processMsg = new StringBuffer("@ErrorPaymentSchedule@"); m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} else { } else {
if (MInvoicePaySchedule.getInvoicePaySchedule(getCtx(), getC_Invoice_ID(), 0, get_TrxName()).length > 0) if (MInvoicePaySchedule.getInvoicePaySchedule(getCtx(), getC_Invoice_ID(), 0, get_TrxName()).length > 0)
{ {
m_processMsg = new StringBuffer("@ErrorPaymentSchedule@"); m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1437,9 +1433,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null); MBPartner bp = new MBPartner (getCtx(), getC_BPartner_ID(), null);
if ( MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()) ) if ( MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()) )
{ {
m_processMsg = new StringBuffer("@BPartnerCreditStop@ - @TotalOpenBalance@=") m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
.append(bp.getTotalOpenBalance()) + bp.getTotalOpenBalance()
.append(", @SO_CreditLimit@=").append(bp.getSO_CreditLimit()); + ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1454,13 +1450,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
String error = line.allocateLandedCosts(); String error = line.allocateLandedCosts();
if (error != null && error.length() > 0) if (error != null && error.length() > 0)
{ {
m_processMsg = new StringBuffer(error); m_processMsg = error;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1545,12 +1541,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setPriceList (Env.ZERO); line.setPriceList (Env.ZERO);
line.setLineNetAmt (Env.ZERO); line.setLineNetAmt (Env.ZERO);
// //
StringBuilder description = new StringBuilder(product.getName ()); String description = product.getName ();
if (product.getDescription () != null) if (product.getDescription () != null)
description.append(" ").append(product.getDescription ()); description += " " + product.getDescription ();
if (line.getDescription () != null) if (line.getDescription () != null)
description.append(" ").append(line.getDescription ()); description += " " + line.getDescription ();
line.setDescription (description.toString()); line.setDescription (description);
line.saveEx (get_TrxName()); line.saveEx (get_TrxName());
} // for all lines with BOM } // for all lines with BOM
@ -1568,8 +1564,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.fine(""); log.fine("");
// Delete Taxes // Delete Taxes
StringBuilder msgdb = new StringBuilder("DELETE C_InvoiceTax WHERE C_Invoice_ID=").append(getC_Invoice_ID()); DB.executeUpdateEx("DELETE C_InvoiceTax WHERE C_Invoice_ID=" + getC_Invoice_ID(), get_TrxName());
DB.executeUpdateEx(msgdb.toString(), get_TrxName());
m_taxes = null; m_taxes = null;
// Lines // Lines
@ -1703,7 +1698,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -1711,7 +1706,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (!isApproved()) if (!isApproved())
approveIt(); approveIt();
log.info(toString()); log.info(toString());
StringBuilder info = new StringBuilder(); StringBuffer info = new StringBuffer();
// POS supports multiple payments // POS supports multiple payments
boolean fromPOS = false; boolean fromPOS = false;
@ -1748,17 +1743,17 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (cash == null || cash.get_ID() == 0) if (cash == null || cash.get_ID() == 0)
{ {
m_processMsg = new StringBuffer("@NoCashBook@"); m_processMsg = "@NoCashBook@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
MCashLine cl = new MCashLine (cash); MCashLine cl = new MCashLine (cash);
cl.setInvoice(this); cl.setInvoice(this);
if (!cl.save(get_TrxName())) if (!cl.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not save Cash Journal Line"); m_processMsg = "Could not save Cash Journal Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
info.append("@C_Cash_ID@: ").append(cash.getName()).append(" #").append(cl.getLine()); info.append("@C_Cash_ID@: " + cash.getName() + " #" + cl.getLine());
setC_CashLine_ID(cl.getC_CashLine_ID()); setC_CashLine_ID(cl.getC_CashLine_ID());
} // CashBook } // CashBook
@ -1782,7 +1777,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
ol.setQtyInvoiced(ol.getQtyInvoiced().add(line.getQtyInvoiced())); ol.setQtyInvoiced(ol.getQtyInvoiced().add(line.getQtyInvoiced()));
if (!ol.save(get_TrxName())) if (!ol.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not update Order Line"); m_processMsg = "Could not update Order Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1800,7 +1795,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
isNewMatchPO = true; isNewMatchPO = true;
if (!po.save(get_TrxName())) if (!po.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not create PO Matching"); m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
matchPO++; matchPO++;
@ -1819,7 +1814,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
rmaLine.setQtyInvoiced(line.getQtyInvoiced()); rmaLine.setQtyInvoiced(line.getQtyInvoiced());
if (!rmaLine.save(get_TrxName())) if (!rmaLine.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not update RMA Line"); m_processMsg = "Could not update RMA Line";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -1843,7 +1838,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
isNewMatchInv = true; isNewMatchInv = true;
if (!inv.save(get_TrxName())) if (!inv.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer(CLogger.retrieveErrorString("Could not create Invoice Matching")); m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
matchInv++; matchInv++;
@ -1865,8 +1860,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
getC_Currency_ID(), getDateAcct(), getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID()); getC_Currency_ID(), getDateAcct(), getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());
if (invAmt == null) if (invAmt == null)
{ {
m_processMsg = new StringBuffer("Could not convert C_Currency_ID=").append(getC_Currency_ID()) m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID()
.append(" to base C_Currency_ID=").append(MClient.get(Env.getCtx()).getC_Currency_ID()); + " to base C_Currency_ID=" + MClient.get(Env.getCtx()).getC_Currency_ID();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Total Balance // Total Balance
@ -1907,7 +1902,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
bp.setSOCreditStatus(); bp.setSOCreditStatus();
if (!bp.save(get_TrxName())) if (!bp.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not update Business Partner"); m_processMsg = "Could not update Business Partner";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -1916,11 +1911,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName()); MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName());
user.setLastContact(new Timestamp(System.currentTimeMillis())); user.setLastContact(new Timestamp(System.currentTimeMillis()));
StringBuilder msgr = new StringBuilder(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(getDocumentNo()); user.setLastResult(Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo());
user.setLastResult(msgr.toString());
if (!user.save(get_TrxName())) if (!user.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not update Business Partner User"); m_processMsg = "Could not update Business Partner User";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} // user } // user
@ -1936,8 +1930,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID()); getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID());
if (amt == null) if (amt == null)
{ {
m_processMsg = new StringBuffer("Could not convert C_Currency_ID=").append(getC_Currency_ID()) m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID()
.append(" to Project C_Currency_ID=").append(C_CurrencyTo_ID); + " to Project C_Currency_ID=" + C_CurrencyTo_ID;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
BigDecimal newAmt = project.getInvoicedAmt(); BigDecimal newAmt = project.getInvoicedAmt();
@ -1951,7 +1945,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
project.setInvoicedAmt(newAmt); project.setInvoicedAmt(newAmt);
if (!project.save(get_TrxName())) if (!project.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not update Project"); m_processMsg = "Could not update Project";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} // project } // project
@ -1960,7 +1954,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -1972,7 +1966,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (counter != null) if (counter != null)
info.append(" - @CounterDoc@: @C_Invoice_ID@=").append(counter.getDocumentNo()); info.append(" - @CounterDoc@: @C_Invoice_ID@=").append(counter.getDocumentNo());
m_processMsg = new StringBuffer(info.toString().trim()); m_processMsg = info.toString().trim();
setProcessed(true); setProcessed(true);
setDocAction(DOCACTION_Close); setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
@ -2098,7 +2092,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2106,7 +2100,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus()) || DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus())) || DOCSTATUS_Voided.equals(getDocStatus()))
{ {
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus()); m_processMsg = "Document Closed: " + getDocStatus();
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
return false; return false;
} }
@ -2130,8 +2124,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setTaxAmt(Env.ZERO); line.setTaxAmt(Env.ZERO);
line.setLineNetAmt(Env.ZERO); line.setLineNetAmt(Env.ZERO);
line.setLineTotalAmt(Env.ZERO); line.setLineTotalAmt(Env.ZERO);
StringBuilder msgd = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (").append(old).append(")"); line.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + old + ")");
line.addDescription(msgd.toString());
// Unlink Shipment // Unlink Shipment
if (line.getM_InOutLine_ID() != 0) if (line.getM_InOutLine_ID() != 0)
{ {
@ -2153,7 +2146,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
} }
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2170,7 +2163,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2178,7 +2171,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
setDocAction(DOCACTION_None); setDocAction(DOCACTION_None);
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
return true; return true;
@ -2192,7 +2185,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2235,7 +2228,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal = copyFrom (this, getDateInvoiced(), getDateAcct(), getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true, getDocumentNo()+"^"); reversal = copyFrom (this, getDateInvoiced(), getDateAcct(), getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true, getDocumentNo()+"^");
if (reversal == null) if (reversal == null)
{ {
m_processMsg = new StringBuffer("Could not create Invoice Reversal"); m_processMsg = "Could not create Invoice Reversal";
return false; return false;
} }
reversal.setReversal(true); reversal.setReversal(true);
@ -2254,7 +2247,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
rLine.setLineTotalAmt(rLine.getLineTotalAmt().negate()); rLine.setLineTotalAmt(rLine.getLineTotalAmt().negate());
if (!rLine.save(get_TrxName())) if (!rLine.save(get_TrxName()))
{ {
m_processMsg = new StringBuffer("Could not correct Invoice Reversal Line"); m_processMsg = "Could not correct Invoice Reversal Line";
return false; return false;
} }
} }
@ -2266,7 +2259,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
// //
if (!reversal.processIt(DocAction.ACTION_Complete)) if (!reversal.processIt(DocAction.ACTION_Complete))
{ {
m_processMsg = new StringBuffer("Reversal ERROR: ").append(reversal.getProcessMsg()); m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg();
return false; return false;
} }
reversal.setC_Payment_ID(0); reversal.setC_Payment_ID(0);
@ -2276,10 +2269,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal.setDocStatus(DOCSTATUS_Reversed); reversal.setDocStatus(DOCSTATUS_Reversed);
reversal.setDocAction(DOCACTION_None); reversal.setDocAction(DOCACTION_None);
reversal.saveEx(get_TrxName()); reversal.saveEx(get_TrxName());
m_processMsg = new StringBuffer(reversal.getDocumentNo()); m_processMsg = reversal.getDocumentNo();
// //
StringBuilder msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)"); addDescription("(" + reversal.getDocumentNo() + "<-)");
addDescription(msgd.toString());
// Clean up Reversed (this) // Clean up Reversed (this)
MInvoiceLine[] iLines = getLines(false); MInvoiceLine[] iLines = getLines(false);
@ -2305,10 +2297,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
setIsPaid(true); setIsPaid(true);
// Create Allocation // Create Allocation
msgd = new StringBuilder(
Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(getDocumentNo()).append("/").append(reversal.getDocumentNo());
MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(), MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(),
getC_Currency_ID(),msgd.toString(),get_TrxName()); getC_Currency_ID(),
Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo() + "/" + reversal.getDocumentNo(),
get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID()); alloc.setAD_Org_ID(getAD_Org_ID());
if (alloc.save()) if (alloc.save())
{ {
@ -2334,7 +2326,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
} }
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2349,12 +2341,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2369,12 +2361,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -2389,7 +2381,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Grand Total = 123.00 (#1) // : Grand Total = 123.00 (#1)
sb.append(": "). sb.append(": ").
@ -2407,7 +2399,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -203,10 +203,8 @@ public class MJournal extends X_GL_Journal implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else{ else
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description); setDescription(desc + " | " + description);
setDescription(msgd.toString());
}
} }
/************************************************************************** /**************************************************************************
@ -281,10 +279,10 @@ public class MJournal extends X_GL_Journal implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
StringBuilder sql = new StringBuilder("UPDATE GL_JournalLine SET Processed='") String sql = "UPDATE GL_JournalLine SET Processed='"
.append((processed ? "Y" : "N")) + (processed ? "Y" : "N")
.append("' WHERE GL_Journal_ID=").append(getGL_Journal_ID()); + "' WHERE GL_Journal_ID=" + getGL_Journal_ID();
int noLine = DB.executeUpdate(sql.toString(), get_TrxName()); int noLine = DB.executeUpdate(sql, get_TrxName());
log.fine(processed + " - Lines=" + noLine); log.fine(processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
@ -374,11 +372,11 @@ public class MJournal extends X_GL_Journal implements DocAction
private boolean updateBatch() private boolean updateBatch()
{ {
if (getGL_JournalBatch_ID()!=0) { // idempiere 344 - nmicoud if (getGL_JournalBatch_ID()!=0) { // idempiere 344 - nmicoud
StringBuilder sql = new StringBuilder("UPDATE GL_JournalBatch jb") String sql = "UPDATE GL_JournalBatch jb"
.append(" SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)") + " SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)"
.append(" FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) ") + " FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) "
.append("WHERE GL_JournalBatch_ID=").append(getGL_JournalBatch_ID()); + "WHERE GL_JournalBatch_ID=" + getGL_JournalBatch_ID();
int no = DB.executeUpdate(sql.toString(), get_TrxName()); int no = DB.executeUpdate(sql, get_TrxName());
if (no != 1) if (no != 1)
log.warning("afterSave - Update Batch #" + no); log.warning("afterSave - Update Batch #" + no);
return no == 1; return no == 1;
@ -400,7 +398,7 @@ public class MJournal extends X_GL_Journal implements DocAction
} // process } // process
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -432,7 +430,7 @@ public class MJournal extends X_GL_Journal implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
@ -442,14 +440,14 @@ public class MJournal extends X_GL_Journal implements DocAction
if (period == null) if (period == null)
{ {
log.warning("No Period for " + getDateAcct()); log.warning("No Period for " + getDateAcct());
m_processMsg = new StringBuffer("@PeriodNotFound@"); m_processMsg = "@PeriodNotFound@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// Standard Period // Standard Period
if (period.getC_Period_ID() != getC_Period_ID() if (period.getC_Period_ID() != getC_Period_ID()
&& period.isStandardPeriod()) && period.isStandardPeriod())
{ {
m_processMsg = new StringBuffer("@PeriodNotValid@"); m_processMsg = "@PeriodNotValid@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
boolean open = period.isOpen(dt.getDocBaseType(), getDateAcct()); boolean open = period.isOpen(dt.getDocBaseType(), getDateAcct());
@ -457,7 +455,7 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
log.warning(period.getName() log.warning(period.getName()
+ ": Not open for " + dt.getDocBaseType() + " (" + getDateAcct() + ")"); + ": Not open for " + dt.getDocBaseType() + " (" + getDateAcct() + ")");
m_processMsg = new StringBuffer("@PeriodClosed@"); m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -465,7 +463,7 @@ public class MJournal extends X_GL_Journal implements DocAction
MJournalLine[] lines = getLines(true); MJournalLine[] lines = getLines(true);
if (lines.length == 0) if (lines.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -481,8 +479,8 @@ public class MJournal extends X_GL_Journal implements DocAction
// bcahya, BF [2789319] No check of Actual, Budget, Statistical attribute // bcahya, BF [2789319] No check of Actual, Budget, Statistical attribute
if (!line.getAccountElementValue().isActive()) if (!line.getAccountElementValue().isActive())
{ {
m_processMsg = new StringBuffer("@InActiveAccount@ - @Line@=").append(line.getLine()) m_processMsg = "@InActiveAccount@ - @Line@=" + line.getLine()
.append(" - ").append(line.getAccountElementValue()); + " - " + line.getAccountElementValue();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -493,8 +491,8 @@ public class MJournal extends X_GL_Journal implements DocAction
getPostingType().equals(POSTINGTYPE_Reservation) getPostingType().equals(POSTINGTYPE_Reservation)
) )
{ {
m_processMsg = new StringBuffer("@DocControlledError@ - @Line@=").append(line.getLine()) m_processMsg = "@DocControlledError@ - @Line@=" + line.getLine()
.append(" - ").append(line.getAccountElementValue()); + " - " + line.getAccountElementValue();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// //
@ -502,22 +500,22 @@ public class MJournal extends X_GL_Journal implements DocAction
// bcahya, BF [2789319] No check of Actual, Budget, Statistical attribute // bcahya, BF [2789319] No check of Actual, Budget, Statistical attribute
if (getPostingType().equals(POSTINGTYPE_Actual) && !line.getAccountElementValue().isPostActual()) if (getPostingType().equals(POSTINGTYPE_Actual) && !line.getAccountElementValue().isPostActual())
{ {
m_processMsg = new StringBuffer("@PostingTypeActualError@ - @Line@=").append(line.getLine()) m_processMsg = "@PostingTypeActualError@ - @Line@=" + line.getLine()
.append(" - ").append(line.getAccountElementValue()); + " - " + line.getAccountElementValue();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (getPostingType().equals(POSTINGTYPE_Budget) && !line.getAccountElementValue().isPostBudget()) if (getPostingType().equals(POSTINGTYPE_Budget) && !line.getAccountElementValue().isPostBudget())
{ {
m_processMsg = new StringBuffer("@PostingTypeBudgetError@ - @Line@=").append(line.getLine()) m_processMsg = "@PostingTypeBudgetError@ - @Line@=" + line.getLine()
.append(" - ").append(line.getAccountElementValue()); + " - " + line.getAccountElementValue();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (getPostingType().equals(POSTINGTYPE_Statistical) && !line.getAccountElementValue().isPostStatistical()) if (getPostingType().equals(POSTINGTYPE_Statistical) && !line.getAccountElementValue().isPostStatistical())
{ {
m_processMsg = new StringBuffer("@PostingTypeStatisticalError@ - @Line@=").append(line.getLine()) m_processMsg = "@PostingTypeStatisticalError@ - @Line@=" + line.getLine()
.append(" - ").append(line.getAccountElementValue()); + " - " + line.getAccountElementValue();
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
// end BF [2789319] No check of Actual, Budget, Statistical attribute // end BF [2789319] No check of Actual, Budget, Statistical attribute
@ -532,7 +530,7 @@ public class MJournal extends X_GL_Journal implements DocAction
if (Env.ZERO.compareTo(getControlAmt()) != 0 if (Env.ZERO.compareTo(getControlAmt()) != 0
&& getControlAmt().compareTo(getTotalDr()) != 0) && getControlAmt().compareTo(getTotalDr()) != 0)
{ {
m_processMsg = new StringBuffer("@ControlAmtError@"); m_processMsg = "@ControlAmtError@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -542,7 +540,7 @@ public class MJournal extends X_GL_Journal implements DocAction
MAcctSchemaGL gl = MAcctSchemaGL.get(getCtx(), getC_AcctSchema_ID()); MAcctSchemaGL gl = MAcctSchemaGL.get(getCtx(), getC_AcctSchema_ID());
if (gl == null || !gl.isUseSuspenseBalancing()) if (gl == null || !gl.isUseSuspenseBalancing())
{ {
m_processMsg = new StringBuffer("@UnbalancedJornal@"); m_processMsg = "@UnbalancedJornal@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
} }
@ -550,7 +548,7 @@ public class MJournal extends X_GL_Journal implements DocAction
if (!DOCACTION_Complete.equals(getDocAction())) if (!DOCACTION_Complete.equals(getDocAction()))
setDocAction(DOCACTION_Complete); setDocAction(DOCACTION_Complete);
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -594,7 +592,7 @@ public class MJournal extends X_GL_Journal implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -606,7 +604,7 @@ public class MJournal extends X_GL_Journal implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -646,7 +644,7 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -662,7 +660,7 @@ public class MJournal extends X_GL_Journal implements DocAction
} }
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -678,7 +676,7 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -693,7 +691,7 @@ public class MJournal extends X_GL_Journal implements DocAction
} }
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -708,7 +706,7 @@ public class MJournal extends X_GL_Journal implements DocAction
public boolean reverseCorrectIt() public boolean reverseCorrectIt()
{ {
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -718,7 +716,7 @@ public class MJournal extends X_GL_Journal implements DocAction
return false; return false;
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -741,14 +739,12 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.setC_Period_ID(getC_Period_ID()); reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct()); reverse.setDateAcct(getDateAcct());
// Reverse indicator // Reverse indicator
StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")"); reverse.addDescription("(->" + getDocumentNo() + ")");
reverse.addDescription(msgd.toString());
//FR [ 1948157 ] //FR [ 1948157 ]
reverse.setReversal_ID(getGL_Journal_ID()); reverse.setReversal_ID(getGL_Journal_ID());
if (!reverse.save()) if (!reverse.save())
return null; return null;
msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)"); addDescription("(" + reverse.getDocumentNo() + "<-)");
addDescription(msgd.toString());
// Lines // Lines
reverse.copyLinesFrom(this, null, 'C'); reverse.copyLinesFrom(this, null, 'C');
@ -768,7 +764,7 @@ public class MJournal extends X_GL_Journal implements DocAction
public boolean reverseAccrualIt() public boolean reverseAccrualIt()
{ {
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -778,7 +774,7 @@ public class MJournal extends X_GL_Journal implements DocAction
return false; return false;
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -801,12 +797,12 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.set_ValueNoCheck ("C_Period_ID", null); // reset reverse.set_ValueNoCheck ("C_Period_ID", null); // reset
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
StringBuilder description ; String description = reverse.getDescription();
if (reverse.getDescription() == null) if (description == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); description = "** " + getDocumentNo() + " **";
else else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description.toString()); reverse.setDescription(description);
if (!reverse.save()) if (!reverse.save())
return null; return null;
@ -826,7 +822,7 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
log.info(toString()); log.info(toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -838,7 +834,7 @@ public class MJournal extends X_GL_Journal implements DocAction
setDocAction(DOCACTION_Complete); setDocAction(DOCACTION_Complete);
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -852,7 +848,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -872,7 +868,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MJournal["); StringBuffer sb = new StringBuffer ("MJournal[");
sb.append(get_ID()).append(",").append(getDescription()) sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr()) .append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr()) .append(",CR=").append(getTotalCr())
@ -887,8 +883,7 @@ public class MJournal extends X_GL_Journal implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo()); return dt.getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -899,8 +894,7 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -930,7 +924,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**

View File

@ -280,7 +280,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
} // process } // process
/** Process Message */ /** Process Message */
private StringBuffer m_processMsg = null; private String m_processMsg = null;
/** Just Prepared Flag */ /** Just Prepared Flag */
private boolean m_justPrepared = false; private boolean m_justPrepared = false;
@ -312,7 +312,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
public String prepareIt() public String prepareIt()
{ {
log.info(toString()); log.info(toString());
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
@ -320,7 +320,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
// Std Period open? // Std Period open?
if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID())) if (!MPeriod.isOpen(getCtx(), getDateAcct(), dt.getDocBaseType(), getAD_Org_ID()))
{ {
m_processMsg = new StringBuffer("@PeriodClosed@"); m_processMsg = "@PeriodClosed@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -328,7 +328,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
MJournal[] journals = getJournals(false); MJournal[] journals = getJournals(false);
if (journals.length == 0) if (journals.length == 0)
{ {
m_processMsg = new StringBuffer("@NoLines@"); m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -352,7 +352,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
journal.setDocStatus(status); journal.setDocStatus(status);
journal.saveEx(); journal.saveEx();
m_processMsg = new StringBuffer(journal.getProcessMsg()); m_processMsg = journal.getProcessMsg();
return status; return status;
} }
journal.setDocStatus(DOCSTATUS_InProgress); journal.setDocStatus(DOCSTATUS_InProgress);
@ -369,7 +369,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
if (Env.ZERO.compareTo(getControlAmt()) != 0 if (Env.ZERO.compareTo(getControlAmt()) != 0
&& getControlAmt().compareTo(getTotalDr()) != 0) && getControlAmt().compareTo(getTotalDr()) != 0)
{ {
m_processMsg = new StringBuffer("@ControlAmtError@"); m_processMsg = "@ControlAmtError@";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -398,7 +398,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
} }
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_PREPARE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -444,7 +444,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
return status; return status;
} }
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_BEFORE_COMPLETE);
if (m_processMsg != null) if (m_processMsg != null)
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
@ -481,7 +481,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
journal.saveEx(); journal.saveEx();
if (!DocAction.STATUS_Completed.equals(journal.getDocStatus())) if (!DocAction.STATUS_Completed.equals(journal.getDocStatus()))
{ {
m_processMsg = new StringBuffer(journal.getProcessMsg()); m_processMsg = journal.getProcessMsg();
return journal.getDocStatus(); return journal.getDocStatus();
} }
} }
@ -495,7 +495,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE); String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null) if (valid != null)
{ {
m_processMsg = new StringBuffer(valid); m_processMsg = valid;
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
@ -531,11 +531,11 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
log.info("voidIt - " + toString()); log.info("voidIt - " + toString());
// Before Void // Before Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
// After Void // After Void
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_VOID);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -550,7 +550,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
log.info("closeIt - " + toString()); log.info("closeIt - " + toString());
// Before Close // Before Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -570,7 +570,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|| DOCSTATUS_InProgress.equals(journal.getDocStatus()) || DOCSTATUS_InProgress.equals(journal.getDocStatus())
|| DOCSTATUS_Invalid.equals(journal.getDocStatus())) || DOCSTATUS_Invalid.equals(journal.getDocStatus()))
{ {
m_processMsg = new StringBuffer("Journal not Completed: ").append(journal.getSummary()); m_processMsg = "Journal not Completed: " + journal.getSummary();
return false; return false;
} }
@ -583,14 +583,14 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
if (!journal.closeIt()) if (!journal.closeIt())
{ {
m_processMsg = new StringBuffer("Cannot close: ").append(journal.getSummary()); m_processMsg = "Cannot close: " + journal.getSummary();
return false; return false;
} }
journal.saveEx(); journal.saveEx();
} }
} }
// After Close // After Close
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_CLOSE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -606,7 +606,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
log.info("reverseCorrectIt - " + toString()); log.info("reverseCorrectIt - " + toString());
// Before reverseCorrect // Before reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -622,7 +622,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
; ;
else else
{ {
m_processMsg = new StringBuffer("All Journals need to be Completed: ").append(journal.getSummary()); m_processMsg = "All Journals need to be Completed: " + journal.getSummary();
return false; return false;
} }
} }
@ -633,12 +633,12 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setC_Period_ID(getC_Period_ID()); reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct()); reverse.setDateAcct(getDateAcct());
// Reverse indicator // Reverse indicator
StringBuilder description ; String description = reverse.getDescription();
if (reverse.getDescription() == null) if (description == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); description = "** " + getDocumentNo() + " **";
else else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description.toString()); reverse.setDescription(description);
//[ 1948157 ] //[ 1948157 ]
reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.setReversal_ID(getGL_JournalBatch_ID());
reverse.saveEx(); reverse.saveEx();
@ -652,7 +652,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
continue; continue;
if (journal.reverseCorrectIt(reverse.getGL_JournalBatch_ID()) == null) if (journal.reverseCorrectIt(reverse.getGL_JournalBatch_ID()) == null)
{ {
m_processMsg = new StringBuffer("Could not reverse ").append(journal); m_processMsg = "Could not reverse " + journal;
return false; return false;
} }
journal.saveEx(); journal.saveEx();
@ -662,7 +662,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
setReversal_ID(reverse.getGL_JournalBatch_ID()); setReversal_ID(reverse.getGL_JournalBatch_ID());
saveEx(); saveEx();
// After reverseCorrect // After reverseCorrect
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -678,7 +678,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
log.info("reverseAccrualIt - " + toString()); log.info("reverseAccrualIt - " + toString());
// Before reverseAccrual // Before reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -694,7 +694,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
; ;
else else
{ {
m_processMsg = new StringBuffer("All Journals need to be Completed: ").append(journal.getSummary()); m_processMsg = "All Journals need to be Completed: " + journal.getSummary();
return false; return false;
} }
} }
@ -704,12 +704,12 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setDateDoc(new Timestamp(System.currentTimeMillis())); reverse.setDateDoc(new Timestamp(System.currentTimeMillis()));
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
StringBuilder description; String description = reverse.getDescription();
if (reverse.getDescription() == null) if (description == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **"); description = "** " + getDocumentNo() + " **";
else else
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **"); description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description.toString()); reverse.setDescription(description);
reverse.saveEx(); reverse.saveEx();
// Reverse Journals // Reverse Journals
@ -720,13 +720,13 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
continue; continue;
if (journal.reverseAccrualIt(reverse.getGL_JournalBatch_ID()) == null) if (journal.reverseAccrualIt(reverse.getGL_JournalBatch_ID()) == null)
{ {
m_processMsg = new StringBuffer("Could not reverse ").append(journal); m_processMsg = "Could not reverse " + journal;
return false; return false;
} }
journal.saveEx(); journal.saveEx();
} }
// After reverseAccrual // After reverseAccrual
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSEACCRUAL);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -742,7 +742,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
log.info("reActivateIt - " + toString()); log.info("reActivateIt - " + toString());
// Before reActivate // Before reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -764,7 +764,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
setDocAction(DOCACTION_Complete); setDocAction(DOCACTION_Complete);
// After reActivate // After reActivate
m_processMsg = new StringBuffer(ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE)); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REACTIVATE);
if (m_processMsg != null) if (m_processMsg != null)
return false; return false;
@ -778,7 +778,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuilder sb = new StringBuilder(); StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -798,7 +798,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuilder sb = new StringBuilder ("MJournalBatch["); StringBuffer sb = new StringBuffer ("MJournalBatch[");
sb.append(get_ID()).append(",").append(getDescription()) sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr()) .append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr()) .append(",CR=").append(getTotalCr())
@ -813,8 +813,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo()); return dt.getName() + " " + getDocumentNo();
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -825,8 +824,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
try try
{ {
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_"); File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -856,7 +854,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/ */
public String getProcessMsg() public String getProcessMsg()
{ {
return m_processMsg.toString(); return m_processMsg;
} // getProcessMsg } // getProcessMsg
/** /**