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();
if (desc == null)
setDescription(description);
else{
StringBuilder msgsd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgsd.toString());
}
else
setDescription(desc + " | " + description);
} // addDescription
/**
@ -164,10 +162,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
StringBuilder sql = new StringBuilder("UPDATE C_BankStatementLine SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE C_BankStatement_ID=").append(getC_BankStatement_ID());
int noLine = DB.executeUpdate(sql.toString(), get_TrxName());
String sql = "UPDATE C_BankStatementLine SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE C_BankStatement_ID=" + getC_BankStatement_ID();
int noLine = DB.executeUpdate(sql, get_TrxName());
m_lines = null;
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
} // setProcessed
@ -196,8 +194,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/
public String getDocumentInfo()
{
StringBuilder msgreturn = new StringBuilder(getBankAccount().getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
return getBankAccount().getName() + " " + getDocumentNo();
} // getDocumentInfo
/**
@ -208,8 +205,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
try
{
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -263,7 +259,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
} // processIt
/** Process Message */
private StringBuffer m_processMsg = null;
private String m_processMsg = null;
/** Just Prepared Flag */
private boolean m_justPrepared = false;
@ -296,7 +292,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
public String prepareIt()
{
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)
return DocAction.STATUS_Invalid;
@ -305,7 +301,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MBankStatementLine[] lines = getLines(true);
if (lines.length == 0)
{
m_processMsg = new StringBuffer("@NoLines@");
m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// 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(), 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)
return DocAction.STATUS_Invalid;
@ -373,7 +369,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
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)
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);
if (valid != null)
{
m_processMsg = new StringBuffer(valid);
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
//
@ -422,7 +418,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
log.info(toString());
// 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)
return false;
@ -430,7 +426,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus()))
{
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus());
m_processMsg = "Document Closed: " + getDocStatus();
setDocAction(DOCACTION_None);
return false;
}
@ -464,16 +460,16 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MBankStatementLine line = lines[i];
if (line.getStmtAmt().compareTo(Env.ZERO) != 0)
{
StringBuilder description = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (")
.append(Msg.translate(getCtx(), "StmtAmt")).append("=").append(line.getStmtAmt());
String description = Msg.getMsg(getCtx(), "Voided") + " ("
+ Msg.translate(getCtx(), "StmtAmt") + "=" + line.getStmtAmt();
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)
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)
description.append(", ").append(Msg.translate(getCtx(), "InterestAmt")).append("=").append(line.getInterestAmt());
description.append(")");
line.addDescription(description.toString());
description += ", " + Msg.translate(getCtx(), "InterestAmt") + "=" + line.getInterestAmt();
description += ")";
line.addDescription(description);
//
line.setStmtAmt(Env.ZERO);
line.setTrxAmt(Env.ZERO);
@ -493,7 +489,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
setStatementDifference(Env.ZERO);
// 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)
return false;
@ -510,14 +506,14 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
log.info("closeIt - " + toString());
// 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)
return false;
setDocAction(DOCACTION_None);
// 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)
return false;
return true;
@ -531,12 +527,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
log.info("reverseCorrectIt - " + toString());
// 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)
return false;
// 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)
return false;
@ -551,12 +547,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
log.info("reverseAccrualIt - " + toString());
// 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)
return false;
// 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)
return false;
@ -571,12 +567,12 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
log.info("reActivateIt - " + toString());
// 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)
return false;
// 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)
return false;
return false;
@ -589,7 +585,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/
public String getSummary()
{
StringBuilder sb = new StringBuilder();
StringBuffer sb = new StringBuffer();
sb.append(getName());
// : Total Lines = 123.00 (#1)
sb.append(": ")
@ -607,7 +603,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/
public String getProcessMsg()
{
return m_processMsg.toString();
return m_processMsg;
} // getProcessMsg
/**

View File

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

View File

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

View File

@ -174,10 +174,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
else
setDescription(desc + " | " + description);
} // addDescription
/**
@ -195,7 +193,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String toString ()
{
StringBuilder sb = new StringBuilder ("MInOutConfirm[");
StringBuffer sb = new StringBuffer ("MInOutConfirm[");
sb.append(get_ID()).append("-").append(getSummary())
.append ("]");
return sb.toString ();
@ -207,8 +205,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String getDocumentInfo()
{
StringBuilder msgreturn = new StringBuilder(Msg.getElement(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
return msgreturn.toString();
return Msg.getElement(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo();
} // getDocumentInfo
/**
@ -219,8 +216,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
try
{
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
return createPDF (temp);
}
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());
MUser user = MUser.get(getCtx(), AD_User_ID);
StringBuilder info = new StringBuilder(user.getName())
.append(": ")
.append(Msg.translate(getCtx(), "IsApproved"))
.append(" - ").append(new Timestamp(System.currentTimeMillis()));
addDescription(info.toString());
String info = user.getName()
+ ": "
+ Msg.translate(getCtx(), "IsApproved")
+ " - " + new Timestamp(System.currentTimeMillis());
addDescription(info);
}
super.setIsApproved (IsApproved);
} // setIsApproved
@ -276,7 +272,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} // processIt
/** Process Message */
private StringBuffer m_processMsg = null;
private String m_processMsg = null;
/** Just Prepared Flag */
private boolean m_justPrepared = false;
@ -309,7 +305,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
public String prepareIt()
{
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)
return DocAction.STATUS_Invalid;
@ -327,7 +323,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
MInOutLineConfirm[] lines = getLines(true);
if (lines.length == 0)
{
m_processMsg = new StringBuffer("@NoLines@");
m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// Set dispute if not fully confirmed
@ -342,7 +338,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
}
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)
return DocAction.STATUS_Invalid;
//
@ -388,7 +384,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
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)
return DocAction.STATUS_Invalid;
@ -408,7 +404,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
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;
}
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());
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;
}
if (confirmLine.isFullyConfirmed())
@ -448,9 +444,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
} // for all lines
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)
m_processMsg.append(" @M_Inventory_ID@=").append(m_inventory.getDocumentNo());
m_processMsg += " @M_Inventory_ID@=" + m_inventory.getDocumentNo();
// 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);
if (valid != null)
{
m_processMsg = new StringBuffer(valid);
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
@ -494,12 +490,10 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (split == null)
{
split = new MInOut (original, C_DocType_ID, original.getMovementDate());
StringBuilder msgd = new StringBuilder("Splitted from ").append(original.getDocumentNo());
split.addDescription(msgd.toString());
split.addDescription("Splitted from " + original.getDocumentNo());
split.setIsInDispute(true);
split.saveEx();
msgd = new StringBuilder("Split: ").append(split.getDocumentNo());
original.addDescription(msgd.toString());
original.addDescription("Split: " + split.getDocumentNo());
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_Warehouse_ID(oldLine.getM_Warehouse_ID());
splitLine.setRef_InOutLine_ID(oldLine.getRef_InOutLine_ID());
StringBuilder msgd = new StringBuilder("Split: from ").append(oldLine.getMovementQty());
splitLine.addDescription(msgd.toString());
splitLine.addDescription("Split: from " + oldLine.getMovementQty());
// Qtys
splitLine.setQty(differenceQty); // Entered/Movement
splitLine.saveEx();
// Old
msgd = new StringBuilder("Splitted: from ").append(oldLine.getMovementQty());
oldLine.addDescription(msgd.toString());
oldLine.addDescription("Splitted: from " + oldLine.getMovementQty());
oldLine.setQty(oldLine.getMovementQty().subtract(differenceQty));
oldLine.saveEx();
// Update Confirmation Line
@ -536,8 +528,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
return ;
}
m_processMsg = new StringBuffer("Split @M_InOut_ID@=").append(split.getDocumentNo())
.append(" - @M_InOutConfirm_ID@=");
m_processMsg = "Split @M_InOut_ID@=" + split.getDocumentNo()
+ " - @M_InOutConfirm_ID@=";
MDocType dt = MDocType.get(getCtx(), original.getC_DocType_ID());
if (!dt.isPrepareSplitDocument())
@ -560,13 +552,13 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
index++; // try just next
if (splitConfirms[index].isProcessed())
{
m_processMsg.append(splitConfirms[index].getDocumentNo()).append(" processed??");
m_processMsg += splitConfirms[index].getDocumentNo() + " processed??";
return;
}
}
splitConfirms[index].setIsInDispute(true);
splitConfirms[index].saveEx();
m_processMsg.append(splitConfirms[index].getDocumentNo());
m_processMsg += splitConfirms[index].getDocumentNo();
// Set Lines to unconfirmed
MInOutLineConfirm[] splitConfirmLines = splitConfirms[index].getLines(false);
for (int i = 0; i < splitConfirmLines.length; i++)
@ -578,7 +570,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
}
}
else
m_processMsg.append("??");
m_processMsg += "??";
} // splitInOut
@ -592,9 +584,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
private boolean createDifferenceDoc (MInOut inout, MInOutLineConfirm confirm)
{
if (m_processMsg == null)
m_processMsg = new StringBuffer();
m_processMsg = "";
else if (m_processMsg.length() > 0)
m_processMsg.append("; ");
m_processMsg += "; ";
// Credit Memo if linked Document
if (confirm.getDifferenceQty().signum() != 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)
{
m_creditMemo = new MInvoice (inout, null);
StringBuilder msgd = new StringBuilder(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
m_creditMemo.setDescription(msgd.toString());
m_creditMemo.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
m_creditMemo.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APCreditMemo);
m_creditMemo.saveEx();
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());
m_inventory = new MInventory (wh, get_TrxName());
StringBuilder msgd = new StringBuilder(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
m_inventory.setDescription(msgd.toString());
m_inventory.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
m_inventory.saveEx();
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);
if (!line.save(get_TrxName()))
{
m_processMsg.append("Inventory Line not created");
m_processMsg += "Inventory Line not created";
return false;
}
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()))
{
m_processMsg.append("Confirmation Line not saved");
m_processMsg += "Confirmation Line not saved";
return false;
}
return true;
@ -663,7 +653,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
log.info(toString());
// 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)
return false;
@ -671,7 +661,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus()))
{
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus());
m_processMsg = "Document Closed: " + getDocStatus();
return false;
}
@ -705,7 +695,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
}
// 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)
return false;
@ -723,14 +713,14 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
log.info(toString());
// 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)
return false;
setDocAction(DOCACTION_None);
// 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)
return false;
@ -745,12 +735,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -765,12 +755,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -785,12 +775,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -804,7 +794,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String getSummary()
{
StringBuilder sb = new StringBuilder();
StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")
@ -822,7 +812,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String getProcessMsg()
{
return m_processMsg.toString();
return m_processMsg;
} // getProcessMsg
/**

View File

@ -162,10 +162,8 @@ public class MInventory extends X_M_Inventory implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else{
StringBuilder msgreturn = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgreturn.toString());
}
else
setDescription(desc + " | " + description);
} // addDescription
/**
@ -184,7 +182,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/
public String toString ()
{
StringBuilder sb = new StringBuilder ("MInventory[");
StringBuffer sb = new StringBuffer ("MInventory[");
sb.append (get_ID())
.append ("-").append (getDocumentNo())
.append (",M_Warehouse_ID=").append(getM_Warehouse_ID())
@ -199,8 +197,7 @@ public class MInventory extends X_M_Inventory implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
return dt.getName() + " " + getDocumentNo();
} // getDocumentInfo
/**
@ -211,8 +208,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{
try
{
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -289,7 +285,7 @@ public class MInventory extends X_M_Inventory implements DocAction
} // processIt
/** Process Message */
private StringBuffer m_processMsg = null;
private String m_processMsg = null;
/** Just Prepared Flag */
private boolean m_justPrepared = false;
@ -322,7 +318,7 @@ public class MInventory extends X_M_Inventory implements DocAction
public String prepareIt()
{
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)
return DocAction.STATUS_Invalid;
@ -331,14 +327,14 @@ public class MInventory extends X_M_Inventory implements DocAction
MInventoryLine[] lines = getLines(false);
if (lines.length == 0)
{
m_processMsg = new StringBuffer("@NoLines@");
m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// TODO: Add up Amounts
// 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)
return DocAction.STATUS_Invalid;
@ -384,7 +380,7 @@ public class MInventory extends X_M_Inventory implements DocAction
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)
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()))
{
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;
}
@ -456,7 +452,7 @@ public class MInventory extends X_M_Inventory implements DocAction
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = new StringBuffer("Storage not updated(2)");
m_processMsg = "Storage not updated(2)";
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());
if (!mtrx.save())
{
m_processMsg = new StringBuffer("Transaction not inserted(2)");
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
@ -494,7 +490,7 @@ public class MInventory extends X_M_Inventory implements DocAction
line.getM_AttributeSetInstance_ID(), 0,
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;
}
@ -507,7 +503,7 @@ public class MInventory extends X_M_Inventory implements DocAction
storage.setDateLastInventory(getMovementDate());
if (!storage.save(get_TrxName()))
{
m_processMsg = new StringBuffer("Storage not updated(2)");
m_processMsg = "Storage not updated(2)";
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());
if (!mtrx.save())
{
m_processMsg = new StringBuffer("Transaction not inserted(2)");
m_processMsg = "Transaction not inserted(2)";
return DocAction.STATUS_Invalid;
}
} // Fallback
@ -536,7 +532,7 @@ public class MInventory extends X_M_Inventory implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null)
{
m_processMsg = new StringBuffer(valid);
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
@ -661,7 +657,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{
log.info(toString());
// 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)
return false;
@ -669,7 +665,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus()))
{
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus());
m_processMsg = "Document Closed: " + getDocStatus();
return false;
}
@ -692,8 +688,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{
line.setQtyInternalUse(Env.ZERO);
line.setQtyCount(line.getQtyBook());
StringBuilder msgd = new StringBuilder("Void (").append(oldCount).append("/").append(oldInternal).append(")");
line.addDescription(msgd.toString());
line.addDescription("Void (" + oldCount + "/" + oldInternal + ")");
line.saveEx(get_TrxName());
}
}
@ -704,7 +699,7 @@ public class MInventory extends X_M_Inventory implements DocAction
}
// 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)
return false;
setProcessed(true);
@ -720,13 +715,13 @@ public class MInventory extends X_M_Inventory implements DocAction
{
log.info(toString());
// 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)
return false;
setDocAction(DOCACTION_None);
// 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)
return false;
return true;
@ -740,7 +735,7 @@ public class MInventory extends X_M_Inventory implements DocAction
{
log.info(toString());
// 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)
return false;
@ -755,8 +750,7 @@ public class MInventory extends X_M_Inventory implements DocAction
reversal.setIsApproved (false);
reversal.setPosted(false);
reversal.setProcessed(false);
StringBuilder msgd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgd.toString());
reversal.addDescription("{->" + getDocumentNo() + ")");
//FR1948157
reversal.setReversal_ID(getM_Inventory_ID());
reversal.saveEx();
@ -798,20 +792,19 @@ public class MInventory extends X_M_Inventory implements DocAction
//
if (!reversal.processIt(DocAction.ACTION_Complete))
{
m_processMsg = new StringBuffer("Reversal ERROR: ").append(reversal.getProcessMsg());
m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg();
return false;
}
reversal.closeIt();
reversal.setDocStatus(DOCSTATUS_Reversed);
reversal.setDocAction(DOCACTION_None);
reversal.saveEx();
m_processMsg = new StringBuffer(reversal.getDocumentNo());
m_processMsg = reversal.getDocumentNo();
// Update Reversed (this)
msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
addDescription("(" + reversal.getDocumentNo() + "<-)");
// 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)
return false;
setProcessed(true);
@ -831,12 +824,12 @@ public class MInventory extends X_M_Inventory implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -851,12 +844,12 @@ public class MInventory extends X_M_Inventory implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -870,7 +863,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/
public String getSummary()
{
StringBuilder sb = new StringBuilder();
StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")
@ -888,7 +881,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/
public String getProcessMsg()
{
return m_processMsg.toString();
return m_processMsg;
} // 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)
{
StringBuilder sb = new StringBuilder (documentDir);
StringBuffer sb = new StringBuffer (documentDir);
if (sb.length() == 0)
sb.append(".");
if (!sb.toString().endsWith(File.separator))
@ -825,10 +825,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
else
setDescription(desc + " | " + description);
} // addDescription
/**
@ -853,9 +851,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
StringBuilder set = new StringBuilder("SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE C_Invoice_ID=").append(getC_Invoice_ID());
String set = "SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE C_Invoice_ID=" + getC_Invoice_ID();
int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName());
int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName());
m_lines = null;
@ -1023,7 +1021,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public String toString ()
{
StringBuilder sb = new StringBuilder ("MInvoice[")
StringBuffer sb = new StringBuffer ("MInvoice[")
.append(get_ID()).append("-").append(getDocumentNo())
.append(",GrandTotal=").append(getGrandTotal());
if (m_lines != null)
@ -1039,8 +1037,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
return dt.getName() + " " + getDocumentNo();
} // getDocumentInfo
@ -1057,12 +1054,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (is_ValueChanged("AD_Org_ID"))
{
StringBuilder sql = new StringBuilder("UPDATE C_InvoiceLine ol")
.append(" SET AD_Org_ID =")
.append("(SELECT AD_Org_ID")
.append(" FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) ")
.append("WHERE C_Invoice_ID=").append(getC_Invoice_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
String sql = "UPDATE C_InvoiceLine ol"
+ " SET AD_Org_ID ="
+ "(SELECT AD_Org_ID"
+ " FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) "
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID();
int no = DB.executeUpdate(sql, get_TrxName());
log.fine("Lines -> #" + no);
}
return true;
@ -1258,8 +1255,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
try
{
StringBuilder msgfile = new StringBuilder(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -1339,7 +1335,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
} // process
/** Process Message */
private StringBuffer m_processMsg = null;
private String m_processMsg = null;
/** Just Prepared Flag */
private boolean m_justPrepared = false;
@ -1372,7 +1368,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String prepareIt()
{
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)
return DocAction.STATUS_Invalid;
@ -1382,14 +1378,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
MInvoiceLine[] lines = getLines(true);
if (lines.length == 0)
{
m_processMsg = new StringBuffer("@NoLines@");
m_processMsg = "@NoLines@";
return DocAction.STATUS_Invalid;
}
// No Cash Book
if (PAYMENTRULE_Cash.equals(getPaymentRule())
&& MCashBook.get(getCtx(), getAD_Org_ID(), getC_Currency_ID()) == null)
{
m_processMsg = new StringBuffer("@NoCashBook@");
m_processMsg = "@NoCashBook@";
return DocAction.STATUS_Invalid;
}
@ -1398,14 +1394,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
setC_DocType_ID(getC_DocTypeTarget_ID());
if (getC_DocType_ID() == 0)
{
m_processMsg = new StringBuffer("No Document Type");
m_processMsg = "No Document Type";
return DocAction.STATUS_Invalid;
}
explodeBOM();
if (!calculateTaxTotal()) // setTotals
{
m_processMsg = new StringBuffer("Error calculating Tax");
m_processMsg = "Error calculating Tax";
return DocAction.STATUS_Invalid;
}
@ -1414,13 +1410,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
if (!createPaySchedule())
{
m_processMsg = new StringBuffer("@ErrorPaymentSchedule@");
m_processMsg = "@ErrorPaymentSchedule@";
return DocAction.STATUS_Invalid;
}
} else {
if (MInvoicePaySchedule.getInvoicePaySchedule(getCtx(), getC_Invoice_ID(), 0, get_TrxName()).length > 0)
{
m_processMsg = new StringBuffer("@ErrorPaymentSchedule@");
m_processMsg = "@ErrorPaymentSchedule@";
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);
if ( MBPartner.SOCREDITSTATUS_CreditStop.equals(bp.getSOCreditStatus()) )
{
m_processMsg = new StringBuffer("@BPartnerCreditStop@ - @TotalOpenBalance@=")
.append(bp.getTotalOpenBalance())
.append(", @SO_CreditLimit@=").append(bp.getSO_CreditLimit());
m_processMsg = "@BPartnerCreditStop@ - @TotalOpenBalance@="
+ bp.getTotalOpenBalance()
+ ", @SO_CreditLimit@=" + bp.getSO_CreditLimit();
return DocAction.STATUS_Invalid;
}
}
@ -1454,13 +1450,13 @@ public class MInvoice extends X_C_Invoice implements DocAction
String error = line.allocateLandedCosts();
if (error != null && error.length() > 0)
{
m_processMsg = new StringBuffer(error);
m_processMsg = error;
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)
return DocAction.STATUS_Invalid;
@ -1545,12 +1541,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setPriceList (Env.ZERO);
line.setLineNetAmt (Env.ZERO);
//
StringBuilder description = new StringBuilder(product.getName ());
String description = product.getName ();
if (product.getDescription () != null)
description.append(" ").append(product.getDescription ());
description += " " + product.getDescription ();
if (line.getDescription () != null)
description.append(" ").append(line.getDescription ());
line.setDescription (description.toString());
description += " " + line.getDescription ();
line.setDescription (description);
line.saveEx (get_TrxName());
} // for all lines with BOM
@ -1568,8 +1564,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.fine("");
// Delete Taxes
StringBuilder msgdb = new StringBuilder("DELETE C_InvoiceTax WHERE C_Invoice_ID=").append(getC_Invoice_ID());
DB.executeUpdateEx(msgdb.toString(), get_TrxName());
DB.executeUpdateEx("DELETE C_InvoiceTax WHERE C_Invoice_ID=" + getC_Invoice_ID(), get_TrxName());
m_taxes = null;
// Lines
@ -1703,7 +1698,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
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)
return DocAction.STATUS_Invalid;
@ -1711,7 +1706,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (!isApproved())
approveIt();
log.info(toString());
StringBuilder info = new StringBuilder();
StringBuffer info = new StringBuffer();
// POS supports multiple payments
boolean fromPOS = false;
@ -1748,17 +1743,17 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (cash == null || cash.get_ID() == 0)
{
m_processMsg = new StringBuffer("@NoCashBook@");
m_processMsg = "@NoCashBook@";
return DocAction.STATUS_Invalid;
}
MCashLine cl = new MCashLine (cash);
cl.setInvoice(this);
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;
}
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());
} // CashBook
@ -1782,7 +1777,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
ol.setQtyInvoiced(ol.getQtyInvoiced().add(line.getQtyInvoiced()));
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;
}
}
@ -1800,7 +1795,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
isNewMatchPO = true;
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;
}
matchPO++;
@ -1819,7 +1814,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
rmaLine.setQtyInvoiced(line.getQtyInvoiced());
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;
}
}
@ -1843,7 +1838,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
isNewMatchInv = true;
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;
}
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());
if (invAmt == null)
{
m_processMsg = new StringBuffer("Could not convert C_Currency_ID=").append(getC_Currency_ID())
.append(" to base C_Currency_ID=").append(MClient.get(Env.getCtx()).getC_Currency_ID());
m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID()
+ " to base C_Currency_ID=" + MClient.get(Env.getCtx()).getC_Currency_ID();
return DocAction.STATUS_Invalid;
}
// Total Balance
@ -1907,7 +1902,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
bp.setSOCreditStatus();
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;
}
@ -1916,11 +1911,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName());
user.setLastContact(new Timestamp(System.currentTimeMillis()));
StringBuilder msgr = new StringBuilder(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(getDocumentNo());
user.setLastResult(msgr.toString());
user.setLastResult(Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo());
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;
}
} // user
@ -1936,8 +1930,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
getDateAcct(), 0, getAD_Client_ID(), getAD_Org_ID());
if (amt == null)
{
m_processMsg = new StringBuffer("Could not convert C_Currency_ID=").append(getC_Currency_ID())
.append(" to Project C_Currency_ID=").append(C_CurrencyTo_ID);
m_processMsg = "Could not convert C_Currency_ID=" + getC_Currency_ID()
+ " to Project C_Currency_ID=" + C_CurrencyTo_ID;
return DocAction.STATUS_Invalid;
}
BigDecimal newAmt = project.getInvoicedAmt();
@ -1951,7 +1945,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
project.setInvoicedAmt(newAmt);
if (!project.save(get_TrxName()))
{
m_processMsg = new StringBuffer("Could not update Project");
m_processMsg = "Could not update Project";
return DocAction.STATUS_Invalid;
}
} // project
@ -1960,7 +1954,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
String valid = ModelValidationEngine.get().fireDocValidate(this, ModelValidator.TIMING_AFTER_COMPLETE);
if (valid != null)
{
m_processMsg = new StringBuffer(valid);
m_processMsg = valid;
return DocAction.STATUS_Invalid;
}
@ -1972,7 +1966,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (counter != null)
info.append(" - @CounterDoc@: @C_Invoice_ID@=").append(counter.getDocumentNo());
m_processMsg = new StringBuffer(info.toString().trim());
m_processMsg = info.toString().trim();
setProcessed(true);
setDocAction(DOCACTION_Close);
return DocAction.STATUS_Completed;
@ -2098,7 +2092,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.info(toString());
// 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)
return false;
@ -2106,7 +2100,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|| DOCSTATUS_Reversed.equals(getDocStatus())
|| DOCSTATUS_Voided.equals(getDocStatus()))
{
m_processMsg = new StringBuffer("Document Closed: ").append(getDocStatus());
m_processMsg = "Document Closed: " + getDocStatus();
setDocAction(DOCACTION_None);
return false;
}
@ -2130,8 +2124,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setTaxAmt(Env.ZERO);
line.setLineNetAmt(Env.ZERO);
line.setLineTotalAmt(Env.ZERO);
StringBuilder msgd = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (").append(old).append(")");
line.addDescription(msgd.toString());
line.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + old + ")");
// Unlink Shipment
if (line.getM_InOutLine_ID() != 0)
{
@ -2153,7 +2146,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
}
// 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)
return false;
@ -2170,7 +2163,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.info(toString());
// 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)
return false;
@ -2178,7 +2171,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
setDocAction(DOCACTION_None);
// 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)
return false;
return true;
@ -2192,7 +2185,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.info(toString());
// 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)
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()+"^");
if (reversal == null)
{
m_processMsg = new StringBuffer("Could not create Invoice Reversal");
m_processMsg = "Could not create Invoice Reversal";
return false;
}
reversal.setReversal(true);
@ -2254,7 +2247,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
rLine.setLineTotalAmt(rLine.getLineTotalAmt().negate());
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;
}
}
@ -2266,7 +2259,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
//
if (!reversal.processIt(DocAction.ACTION_Complete))
{
m_processMsg = new StringBuffer("Reversal ERROR: ").append(reversal.getProcessMsg());
m_processMsg = "Reversal ERROR: " + reversal.getProcessMsg();
return false;
}
reversal.setC_Payment_ID(0);
@ -2276,10 +2269,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal.setDocStatus(DOCSTATUS_Reversed);
reversal.setDocAction(DOCACTION_None);
reversal.saveEx(get_TrxName());
m_processMsg = new StringBuffer(reversal.getDocumentNo());
m_processMsg = reversal.getDocumentNo();
//
StringBuilder msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
addDescription("(" + reversal.getDocumentNo() + "<-)");
// Clean up Reversed (this)
MInvoiceLine[] iLines = getLines(false);
@ -2305,10 +2297,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
setIsPaid(true);
// 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(),
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());
if (alloc.save())
{
@ -2334,7 +2326,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
}
// 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)
return false;
@ -2349,12 +2341,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -2369,12 +2361,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.info(toString());
// 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)
return false;
// 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)
return false;
@ -2389,7 +2381,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public String getSummary()
{
StringBuilder sb = new StringBuilder();
StringBuffer sb = new StringBuffer();
sb.append(getDocumentNo());
// : Grand Total = 123.00 (#1)
sb.append(": ").
@ -2407,7 +2399,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public String getProcessMsg()
{
return m_processMsg.toString();
return m_processMsg;
} // getProcessMsg
/**

View File

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

View File

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