IDEMPIERE-308 Performance: Replace with StringBuilder / Thanks to Richard Morales and David Peñuela

This commit is contained in:
Carlos Ruiz 2012-10-01 20:33:05 -05:00
parent b65f9deeb9
commit bd96df6367
120 changed files with 1512 additions and 1355 deletions

View File

@ -57,7 +57,7 @@ public class CalloutAssignment extends CalloutEngine
return ""; return "";
int M_Product_ID = 0; int M_Product_ID = 0;
String Name = null; StringBuilder Name = null;
String Description = null; String Description = null;
BigDecimal Qty = null; BigDecimal Qty = null;
String sql = "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty " String sql = "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty "
@ -74,7 +74,7 @@ public class CalloutAssignment extends CalloutEngine
if (rs.next()) if (rs.next())
{ {
M_Product_ID = rs.getInt (1); M_Product_ID = rs.getInt (1);
Name = rs.getString(2); Name = new StringBuilder(rs.getString(2));
Description = rs.getString(3); Description = rs.getString(3);
Qty = rs.getBigDecimal(4); Qty = rs.getBigDecimal(4);
} }
@ -94,9 +94,9 @@ public class CalloutAssignment extends CalloutEngine
{ {
mTab.setValue ("M_Product_ID", new Integer (M_Product_ID)); mTab.setValue ("M_Product_ID", new Integer (M_Product_ID));
if (Description != null) if (Description != null)
Name += " (" + Description + ")"; Name.append(" (").append(Description).append(")");
if (!".".equals(Name)) if (!".".equals(Name.toString()))
mTab.setValue("Description", Name); mTab.setValue("Description", Name.toString());
// //
String variable = "Qty"; // TimeExpenseLine String variable = "Qty"; // TimeExpenseLine
if (mTab.getTableName().startsWith("C_Order")) if (mTab.getTableName().startsWith("C_Order"))

View File

@ -1317,8 +1317,9 @@ public class CalloutOrder extends CalloutEngine
BigDecimal total = available.subtract(notReserved); BigDecimal total = available.subtract(notReserved);
if (total.compareTo(QtyOrdered) < 0) if (total.compareTo(QtyOrdered) < 0)
{ {
String info = Msg.parseTranslation(ctx, "@QtyAvailable@=" + available StringBuilder msgpts = new StringBuilder("@QtyAvailable@=").append(available)
+ " - @QtyNotReserved@=" + notReserved + " = " + total); .append(" - @QtyNotReserved@=").append(notReserved).append(" = ").append(total);
String info = Msg.parseTranslation(ctx, msgpts.toString());
mTab.fireDataStatusEEvent ("InsufficientQtyAvailable", mTab.fireDataStatusEEvent ("InsufficientQtyAvailable",
info, false); info, false);
} }

View File

@ -74,7 +74,7 @@ public class MAccount extends X_C_ValidCombination
int C_Project_ID, int C_Campaign_ID, int C_Activity_ID, int C_Project_ID, int C_Campaign_ID, int C_Activity_ID,
int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID) int User1_ID, int User2_ID, int UserElement1_ID, int UserElement2_ID)
{ {
StringBuffer info = new StringBuffer(); StringBuilder info = new StringBuilder();
info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID); info.append("AD_Client_ID=").append(AD_Client_ID).append(",AD_Org_ID=").append(AD_Org_ID);
// Schema // Schema
info.append(",C_AcctSchema_ID=").append(C_AcctSchema_ID); info.append(",C_AcctSchema_ID=").append(C_AcctSchema_ID);
@ -83,7 +83,7 @@ public class MAccount extends X_C_ValidCombination
ArrayList<Object> params = new ArrayList<Object>(); ArrayList<Object> params = new ArrayList<Object>();
// Mandatory fields // Mandatory fields
StringBuffer whereClause = new StringBuffer("AD_Client_ID=?" // #1 StringBuilder whereClause = new StringBuilder("AD_Client_ID=?" // #1
+ " AND AD_Org_ID=?" + " AND AD_Org_ID=?"
+ " AND C_AcctSchema_ID=?" + " AND C_AcctSchema_ID=?"
+ " AND Account_ID=?"); // #4 + " AND Account_ID=?"); // #4
@ -422,7 +422,7 @@ public class MAccount extends X_C_ValidCombination
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MAccount=["); StringBuilder sb = new StringBuilder("MAccount=[");
sb.append(getC_ValidCombination_ID()); sb.append(getC_ValidCombination_ID());
if (getCombination() != null) if (getCombination() != null)
sb.append(",") sb.append(",")
@ -545,8 +545,8 @@ public class MAccount extends X_C_ValidCombination
*/ */
public void setValueDescription() public void setValueDescription()
{ {
StringBuffer combi = new StringBuffer(); StringBuilder combi = new StringBuilder();
StringBuffer descr = new StringBuffer(); StringBuilder descr = new StringBuilder();
boolean fullyQualified = true; boolean fullyQualified = true;
// //
MAcctSchema as = new MAcctSchema(getCtx(), getC_AcctSchema_ID(), get_TrxName()); // In Trx! MAcctSchema as = new MAcctSchema(getCtx(), getC_AcctSchema_ID(), get_TrxName()); // In Trx!

View File

@ -66,8 +66,10 @@ public final class MAccountLookup extends Lookup implements Serializable
*/ */
public String getDisplay (Object value) public String getDisplay (Object value)
{ {
if (!containsKey (value)) if (!containsKey (value)){
return "<" + value.toString() + ">"; StringBuilder msgreturn = new StringBuilder("<").append(value.toString()).append(">");
return msgreturn.toString();
}
return toString(); return toString();
} // getDisplay } // getDisplay
@ -189,9 +191,9 @@ public final class MAccountLookup extends Lookup implements Serializable
for(MAccount account :accounts) for(MAccount account :accounts)
{ {
list.add (new KeyNamePair(account.getC_ValidCombination_ID(), StringBuilder msglist = new StringBuilder(account.getCombination()).append(" - ")
account.getCombination() + " - " + .append(account.getDescription());
account.getDescription())); list.add (new KeyNamePair(account.getC_ValidCombination_ID(), msglist.toString()));
} }
// Sort & return // Sort & return
return list; return list;

View File

@ -94,8 +94,9 @@ public class MAcctProcessor extends X_C_AcctProcessor
{ {
this (client.getCtx(), 0, client.get_TrxName()); this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); setClientOrg(client);
setName (client.getName() + " - " StringBuilder msgset = new StringBuilder(client.getName()).append(" - ")
+ Msg.translate(getCtx(), "C_AcctProcessor_ID")); .append(Msg.translate(getCtx(), "C_AcctProcessor_ID"));
setName (msgset.toString());
setSupervisor_ID (Supervisor_ID); setSupervisor_ID (Supervisor_ID);
} // MAcctProcessor } // MAcctProcessor
@ -107,7 +108,8 @@ public class MAcctProcessor extends X_C_AcctProcessor
*/ */
public String getServerID () public String getServerID ()
{ {
return "AcctProcessor" + get_ID(); StringBuilder msgreturn = new StringBuilder("AcctProcessor").append(get_ID());
return msgreturn.toString();
} // getServerID } // getServerID
/** /**
@ -144,10 +146,10 @@ public class MAcctProcessor extends X_C_AcctProcessor
{ {
if (getKeepLogDays() < 1) if (getKeepLogDays() < 1)
return 0; return 0;
String sql = "DELETE C_AcctProcessorLog " StringBuilder sql = new StringBuilder("DELETE C_AcctProcessorLog ")
+ "WHERE C_AcctProcessor_ID=" + getC_AcctProcessor_ID() .append("WHERE C_AcctProcessor_ID=").append(getC_AcctProcessor_ID())
+ " AND (Created+" + getKeepLogDays() + ") < SysDate"; .append(" AND (Created+").append(getKeepLogDays()).append(") < SysDate");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
return no; return no;
} // deleteLog } // deleteLog

View File

@ -105,17 +105,17 @@ public class MAcctSchema extends X_C_AcctSchema
list.add(as); list.add(as);
ArrayList<Object> params = new ArrayList<Object>(); ArrayList<Object> params = new ArrayList<Object>();
String whereClause = "IsActive=? " StringBuilder whereClause = new StringBuilder("IsActive=? ")
+ " AND EXISTS (SELECT * FROM C_AcctSchema_GL gl WHERE C_AcctSchema.C_AcctSchema_ID=gl.C_AcctSchema_ID)" .append(" AND EXISTS (SELECT * FROM C_AcctSchema_GL gl WHERE C_AcctSchema.C_AcctSchema_ID=gl.C_AcctSchema_ID)")
+ " AND EXISTS (SELECT * FROM C_AcctSchema_Default d WHERE C_AcctSchema.C_AcctSchema_ID=d.C_AcctSchema_ID)"; .append(" AND EXISTS (SELECT * FROM C_AcctSchema_Default d WHERE C_AcctSchema.C_AcctSchema_ID=d.C_AcctSchema_ID)");
params.add("Y"); params.add("Y");
if (AD_Client_ID != 0) if (AD_Client_ID != 0)
{ {
whereClause += " AND AD_Client_ID=?"; whereClause.append(" AND AD_Client_ID=?");
params.add(AD_Client_ID); params.add(AD_Client_ID);
} }
List <MAcctSchema> ass = new Query(ctx, I_C_AcctSchema.Table_Name,whereClause,trxName) List <MAcctSchema> ass = new Query(ctx, I_C_AcctSchema.Table_Name,whereClause.toString(),trxName)
.setParameters(params) .setParameters(params)
.setOrderBy(MAcctSchema.COLUMNNAME_C_AcctSchema_ID) .setOrderBy(MAcctSchema.COLUMNNAME_C_AcctSchema_ID)
.list(); .list();
@ -195,7 +195,8 @@ public class MAcctSchema extends X_C_AcctSchema
this (client.getCtx(), 0, client.get_TrxName()); this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); setClientOrg(client);
setC_Currency_ID (currency.getKey()); setC_Currency_ID (currency.getKey());
setName (client.getName() + " " + getGAAP() + "/" + get_ColumnCount() + " " + currency.getName()); StringBuilder msgset = new StringBuilder(client.getName()).append(" ").append(getGAAP()).append("/").append(get_ColumnCount()).append(" ").append(currency.getName());
setName (msgset.toString());
} // MAcctSchema } // MAcctSchema
@ -291,7 +292,7 @@ public class MAcctSchema extends X_C_AcctSchema
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("AcctSchema["); StringBuilder sb = new StringBuilder("AcctSchema[");
sb.append(get_ID()).append("-").append(getName()) sb.append(get_ID()).append("-").append(getName())
.append("]"); .append("]");
return sb.toString(); return sb.toString();

View File

@ -388,10 +388,11 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
*/ */
public String toString() public String toString()
{ {
return "AcctSchemaElement[" + get_ID() StringBuilder msgreturn = new StringBuilder("AcctSchemaElement[").append(get_ID())
+ "-" + getName() .append("-").append(getName())
+ "(" + getElementType() + ")=" + getDefaultValue() .append("(").append(getElementType()).append(")=").append(getDefaultValue())
+ ",Pos=" + getSeqNo() + "]"; .append(",Pos=").append(getSeqNo()).append("]");
return msgreturn.toString();
} // toString } // toString
@ -486,10 +487,10 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
s_cache.clear(); s_cache.clear();
// Resequence // Resequence
if (newRecord || is_ValueChanged(COLUMNNAME_SeqNo)) if (newRecord || is_ValueChanged(COLUMNNAME_SeqNo)){
MAccount.updateValueDescription(getCtx(), StringBuilder msguvd = new StringBuilder("AD_Client_ID=").append(getAD_Client_ID());
"AD_Client_ID=" + getAD_Client_ID(), get_TrxName()); MAccount.updateValueDescription(getCtx(), msguvd.toString(), get_TrxName());
}
return success; return success;
} // afterSave } // afterSave
@ -500,16 +501,16 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
*/ */
private void updateData (String element, int id) private void updateData (String element, int id)
{ {
MAccount.updateValueDescription(getCtx(), StringBuilder msguvd = new StringBuilder(element).append("=").append(id);
element + "=" + id, get_TrxName()); MAccount.updateValueDescription(getCtx(),msguvd.toString(), get_TrxName());
// //
String sql = "UPDATE C_ValidCombination SET " + element + "=" + id StringBuilder sql = new StringBuilder("UPDATE C_ValidCombination SET ").append(element).append("=").append(id)
+ " WHERE " + element + " IS NULL AND AD_Client_ID=" + getAD_Client_ID(); .append(" WHERE ").append(element).append(" IS NULL AND AD_Client_ID=").append(getAD_Client_ID());
int noC = DB.executeUpdate(sql, get_TrxName()); int noC = DB.executeUpdate(sql.toString(), get_TrxName());
// //
sql = "UPDATE Fact_Acct SET " + element + "=" + id sql = new StringBuilder("UPDATE Fact_Acct SET ").append(element).append("=").append(id)
+ " WHERE " + element + " IS NULL AND C_AcctSchema_ID=" + getC_AcctSchema_ID(); .append(" WHERE ").append(element).append(" IS NULL AND C_AcctSchema_ID=").append(getC_AcctSchema_ID());
int noF = DB.executeUpdate(sql, get_TrxName()); int noF = DB.executeUpdate(sql.toString(), get_TrxName());
// //
log.fine("ValidCombination=" + noC + ", Fact=" + noF); log.fine("ValidCombination=" + noC + ", Fact=" + noF);
} // updateData } // updateData
@ -535,8 +536,8 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
protected boolean afterDelete (boolean success) protected boolean afterDelete (boolean success)
{ {
// Update Account Info // Update Account Info
MAccount.updateValueDescription(getCtx(), StringBuilder msguvd = new StringBuilder("AD_Client_ID=").append(getAD_Client_ID());
"AD_Client_ID=" + getAD_Client_ID(), get_TrxName()); MAccount.updateValueDescription(getCtx(),msguvd.toString(), get_TrxName());
// //
s_cache.clear(); s_cache.clear();
return success; return success;

View File

@ -98,7 +98,7 @@ public class MAchievement extends X_PA_Achievement
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAchievement["); StringBuilder sb = new StringBuilder ("MAchievement[");
sb.append (get_ID()).append ("-").append (getName()).append ("]"); sb.append (get_ID()).append ("-").append (getName()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -110,8 +110,10 @@ public class MActivity extends X_C_Activity
if (newRecord) if (newRecord)
insert_Tree(MTree_Base.TREETYPE_Activity); insert_Tree(MTree_Base.TREETYPE_Activity);
// Value/Name change // Value/Name change
if (!newRecord && (is_ValueChanged("Value") || is_ValueChanged("Name"))) if (!newRecord && (is_ValueChanged("Value") || is_ValueChanged("Name"))){
MAccount.updateValueDescription(getCtx(), "C_Activity_ID=" + getC_Activity_ID(), get_TrxName()); StringBuilder msguvd = new StringBuilder("C_Activity_ID=").append(getC_Activity_ID());
MAccount.updateValueDescription(getCtx(), msguvd.toString(), get_TrxName());
}
return true; return true;
} // afterSave } // afterSave

View File

@ -72,7 +72,8 @@ public class MAd extends X_CM_Ad
*/ */
public static MAd getNext(Properties ctx, int CM_Ad_Cat_ID, String trxName) { public static MAd getNext(Properties ctx, int CM_Ad_Cat_ID, String trxName) {
MAd thisAd = null; MAd thisAd = null;
int [] thisAds = MAd.getAllIDs("CM_Ad","ActualImpression+StartImpression<MaxImpression AND CM_Ad_Cat_ID=" + CM_Ad_Cat_ID, trxName); StringBuilder msgids = new StringBuilder("ActualImpression+StartImpression<MaxImpression AND CM_Ad_Cat_ID=").append(CM_Ad_Cat_ID);
int [] thisAds = MAd.getAllIDs("CM_Ad",msgids.toString(), trxName);
if (thisAds!=null) { if (thisAds!=null) {
for (int i=0;i<thisAds.length;i++) { for (int i=0;i<thisAds.length;i++) {
MAd tempAd = new MAd(ctx, thisAds[i], trxName); MAd tempAd = new MAd(ctx, thisAds[i], trxName);

View File

@ -273,7 +273,7 @@ public class MAging extends X_T_Aging
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MAging["); StringBuilder sb = new StringBuilder("MAging[");
sb.append("AD_PInstance_ID=").append(getAD_PInstance_ID()) sb.append("AD_PInstance_ID=").append(getAD_PInstance_ID())
.append(",C_BPartner_ID=").append(getC_BPartner_ID()) .append(",C_BPartner_ID=").append(getC_BPartner_ID())
.append(",C_Currency_ID=").append(getC_Currency_ID()) .append(",C_Currency_ID=").append(getC_Currency_ID())

View File

@ -209,7 +209,7 @@ public class MAlert extends X_AD_Alert
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAlert["); StringBuilder sb = new StringBuilder ("MAlert[");
sb.append(get_ID()) sb.append(get_ID())
.append("-").append(getName()) .append("-").append(getName())
.append(",Valid=").append(isValid()); .append(",Valid=").append(isValid());

View File

@ -88,7 +88,7 @@ public class MAlertRecipient extends X_AD_AlertRecipient
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAlertRecipient["); StringBuilder sb = new StringBuilder ("MAlertRecipient[");
sb.append(get_ID()) sb.append(get_ID())
.append(",AD_User_ID=").append(getAD_User_ID()) .append(",AD_User_ID=").append(getAD_User_ID())
.append(",AD_Role_ID=").append(getAD_Role_ID()) .append(",AD_Role_ID=").append(getAD_Role_ID())

View File

@ -99,12 +99,12 @@ public class MAlertRule extends X_AD_AlertRule
*/ */
public String getSql(boolean applySecurity) public String getSql(boolean applySecurity)
{ {
StringBuffer sql = new StringBuffer(); StringBuilder sql = new StringBuilder();
sql.append("SELECT ").append(getSelectClause()) sql.append("SELECT ").append(getSelectClause())
.append(" FROM ").append(getFromClause()); .append(" FROM ").append(getFromClause());
if (getWhereClause() != null && getWhereClause().length() > 0) if (getWhereClause() != null && getWhereClause().length() > 0)
sql.append(" WHERE ").append(getWhereClause()); sql.append(" WHERE ").append(getWhereClause());
String finalSQL = sql.toString(); StringBuilder finalSQL = new StringBuilder(sql.toString());
// //
// Apply Security: // Apply Security:
if (applySecurity) { if (applySecurity) {
@ -118,14 +118,14 @@ public class MAlertRule extends X_AD_AlertRule
if (AD_Role_ID != -1) if (AD_Role_ID != -1)
{ {
MRole role = MRole.get(getCtx(), AD_Role_ID); MRole role = MRole.get(getCtx(), AD_Role_ID);
finalSQL = role.addAccessSQL(finalSQL, null, true, false); finalSQL = new StringBuilder(role.addAccessSQL(finalSQL.toString(), null, true, false));
} }
} }
} }
// //
if (getOtherClause() != null && getOtherClause().length() > 0) if (getOtherClause() != null && getOtherClause().length() > 0)
finalSQL += " " + getOtherClause(); finalSQL.append(" ").append(getOtherClause());
return finalSQL; return finalSQL.toString();
} // getSql } // getSql
/** /**
@ -139,12 +139,14 @@ public class MAlertRule extends X_AD_AlertRule
{ {
throw new IllegalArgumentException("Parameter extension cannot be empty"); throw new IllegalArgumentException("Parameter extension cannot be empty");
} }
String name = new SimpleDateFormat("yyyyMMddhhmm").format(new Timestamp(System.currentTimeMillis())) StringBuilder msgname = new StringBuilder(new SimpleDateFormat("yyyyMMddhhmm").format(new Timestamp(System.currentTimeMillis())))
+"_"+Util.stripDiacritics(getName().trim()); .append("_").append(Util.stripDiacritics(getName().trim()));
String name = msgname.toString();
File file = null; File file = null;
try try
{ {
file = new File(System.getProperty("java.io.tmpdir"), name+"."+extension); StringBuilder msgp = new StringBuilder(name).append(".").append(extension);
file = new File(System.getProperty("java.io.tmpdir"), msgp.toString());
file.createNewFile(); file.createNewFile();
return file; return file;
} }
@ -156,7 +158,8 @@ public class MAlertRule extends X_AD_AlertRule
String filePrefix = "Alert_"; // TODO: add AD_AlertRule.FileName (maybe) String filePrefix = "Alert_"; // TODO: add AD_AlertRule.FileName (maybe)
try try
{ {
file = File.createTempFile(filePrefix, "."+extension); StringBuilder msgctf = new StringBuilder(".").append(extension);
file = File.createTempFile(filePrefix, msgctf.toString());
} }
catch (IOException e) catch (IOException e)
{ {
@ -198,16 +201,14 @@ public class MAlertRule extends X_AD_AlertRule
* @return true if success * @return true if success
*/ */
private boolean updateParent() { private boolean updateParent() {
final String sql_count = "SELECT COUNT(*) FROM "+Table_Name+" r" StringBuilder sql_count = new StringBuilder("SELECT COUNT(*) FROM ").append(Table_Name).append(" r")
+" WHERE r."+COLUMNNAME_AD_Alert_ID+"=a."+MAlert.COLUMNNAME_AD_Alert_ID .append(" WHERE r.").append(COLUMNNAME_AD_Alert_ID).append("=a.").append(MAlert.COLUMNNAME_AD_Alert_ID)
+" AND r."+COLUMNNAME_IsValid+"='N'" .append(" AND r.").append(COLUMNNAME_IsValid).append("='N'")
+" AND r.IsActive='Y'" .append(" AND r.IsActive='Y'");
; StringBuilder sql = new StringBuilder("UPDATE ").append(MAlert.Table_Name).append(" a SET ")
final String sql = "UPDATE "+MAlert.Table_Name+" a SET " .append(" ").append(MAlert.COLUMNNAME_IsValid).append("=(CASE WHEN (").append(sql_count).append(") > 0 THEN 'N' ELSE 'Y' END)")
+" "+MAlert.COLUMNNAME_IsValid+"=(CASE WHEN ("+sql_count+") > 0 THEN 'N' ELSE 'Y' END)" .append(" WHERE a.").append(MAlert.COLUMNNAME_AD_Alert_ID).append("=?");
+" WHERE a."+MAlert.COLUMNNAME_AD_Alert_ID+"=?" int no = DB.executeUpdate(sql.toString(), getAD_Alert_ID(), get_TrxName());
;
int no = DB.executeUpdate(sql, getAD_Alert_ID(), get_TrxName());
return no == 1; return no == 1;
} }
@ -217,7 +218,7 @@ public class MAlertRule extends X_AD_AlertRule
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAlertRule["); StringBuilder sb = new StringBuilder ("MAlertRule[");
sb.append(get_ID()) sb.append(get_ID())
.append("-").append(getName()) .append("-").append(getName())
.append(",Valid=").append(isValid()) .append(",Valid=").append(isValid())

View File

@ -278,10 +278,10 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
String sql = "UPDATE C_AllocationHdr SET Processed='" StringBuilder sql = new StringBuilder("UPDATE C_AllocationHdr SET Processed='")
+ (processed ? "Y" : "N") .append((processed ? "Y" : "N"))
+ "' WHERE C_AllocationHdr_ID=" + getC_AllocationHdr_ID(); .append("' WHERE C_AllocationHdr_ID=").append(getC_AllocationHdr_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
m_lines = null; m_lines = null;
log.fine(processed + " - #" + no); log.fine(processed + " - #" + no);
} // setProcessed } // setProcessed
@ -411,10 +411,10 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{ {
if (line.getC_Invoice_ID() != 0) if (line.getC_Invoice_ID() != 0)
{ {
final String whereClause = I_C_Invoice.COLUMNNAME_C_Invoice_ID + "=? AND " StringBuilder whereClause = new StringBuilder(I_C_Invoice.COLUMNNAME_C_Invoice_ID).append("=? AND ")
+ I_C_Invoice.COLUMNNAME_IsPaid + "=? AND " .append(I_C_Invoice.COLUMNNAME_IsPaid).append("=? AND ")
+ I_C_Invoice.COLUMNNAME_DocStatus + " NOT IN (?,?)"; .append(I_C_Invoice.COLUMNNAME_DocStatus).append(" NOT IN (?,?)");
boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause, get_TrxName()) boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause.toString(), get_TrxName())
.setClient_ID() .setClient_ID()
.setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed) .setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed)
.match(); .match();
@ -638,7 +638,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAllocationHdr["); StringBuilder sb = new StringBuilder ("MAllocationHdr[");
sb.append(get_ID()).append("-").append(getSummary()).append ("]"); sb.append(get_ID()).append("-").append(getSummary()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString
@ -649,7 +649,8 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/ */
public String getDocumentInfo() public String getDocumentInfo()
{ {
return Msg.getElement(getCtx(), "C_AllocationHdr_ID") + " " + getDocumentNo(); StringBuilder msgreturn = new StringBuilder(Msg.getElement(getCtx(), "C_AllocationHdr_ID")).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
/** /**
@ -660,7 +661,8 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{ {
try try
{ {
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf"); StringBuilder msgctf = new StringBuilder(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgctf.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -689,7 +691,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")

View File

@ -221,7 +221,7 @@ public class MAllocationLine extends X_C_AllocationLine
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAllocationLine["); StringBuilder sb = new StringBuilder ("MAllocationLine[");
sb.append(get_ID()); sb.append(get_ID());
if (getC_Payment_ID() != 0) if (getC_Payment_ID() != 0)
sb.append(",C_Payment_ID=").append(getC_Payment_ID()); sb.append(",C_Payment_ID=").append(getC_Payment_ID());
@ -296,12 +296,12 @@ public class MAllocationLine extends X_C_AllocationLine
} }
// Link to Order // Link to Order
String update = "UPDATE C_Order o " StringBuilder update = new StringBuilder("UPDATE C_Order o ")
+ "SET C_Payment_ID=" .append("SET C_Payment_ID=")
+ (reverse ? "NULL " : "(SELECT C_Payment_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ") .append((reverse ? "NULL " : "(SELECT C_Payment_ID FROM C_Invoice WHERE C_Invoice_ID=")).append(C_Invoice_ID).append(") ")
+ "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i " .append("WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i ")
+ "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")"; .append("WHERE i.C_Invoice_ID=").append(C_Invoice_ID).append(")");
if (DB.executeUpdate(update, get_TrxName()) > 0) if (DB.executeUpdate(update.toString(), get_TrxName()) > 0)
log.fine("C_Payment_ID=" + C_Payment_ID log.fine("C_Payment_ID=" + C_Payment_ID
+ (reverse ? " UnLinked from" : " Linked to") + (reverse ? " UnLinked from" : " Linked to")
+ " order of C_Invoice_ID=" + C_Invoice_ID); + " order of C_Invoice_ID=" + C_Invoice_ID);
@ -325,12 +325,12 @@ public class MAllocationLine extends X_C_AllocationLine
} }
// Link to Order // Link to Order
String update = "UPDATE C_Order o " StringBuilder update = new StringBuilder("UPDATE C_Order o ")
+ "SET C_CashLine_ID=" .append("SET C_CashLine_ID=")
+ (reverse ? "NULL " : "(SELECT C_CashLine_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ") .append((reverse ? "NULL " : "(SELECT C_CashLine_ID FROM C_Invoice WHERE C_Invoice_ID=")).append(C_Invoice_ID).append(") ")
+ "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i " .append("WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i ")
+ "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")"; .append("WHERE i.C_Invoice_ID=").append(C_Invoice_ID).append(")");
if (DB.executeUpdate(update, get_TrxName()) > 0) if (DB.executeUpdate(update.toString(), get_TrxName()) > 0)
log.fine("C_CashLine_ID=" + C_CashLine_ID log.fine("C_CashLine_ID=" + C_CashLine_ID
+ (reverse ? " UnLinked from" : " Linked to") + (reverse ? " UnLinked from" : " Linked to")
+ " order of C_Invoice_ID=" + C_Invoice_ID); + " order of C_Invoice_ID=" + C_Invoice_ID);

View File

@ -79,13 +79,13 @@ public class MArchive extends X_AD_Archive {
public static MArchive[] get(Properties ctx, String whereClause) { public static MArchive[] get(Properties ctx, String whereClause) {
ArrayList<MArchive> list = new ArrayList<MArchive>(); ArrayList<MArchive> list = new ArrayList<MArchive>();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String sql = "SELECT * FROM AD_Archive WHERE AD_Client_ID=?"; StringBuilder sql = new StringBuilder("SELECT * FROM AD_Archive WHERE AD_Client_ID=?");
if (whereClause != null && whereClause.length() > 0) if (whereClause != null && whereClause.length() > 0)
sql += whereClause; sql.append(whereClause);
sql += " ORDER BY Created"; sql.append(" ORDER BY Created");
try { try {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, Env.getAD_Client_ID(ctx)); pstmt.setInt(1, Env.getAD_Client_ID(ctx));
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
@ -94,7 +94,7 @@ public class MArchive extends X_AD_Archive {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} catch (Exception e) { } catch (Exception e) {
s_log.log(Level.SEVERE, sql, e); s_log.log(Level.SEVERE, sql.toString(), e);
} }
try { try {
if (pstmt != null) if (pstmt != null)
@ -104,9 +104,9 @@ public class MArchive extends X_AD_Archive {
pstmt = null; pstmt = null;
} }
if (list.size() == 0) if (list.size() == 0)
s_log.fine(sql); s_log.fine(sql.toString());
else else
s_log.finer(sql); s_log.finer(sql.toString());
// //
MArchive[] retValue = new MArchive[list.size()]; MArchive[] retValue = new MArchive[list.size()];
list.toArray(retValue); list.toArray(retValue);
@ -215,12 +215,12 @@ public class MArchive extends X_AD_Archive {
* @return info * @return info
*/ */
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer("MArchive["); StringBuilder sb = new StringBuilder("MArchive[");
sb.append(get_ID()).append(",Name=").append(getName()); sb.append(get_ID()).append(",Name=").append(getName());
if (m_inflated != null) if (m_inflated != null)
sb.append(",Inflated=" + m_inflated); sb.append(",Inflated=").append(m_inflated);
if (m_deflated != null) if (m_deflated != null)
sb.append(",Deflated=" + m_deflated); sb.append(",Deflated=").append(m_deflated);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} // toString } // toString
@ -419,8 +419,9 @@ public class MArchive extends X_AD_Archive {
} }
} }
// write to pdf // write to pdf
final File destFile = new File(m_archivePathRoot + File.separator StringBuilder msgfile = new StringBuilder(m_archivePathRoot).append(File.separator)
+ getArchivePathSnippet() + this.get_ID() + ".pdf"); .append(getArchivePathSnippet()).append(this.get_ID()).append(".pdf");
final File destFile = new File(msgfile.toString());
out = new BufferedOutputStream(new FileOutputStream(destFile)); out = new BufferedOutputStream(new FileOutputStream(destFile));
out.write(inflatedData); out.write(inflatedData);
@ -433,7 +434,8 @@ public class MArchive extends X_AD_Archive {
document.appendChild(root); document.appendChild(root);
document.setXmlStandalone(true); document.setXmlStandalone(true);
final Element entry = document.createElement("entry"); final Element entry = document.createElement("entry");
entry.setAttribute("file", ARCHIVE_FOLDER_PLACEHOLDER + getArchivePathSnippet() + this.get_ID() + ".pdf"); StringBuilder msgsat = new StringBuilder(ARCHIVE_FOLDER_PLACEHOLDER).append(getArchivePathSnippet()).append(this.get_ID()).append(".pdf");
entry.setAttribute("file", msgsat.toString());
root.appendChild(entry); root.appendChild(entry);
final Source source = new DOMSource(document); final Source source = new DOMSource(document);
final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final ByteArrayOutputStream bos = new ByteArrayOutputStream();
@ -538,19 +540,19 @@ public class MArchive extends X_AD_Archive {
* @return String * @return String
*/ */
private String getArchivePathSnippet() { private String getArchivePathSnippet() {
String path = this.getAD_Client_ID() + File.separator + this.getAD_Org_ID() StringBuilder path = new StringBuilder(this.getAD_Client_ID()).append(File.separator).append(this.getAD_Org_ID())
+ File.separator; .append(File.separator);
if (this.getAD_Process_ID() > 0) { if (this.getAD_Process_ID() > 0) {
path = path + this.getAD_Process_ID() + File.separator; path.append(this.getAD_Process_ID()).append(File.separator);
} }
if (this.getAD_Table_ID() > 0) { if (this.getAD_Table_ID() > 0) {
path = path + this.getAD_Table_ID() + File.separator; path.append(this.getAD_Table_ID()).append(File.separator);
} }
if (this.getRecord_ID() > 0) { if (this.getRecord_ID() > 0) {
path = path + this.getRecord_ID() + File.separator; path.append(this.getRecord_ID()).append(File.separator);
} }
// path = path + this.get_ID() + ".pdf"; // path = path + this.get_ID() + ".pdf";
return path; return path.toString();
} }
/** /**

View File

@ -183,20 +183,21 @@ public class MAsset extends X_A_Asset
public void setValueNameDescription (MInOut shipment, public void setValueNameDescription (MInOut shipment,
int deliveryCount, MProduct product, MBPartner partner) int deliveryCount, MProduct product, MBPartner partner)
{ {
String documentNo = "_" + shipment.getDocumentNo(); StringBuilder documentNo = new StringBuilder("_").append(shipment.getDocumentNo());
if (deliveryCount > 1) if (deliveryCount > 1)
documentNo += "_" + deliveryCount; documentNo.append("_").append(deliveryCount);
// Value // Value
String value = partner.getValue() + "_" + product.getValue(); StringBuilder value = new StringBuilder(partner.getValue()).append("_").append(product.getValue());
if (value.length() > 40-documentNo.length()) if (value.length() > 40-documentNo.length())
value = value.substring(0,40-documentNo.length()) + documentNo; value.delete(40-documentNo.length(), value.length()).append(documentNo);
setValue(value);
setValue(value.toString());
// Name MProduct.afterSave // Name MProduct.afterSave
String name = partner.getName() + " - " + product.getName(); StringBuilder name = new StringBuilder(partner.getName()).append(" - ").append(product.getName());
if (name.length() > 60) if (name.length() > 60)
name = name.substring(0,60); name.delete(60,name.length());
setName(name); setName(name.toString());
// Description // Description
String description = product.getDescription(); String description = product.getDescription();
setDescription(description); setDescription(description);
@ -211,8 +212,10 @@ public class MAsset extends X_A_Asset
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgsd= new StringBuilder(desc).append(" | ").append(description);
setDescription(msgsd.toString());
}
} // addDescription } // addDescription
/** /**
@ -233,7 +236,7 @@ public class MAsset extends X_A_Asset
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAsset[") StringBuilder sb = new StringBuilder ("MAsset[")
.append (get_ID ()) .append (get_ID ())
.append("-").append(getValue()) .append("-").append(getValue())
.append ("]"); .append ("]");

View File

@ -124,7 +124,7 @@ public class MAssetDelivery extends X_A_Asset_Delivery
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAssetDelivery[") StringBuilder sb = new StringBuilder ("MAssetDelivery[")
.append (get_ID ()) .append (get_ID ())
.append(",A_Asset_ID=").append(getA_Asset_ID()) .append(",A_Asset_ID=").append(getA_Asset_ID())
.append(",MovementDate=").append(getMovementDate()) .append(",MovementDate=").append(getMovementDate())

View File

@ -438,7 +438,7 @@ public class MAssignmentSlot implements Comparator
return getInfo(); return getInfo();
// DISPLAY_ALL // DISPLAY_ALL
StringBuffer sb = new StringBuffer("MAssignmentSlot["); StringBuilder sb = new StringBuilder("MAssignmentSlot[");
sb.append(m_startTime).append("-").append(m_endTime) sb.append(m_startTime).append("-").append(m_endTime)
.append("-Status=").append(m_status).append(",Name=") .append("-Status=").append(m_status).append(",Name=")
.append(m_name).append(",").append(m_description).append("]"); .append(m_name).append(",").append(m_description).append("]");
@ -460,7 +460,7 @@ public class MAssignmentSlot implements Comparator
*/ */
public String getInfoTimeFromTo() public String getInfoTimeFromTo()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(m_language.getTimeFormat().format(m_startTime)) sb.append(m_language.getTimeFormat().format(m_startTime))
.append(" - ") .append(" - ")
.append(m_language.getTimeFormat().format(m_endTime)); .append(m_language.getTimeFormat().format(m_endTime));
@ -473,7 +473,7 @@ public class MAssignmentSlot implements Comparator
*/ */
public String getInfoDateTimeFromTo() public String getInfoDateTimeFromTo()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(m_language.getDateTimeFormat().format(m_startTime)) sb.append(m_language.getDateTimeFormat().format(m_startTime))
.append(" - "); .append(" - ");
if (TimeUtil.isSameDay(m_startTime, m_endTime)) if (TimeUtil.isSameDay(m_startTime, m_endTime))
@ -489,7 +489,7 @@ public class MAssignmentSlot implements Comparator
*/ */
public String getInfoNameDescription() public String getInfoNameDescription()
{ {
StringBuffer sb = new StringBuffer(m_name); StringBuilder sb = new StringBuilder(m_name);
if (m_description.length() > 0) if (m_description.length() > 0)
sb.append(" (").append(m_description).append(")"); sb.append(" (").append(m_description).append(")");
return sb.toString(); return sb.toString();
@ -501,7 +501,7 @@ public class MAssignmentSlot implements Comparator
*/ */
public String getInfo() public String getInfo()
{ {
StringBuffer sb = new StringBuffer(getInfoDateTimeFromTo()); StringBuilder sb = new StringBuilder(getInfoDateTimeFromTo());
sb.append(": ").append(m_name); sb.append(": ").append(m_name);
if (m_description.length() > 0) if (m_description.length() > 0)
sb.append(" (").append(m_description).append(")"); sb.append(" (").append(m_description).append(")");

View File

@ -222,7 +222,7 @@ public class MAttachment extends X_AD_Attachment
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MAttachment["); StringBuilder sb = new StringBuilder("MAttachment[");
sb.append(getAD_Attachment_ID()).append(",Title=").append(getTitle()) sb.append(getAD_Attachment_ID()).append(",Title=").append(getTitle())
.append(",Entries=").append(getEntryCount()); .append(",Entries=").append(getEntryCount());
for (int i = 0; i < getEntryCount(); i++) for (int i = 0; i < getEntryCount(); i++)
@ -435,9 +435,12 @@ public class MAttachment extends X_AD_Attachment
System.out.println("- no entries -"); System.out.println("- no entries -");
return; return;
} }
System.out.println("- entries: " + m_items.size()); StringBuilder msgout = new StringBuilder("- entries: ").append(m_items.size());
for (int i = 0; i < m_items.size(); i++) System.out.println(msgout.toString());
System.out.println(" - " + getEntryName(i)); for (int i = 0; i < m_items.size(); i++){
msgout = new StringBuilder(" - ").append(getEntryName(i));
System.out.println(msgout.toString());
}
} // dumpEntryNames } // dumpEntryNames
/** /**
@ -576,14 +579,16 @@ public class MAttachment extends X_AD_Attachment
FileChannel out = null; FileChannel out = null;
try { try {
//create destination folder //create destination folder
final File destFolder = new File(m_attachmentPathRoot + File.separator + getAttachmentPathSnippet()); StringBuilder msgfile = new StringBuilder(m_attachmentPathRoot).append(File.separator).append(getAttachmentPathSnippet());
final File destFolder = new File(msgfile.toString());
if(!destFolder.exists()){ if(!destFolder.exists()){
if(!destFolder.mkdirs()){ if(!destFolder.mkdirs()){
log.warning("unable to create folder: " + destFolder.getPath()); log.warning("unable to create folder: " + destFolder.getPath());
} }
} }
final File destFile = new File(m_attachmentPathRoot + File.separator msgfile = new StringBuilder(m_attachmentPathRoot).append(File.separator)
+ getAttachmentPathSnippet() + File.separator + entryFile.getName()); .append(getAttachmentPathSnippet()).append(File.separator).append(entryFile.getName());
final File destFile = new File(msgfile.toString());
in = new FileInputStream(entryFile).getChannel(); in = new FileInputStream(entryFile).getChannel();
out = new FileOutputStream(destFile).getChannel(); out = new FileOutputStream(destFile).getChannel();
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
@ -808,9 +813,11 @@ public class MAttachment extends X_AD_Attachment
* @return String * @return String
*/ */
private String getAttachmentPathSnippet(){ private String getAttachmentPathSnippet(){
return this.getAD_Client_ID() + File.separator +
this.getAD_Org_ID() + File.separator + StringBuilder msgreturn = new StringBuilder(this.getAD_Client_ID()).append(File.separator)
this.getAD_Table_ID() + File.separator + this.getRecord_ID(); .append(this.getAD_Org_ID()).append(File.separator)
.append(this.getAD_Table_ID()).append(File.separator).append(this.getRecord_ID());
return msgreturn.toString();
} }
/** /**

View File

@ -144,7 +144,7 @@ public class MAttachmentEntry
*/ */
public String toStringX () public String toStringX ()
{ {
StringBuffer sb = new StringBuffer (m_name); StringBuilder sb = new StringBuilder (m_name);
if (m_data != null) if (m_data != null)
{ {
sb.append(" ("); sb.append(" (");
@ -176,8 +176,8 @@ public class MAttachmentEntry
*/ */
public void dump () public void dump ()
{ {
String hdr = "----- " + getName() + " -----"; StringBuilder hdr = new StringBuilder("----- ").append(getName()).append(" -----");
System.out.println (hdr); System.out.println (hdr.toString());
if (m_data == null) if (m_data == null)
{ {
System.out.println ("----- no data -----"); System.out.println ("----- no data -----");
@ -191,14 +191,15 @@ public class MAttachmentEntry
} }
System.out.println (); System.out.println ();
System.out.println (hdr); System.out.println (hdr.toString());
// Count nulls at end // Count nulls at end
int ii = m_data.length -1; int ii = m_data.length -1;
int nullCount = 0; int nullCount = 0;
while (m_data[ii--] == 0) while (m_data[ii--] == 0)
nullCount++; nullCount++;
System.out.println("----- Length=" + m_data.length + ", EndNulls=" + nullCount StringBuilder msgout = new StringBuilder("----- Length=").append(m_data.length).append(", EndNulls=").append(nullCount)
+ ", RealLength=" + (m_data.length-nullCount)); .append(", RealLength=").append((m_data.length-nullCount));
System.out.println(msgout.toString());
/** /**
// Dump w/o nulls // Dump w/o nulls
if (nullCount > 0) if (nullCount > 0)

View File

@ -64,9 +64,9 @@ public class MAttribute extends X_M_Attribute
sql += " AND AttributeValueType=?"; sql += " AND AttributeValueType=?";
params.add(MAttribute.ATTRIBUTEVALUETYPE_List); params.add(MAttribute.ATTRIBUTEVALUETYPE_List);
} }
final String whereClause = "AD_Client_ID=?"+sql; StringBuilder whereClause = new StringBuilder("AD_Client_ID=?").append(sql);
List<MAttribute>list = new Query(ctx,I_M_Attribute.Table_Name,whereClause,null) List<MAttribute>list = new Query(ctx,I_M_Attribute.Table_Name,whereClause.toString(),null)
.setParameters(params) .setParameters(params)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setOrderBy("Name") .setOrderBy("Name")
@ -224,7 +224,7 @@ public class MAttribute extends X_M_Attribute
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MAttribute["); StringBuilder sb = new StringBuilder ("MAttribute[");
sb.append (get_ID()).append ("-").append (getName()) sb.append (get_ID()).append ("-").append (getName())
.append(",Type=").append(getAttributeValueType()) .append(",Type=").append(getAttributeValueType())
.append(",Instance=").append(isInstanceAttribute()) .append(",Instance=").append(isInstanceAttribute())
@ -243,13 +243,13 @@ public class MAttribute extends X_M_Attribute
// Changed to Instance Attribute // Changed to Instance Attribute
if (!newRecord && is_ValueChanged("IsInstanceAttribute") && isInstanceAttribute()) if (!newRecord && is_ValueChanged("IsInstanceAttribute") && isInstanceAttribute())
{ {
String sql = "UPDATE M_AttributeSet mas " StringBuilder sql = new StringBuilder("UPDATE M_AttributeSet mas ")
+ "SET IsInstanceAttribute='Y' " .append("SET IsInstanceAttribute='Y' ")
+ "WHERE IsInstanceAttribute='N'" .append("WHERE IsInstanceAttribute='N'")
+ " AND EXISTS (SELECT * FROM M_AttributeUse mau " .append(" AND EXISTS (SELECT * FROM M_AttributeUse mau ")
+ "WHERE mas.M_AttributeSet_ID=mau.M_AttributeSet_ID" .append("WHERE mas.M_AttributeSet_ID=mau.M_AttributeSet_ID")
+ " AND mau.M_Attribute_ID=" + getM_Attribute_ID() + ")"; .append(" AND mau.M_Attribute_ID=").append(getM_Attribute_ID()).append(")");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("AttributeSet Instance set #" + no); log.fine("AttributeSet Instance set #" + no);
} }
return success; return success;

View File

@ -131,7 +131,7 @@ public class MAttributeInstance extends X_M_AttributeInstance
} }
// Display number w/o decimal 0 // Display number w/o decimal 0
char[] chars = ValueNumber.toString().toCharArray(); char[] chars = ValueNumber.toString().toCharArray();
StringBuffer display = new StringBuffer(); StringBuilder display = new StringBuilder();
boolean add = false; boolean add = false;
for (int i = chars.length-1; i >= 0; i--) for (int i = chars.length-1; i >= 0; i--)
{ {

View File

@ -385,18 +385,18 @@ public class MAttributeSet extends X_M_AttributeSet
// Set Instance Attribute // Set Instance Attribute
if (!isInstanceAttribute()) if (!isInstanceAttribute())
{ {
String sql = "UPDATE M_AttributeSet mas" StringBuilder sql = new StringBuilder("UPDATE M_AttributeSet mas")
+ " SET IsInstanceAttribute='Y' " .append(" SET IsInstanceAttribute='Y' ")
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID() .append("WHERE M_AttributeSet_ID=").append(getM_AttributeSet_ID())
+ " AND IsInstanceAttribute='N'" .append(" AND IsInstanceAttribute='N'")
+ " AND (IsSerNo='Y' OR IsLot='Y' OR IsGuaranteeDate='Y'" .append(" AND (IsSerNo='Y' OR IsLot='Y' OR IsGuaranteeDate='Y'")
+ " OR EXISTS (SELECT * FROM M_AttributeUse mau" .append(" OR EXISTS (SELECT * FROM M_AttributeUse mau")
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) " .append(" INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) ")
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID" .append("WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID")
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'" .append(" AND mau.IsActive='Y' AND ma.IsActive='Y'")
+ " AND ma.IsInstanceAttribute='Y')" .append(" AND ma.IsInstanceAttribute='Y')")
+ ")"; .append(")");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
{ {
log.warning("Set Instance Attribute"); log.warning("Set Instance Attribute");
@ -406,17 +406,17 @@ public class MAttributeSet extends X_M_AttributeSet
// Reset Instance Attribute // Reset Instance Attribute
if (isInstanceAttribute() && !isSerNo() && !isLot() && !isGuaranteeDate()) if (isInstanceAttribute() && !isSerNo() && !isLot() && !isGuaranteeDate())
{ {
String sql = "UPDATE M_AttributeSet mas" StringBuilder sql = new StringBuilder("UPDATE M_AttributeSet mas")
+ " SET IsInstanceAttribute='N' " .append(" SET IsInstanceAttribute='N' ")
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID() .append("WHERE M_AttributeSet_ID=").append(getM_AttributeSet_ID())
+ " AND IsInstanceAttribute='Y'" .append(" AND IsInstanceAttribute='Y'")
+ " AND IsSerNo='N' AND IsLot='N' AND IsGuaranteeDate='N'" .append(" AND IsSerNo='N' AND IsLot='N' AND IsGuaranteeDate='N'")
+ " AND NOT EXISTS (SELECT * FROM M_AttributeUse mau" .append(" AND NOT EXISTS (SELECT * FROM M_AttributeUse mau")
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) " .append(" INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) ")
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID" .append("WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID")
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'" .append(" AND mau.IsActive='Y' AND ma.IsActive='Y'")
+ " AND ma.IsInstanceAttribute='Y')"; .append(" AND ma.IsInstanceAttribute='Y')");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
{ {
log.warning("Reset Instance Attribute"); log.warning("Reset Instance Attribute");

View File

@ -186,7 +186,7 @@ public class MAttributeSetInstance extends X_M_AttributeSetInstance
return; return;
} }
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
// Instance Attribute Values // Instance Attribute Values
MAttribute[] attributes = m_mas.getMAttributes(true); MAttribute[] attributes = m_mas.getMAttributes(true);

View File

@ -70,32 +70,32 @@ public class MAttributeUse extends X_M_AttributeUse
protected boolean afterSave (boolean newRecord, boolean success) protected boolean afterSave (boolean newRecord, boolean success)
{ {
// also used for afterDelete // also used for afterDelete
String sql = "UPDATE M_AttributeSet mas" StringBuilder sql = new StringBuilder("UPDATE M_AttributeSet mas")
+ " SET IsInstanceAttribute='Y' " .append(" SET IsInstanceAttribute='Y' ")
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID() .append("WHERE M_AttributeSet_ID=").append(getM_AttributeSet_ID())
+ " AND IsInstanceAttribute='N'" .append(" AND IsInstanceAttribute='N'")
+ " AND (IsSerNo='Y' OR IsLot='Y' OR IsGuaranteeDate='Y'" .append(" AND (IsSerNo='Y' OR IsLot='Y' OR IsGuaranteeDate='Y'")
+ " OR EXISTS (SELECT * FROM M_AttributeUse mau" .append(" OR EXISTS (SELECT * FROM M_AttributeUse mau")
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) " .append(" INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) ")
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID" .append("WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID")
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'" .append(" AND mau.IsActive='Y' AND ma.IsActive='Y'")
+ " AND ma.IsInstanceAttribute='Y')" .append(" AND ma.IsInstanceAttribute='Y')")
+ ")"; .append(")");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("afterSave - Set Instance Attribute"); log.fine("afterSave - Set Instance Attribute");
// //
sql = "UPDATE M_AttributeSet mas" sql = new StringBuilder("UPDATE M_AttributeSet mas")
+ " SET IsInstanceAttribute='N' " .append(" SET IsInstanceAttribute='N' ")
+ "WHERE M_AttributeSet_ID=" + getM_AttributeSet_ID() .append("WHERE M_AttributeSet_ID=").append(getM_AttributeSet_ID())
+ " AND IsInstanceAttribute='Y'" .append(" AND IsInstanceAttribute='Y'")
+ " AND IsSerNo='N' AND IsLot='N' AND IsGuaranteeDate='N'" .append(" AND IsSerNo='N' AND IsLot='N' AND IsGuaranteeDate='N'")
+ " AND NOT EXISTS (SELECT * FROM M_AttributeUse mau" .append(" AND NOT EXISTS (SELECT * FROM M_AttributeUse mau")
+ " INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) " .append(" INNER JOIN M_Attribute ma ON (mau.M_Attribute_ID=ma.M_Attribute_ID) ")
+ "WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID" .append("WHERE mau.M_AttributeSet_ID=mas.M_AttributeSet_ID")
+ " AND mau.IsActive='Y' AND ma.IsActive='Y'" .append(" AND mau.IsActive='Y' AND ma.IsActive='Y'")
+ " AND ma.IsInstanceAttribute='Y')"; .append(" AND ma.IsInstanceAttribute='Y')");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.fine("afterSave - Reset Instance Attribute"); log.fine("afterSave - Reset Instance Attribute");

View File

@ -67,10 +67,10 @@ public class MBOM extends X_M_BOM
String trxName, String whereClause) String trxName, String whereClause)
{ {
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
String where = "M_Product_ID=?"; StringBuilder where = new StringBuilder("M_Product_ID=?");
if (whereClause != null && whereClause.length() > 0) if (whereClause != null && whereClause.length() > 0)
where += " AND " + whereClause; where.append(" AND ").append(whereClause);
List <MBOM> list = new Query(ctx, I_M_BOM.Table_Name, where, trxName) List <MBOM> list = new Query(ctx, I_M_BOM.Table_Name, where.toString(), trxName)
.setParameters(M_Product_ID) .setParameters(M_Product_ID)
.list(); .list();
@ -128,8 +128,8 @@ public class MBOM extends X_M_BOM
// Only one Current Active // Only one Current Active
if (getBOMType().equals(BOMTYPE_CurrentActive)) if (getBOMType().equals(BOMTYPE_CurrentActive))
{ {
MBOM[] boms = getOfProduct(getCtx(), getM_Product_ID(), get_TrxName(), StringBuilder msgofp = new StringBuilder("BOMType='A' AND BOMUse='").append(getBOMUse()).append("' AND IsActive='Y'");
"BOMType='A' AND BOMUse='" + getBOMUse() + "' AND IsActive='Y'"); MBOM[] boms = getOfProduct(getCtx(), getM_Product_ID(), get_TrxName(),msgofp.toString());
if (boms.length == 0 // only one = this if (boms.length == 0 // only one = this
|| (boms.length == 1 && boms[0].getM_BOM_ID() == getM_BOM_ID())) || (boms.length == 1 && boms[0].getM_BOM_ID() == getM_BOM_ID()))
; ;

View File

@ -188,7 +188,7 @@ public class MBPBankAccount extends X_C_BP_BankAccount
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MBP_BankAccount[") StringBuilder sb = new StringBuilder ("MBP_BankAccount[")
.append (get_ID ()) .append (get_ID ())
.append(", Name=").append(getA_Name()) .append(", Name=").append(getA_Name())
.append ("]"); .append ("]");

View File

@ -531,7 +531,7 @@ public class MBPartner extends X_C_BPartner
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MBPartner[ID=") StringBuilder sb = new StringBuilder ("MBPartner[ID=")
.append(get_ID()) .append(get_ID())
.append(",Value=").append(getValue()) .append(",Value=").append(getValue())
.append(",Name=").append(getName()) .append(",Name=").append(getName())
@ -988,18 +988,18 @@ public class MBPartner extends X_C_BPartner
// Trees // Trees
insert_Tree(MTree_Base.TREETYPE_BPartner); insert_Tree(MTree_Base.TREETYPE_BPartner);
// Accounting // Accounting
insert_Accounting("C_BP_Customer_Acct", "C_BP_Group_Acct", StringBuilder msgacc = new StringBuilder("p.C_BP_Group_ID=").append(getC_BP_Group_ID());
"p.C_BP_Group_ID=" + getC_BP_Group_ID()); insert_Accounting("C_BP_Customer_Acct", "C_BP_Group_Acct", msgacc.toString());
insert_Accounting("C_BP_Vendor_Acct", "C_BP_Group_Acct", insert_Accounting("C_BP_Vendor_Acct", "C_BP_Group_Acct",msgacc.toString());
"p.C_BP_Group_ID=" + getC_BP_Group_ID());
insert_Accounting("C_BP_Employee_Acct", "C_AcctSchema_Default", null); insert_Accounting("C_BP_Employee_Acct", "C_AcctSchema_Default", null);
} }
// Value/Name change // Value/Name change
if (success && !newRecord if (success && !newRecord
&& (is_ValueChanged("Value") || is_ValueChanged("Name"))) && (is_ValueChanged("Value") || is_ValueChanged("Name"))){
MAccount.updateValueDescription(getCtx(), "C_BPartner_ID=" + getC_BPartner_ID(), get_TrxName()); StringBuilder msgacc = new StringBuilder("C_BPartner_ID=").append(getC_BPartner_ID());
MAccount.updateValueDescription(getCtx(), msgacc.toString(), get_TrxName());
}
return success; return success;
} // afterSave } // afterSave

View File

@ -52,8 +52,8 @@ public class MBPartnerInfo extends X_RV_BPartner
public static MBPartnerInfo[] find (Properties ctx, public static MBPartnerInfo[] find (Properties ctx,
String Value, String Name, String Contact, String EMail, String Phone, String City) String Value, String Name, String Contact, String EMail, String Phone, String City)
{ {
StringBuffer sql = new StringBuffer ("SELECT * FROM RV_BPartner WHERE IsActive='Y'"); StringBuilder sql = new StringBuilder ("SELECT * FROM RV_BPartner WHERE IsActive='Y'");
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
Value = getFindParameter (Value); Value = getFindParameter (Value);
if (Value != null) if (Value != null)
sb.append("UPPER(Value) LIKE ?"); sb.append("UPPER(Value) LIKE ?");

View File

@ -125,7 +125,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
/** Cached Location */ /** Cached Location */
private MLocation m_location = null; private MLocation m_location = null;
/** Unique Name */ /** Unique Name */
private String m_uniqueName = null; private StringBuffer m_uniqueName = null;
private int m_unique = 0; private int m_unique = 0;
/** /**
@ -148,7 +148,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
* @return info * @return info
*/ */
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer("MBPartner_Location[ID=") StringBuilder sb = new StringBuilder("MBPartner_Location[ID=")
.append(get_ID()).append(",C_Location_ID=") .append(get_ID()).append(",C_Location_ID=")
.append(getC_Location_ID()).append(",Name=").append(getName()) .append(getC_Location_ID()).append(",Name=").append(getName())
.append("]"); .append("]");
@ -181,21 +181,21 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
* address * address
*/ */
private void makeUnique(MLocation address) { private void makeUnique(MLocation address) {
m_uniqueName = ""; m_uniqueName = new StringBuffer();
// 0 - City // 0 - City
if (m_unique >= 0 || m_uniqueName.length() == 0) { if (m_unique >= 0 || m_uniqueName.length() == 0) {
String xx = address.getCity(); String xx = address.getCity();
if (xx != null && xx.length() > 0) if (xx != null && xx.length() > 0)
m_uniqueName = xx; m_uniqueName = new StringBuffer(xx);
} }
// 1 + Address1 // 1 + Address1
if (m_unique >= 1 || m_uniqueName.length() == 0) { if (m_unique >= 1 || m_uniqueName.length() == 0) {
String xx = address.getAddress1(); String xx = address.getAddress1();
if (xx != null && xx.length() > 0) { if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0) if (m_uniqueName.length() > 0)
m_uniqueName += " "; m_uniqueName.append(" ");
m_uniqueName += xx; m_uniqueName.append(xx);
} }
} }
// 2 + Address2 // 2 + Address2
@ -203,8 +203,8 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
String xx = address.getAddress2(); String xx = address.getAddress2();
if (xx != null && xx.length() > 0) { if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0) if (m_uniqueName.length() > 0)
m_uniqueName += " "; m_uniqueName.append(" ");
m_uniqueName += xx; m_uniqueName.append(xx);
} }
} }
// 3 - Region // 3 - Region
@ -212,8 +212,8 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
String xx = address.getRegionName(true); String xx = address.getRegionName(true);
if (xx != null && xx.length() > 0) { if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0) if (m_uniqueName.length() > 0)
m_uniqueName += " "; m_uniqueName.append(" ");
m_uniqueName += xx; m_uniqueName.append(xx);
} }
} }
// 4 - ID // 4 - ID
@ -221,12 +221,12 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
int id = get_ID(); int id = get_ID();
if (id == 0) if (id == 0)
id = address.get_ID(); id = address.get_ID();
m_uniqueName += "#" + id; m_uniqueName.append("#").append(id);
} }
} // makeUnique } // makeUnique
public String getBPLocName(MLocation address) { public String getBPLocName(MLocation address) {
m_uniqueName = getName(); m_uniqueName = new StringBuffer(getName());
m_unique = MSysConfig.getIntValue("START_VALUE_BPLOCATION_NAME", 0, m_unique = MSysConfig.getIntValue("START_VALUE_BPLOCATION_NAME", 0,
getAD_Client_ID(), getAD_Org_ID()); getAD_Client_ID(), getAD_Org_ID());
if (m_unique < 0 || m_unique > 4) if (m_unique < 0 || m_unique > 4)
@ -256,7 +256,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
} }
} }
} }
return m_uniqueName; return m_uniqueName.toString();
} }
} // MBPartnerLocation } // MBPartnerLocation

View File

@ -86,7 +86,7 @@ public class MBank extends X_C_Bank
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MBank["); StringBuilder sb = new StringBuilder ("MBank[");
sb.append (get_ID ()).append ("-").append(getName ()).append ("]"); sb.append (get_ID ()).append ("-").append(getName ()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -95,7 +95,7 @@ public class MBankAccount extends X_C_BankAccount
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MBankAccount[") StringBuilder sb = new StringBuilder ("MBankAccount[")
.append (get_ID()) .append (get_ID())
.append("-").append(getAccountNo()) .append("-").append(getAccountNo())
.append ("]"); .append ("]");
@ -117,7 +117,8 @@ public class MBankAccount extends X_C_BankAccount
*/ */
public String getName() public String getName()
{ {
return getBank().getName() + " " + getAccountNo(); StringBuilder msgreturn = new StringBuilder(getBank().getName()).append(" ").append(getAccountNo());
return msgreturn.toString();
} // getName } // getName
/** /**

View File

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

View File

@ -148,8 +148,10 @@ import org.compiere.util.Msg;
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgsd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgsd.toString());
}
} // addDescription } // addDescription
@ -252,19 +254,19 @@ import org.compiere.util.Msg;
*/ */
private boolean updateHeader() private boolean updateHeader()
{ {
String sql = "UPDATE C_BankStatement bs" StringBuilder sql = new StringBuilder("UPDATE C_BankStatement bs")
+ " SET StatementDifference=(SELECT COALESCE(SUM(StmtAmt),0) FROM C_BankStatementLine bsl " .append(" SET StatementDifference=(SELECT COALESCE(SUM(StmtAmt),0) FROM C_BankStatementLine bsl ")
+ "WHERE bsl.C_BankStatement_ID=bs.C_BankStatement_ID AND bsl.IsActive='Y') " .append("WHERE bsl.C_BankStatement_ID=bs.C_BankStatement_ID AND bsl.IsActive='Y') ")
+ "WHERE C_BankStatement_ID=" + getC_BankStatement_ID(); .append("WHERE C_BankStatement_ID=").append(getC_BankStatement_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1) { if (no != 1) {
log.warning("StatementDifference #" + no); log.warning("StatementDifference #" + no);
return false; return false;
} }
sql = "UPDATE C_BankStatement bs" sql = new StringBuilder("UPDATE C_BankStatement bs")
+ " SET EndingBalance=BeginningBalance+StatementDifference " .append(" SET EndingBalance=BeginningBalance+StatementDifference ")
+ "WHERE C_BankStatement_ID=" + getC_BankStatement_ID(); .append("WHERE C_BankStatement_ID=").append(getC_BankStatement_ID());
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1) { if (no != 1) {
log.warning("Balance #" + no); log.warning("Balance #" + no);
return false; return false;

View File

@ -133,7 +133,7 @@ import org.compiere.impexp.BankStatementLoaderInterface;
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MBankStatementLoader[") StringBuilder sb = new StringBuilder ("MBankStatementLoader[")
.append(get_ID ()).append("-").append(getName()) .append(get_ID ()).append("-").append(getName())
.append ("]"); .append ("]");
return sb.toString (); return sb.toString ();

View File

@ -163,7 +163,7 @@ public class MCStage extends X_CM_CStage
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MCStage[") StringBuilder sb = new StringBuilder ("MCStage[")
.append (get_ID()).append ("-").append (getName()).append ("]"); .append (get_ID()).append ("-").append (getName()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString
@ -208,10 +208,10 @@ public class MCStage extends X_CM_CStage
} }
if (newRecord) if (newRecord)
{ {
StringBuffer sb = new StringBuffer ("INSERT INTO AD_TreeNodeCMS " StringBuilder sb = new StringBuilder ("INSERT INTO AD_TreeNodeCMS ")
+ "(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, " .append("(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, ")
+ "AD_Tree_ID, Node_ID, Parent_ID, SeqNo) " .append("AD_Tree_ID, Node_ID, Parent_ID, SeqNo) ")
+ "VALUES (") .append("VALUES (")
.append(getAD_Client_ID()).append(",0, 'Y', SysDate, 0, SysDate, 0,") .append(getAD_Client_ID()).append(",0, 'Y', SysDate, 0, SysDate, 0,")
.append(getAD_Tree_ID()).append(",").append(get_ID()) .append(getAD_Tree_ID()).append(",").append(get_ID())
.append(", 0, 999)"); .append(", 0, 999)");
@ -237,7 +237,7 @@ public class MCStage extends X_CM_CStage
if (!success) if (!success)
return success; return success;
// //
StringBuffer sb = new StringBuffer ("DELETE FROM AD_TreeNodeCMS ") StringBuilder sb = new StringBuilder ("DELETE FROM AD_TreeNodeCMS ")
.append(" WHERE Node_ID=").append(get_IDOld()) .append(" WHERE Node_ID=").append(get_IDOld())
.append(" AND AD_Tree_ID=").append(getAD_Tree_ID()); .append(" AND AD_Tree_ID=").append(getAD_Tree_ID());
int no = DB.executeUpdate(sb.toString(), get_TrxName()); int no = DB.executeUpdate(sb.toString(), get_TrxName());
@ -263,7 +263,7 @@ public class MCStage extends X_CM_CStage
*/ */
protected boolean checkElements () { protected boolean checkElements () {
X_CM_Template thisTemplate = new X_CM_Template(getCtx(), this.getCM_Template_ID(), get_TrxName()); X_CM_Template thisTemplate = new X_CM_Template(getCtx(), this.getCM_Template_ID(), get_TrxName());
StringBuffer thisElementList = new StringBuffer(thisTemplate.getElements()); StringBuilder thisElementList = new StringBuilder(thisTemplate.getElements());
while (thisElementList.indexOf("\n")>=0) { while (thisElementList.indexOf("\n")>=0) {
String thisElement = thisElementList.substring(0,thisElementList.indexOf("\n")); String thisElement = thisElementList.substring(0,thisElementList.indexOf("\n"));
thisElementList.delete(0,thisElementList.indexOf("\n")+1); thisElementList.delete(0,thisElementList.indexOf("\n")+1);
@ -279,7 +279,8 @@ public class MCStage extends X_CM_CStage
* @param elementName * @param elementName
*/ */
protected void checkElement(String elementName) { protected void checkElement(String elementName) {
int [] tableKeys = X_CM_CStage_Element.getAllIDs("CM_CStage_Element", "CM_CStage_ID=" + this.get_ID() + " AND Name like '" + elementName + "'", get_TrxName()); StringBuilder msgx = new StringBuilder("CM_CStage_ID=").append(this.get_ID()).append(" AND Name like '").append(elementName).append("'");
int [] tableKeys = X_CM_CStage_Element.getAllIDs("CM_CStage_Element", msgx.toString(), get_TrxName());
if (tableKeys==null || tableKeys.length==0) { if (tableKeys==null || tableKeys.length==0) {
X_CM_CStage_Element thisElement = new X_CM_CStage_Element(getCtx(), 0, get_TrxName()); X_CM_CStage_Element thisElement = new X_CM_CStage_Element(getCtx(), 0, get_TrxName());
thisElement.setAD_Client_ID(getAD_Client_ID()); thisElement.setAD_Client_ID(getAD_Client_ID());
@ -296,11 +297,13 @@ public class MCStage extends X_CM_CStage
* @return true if updated * @return true if updated
*/ */
protected boolean checkTemplateTable () { protected boolean checkTemplateTable () {
int [] tableKeys = X_CM_TemplateTable.getAllIDs("CM_TemplateTable", "CM_Template_ID=" + this.getCM_Template_ID(), get_TrxName()); StringBuilder msgx = new StringBuilder("CM_Template_ID=").append(this.getCM_Template_ID());
int [] tableKeys = X_CM_TemplateTable.getAllIDs("CM_TemplateTable", msgx.toString(), get_TrxName());
if (tableKeys!=null) { if (tableKeys!=null) {
for (int i=0;i<tableKeys.length;i++) { for (int i=0;i<tableKeys.length;i++) {
X_CM_TemplateTable thisTemplateTable = new X_CM_TemplateTable(getCtx(), tableKeys[i], get_TrxName()); X_CM_TemplateTable thisTemplateTable = new X_CM_TemplateTable(getCtx(), tableKeys[i], get_TrxName());
int [] existingKeys = X_CM_CStageTTable.getAllIDs("CM_CStageTTable", "CM_TemplateTable_ID=" + thisTemplateTable.get_ID(), get_TrxName()); msgx = new StringBuilder("CM_TemplateTable_ID=").append(thisTemplateTable.get_ID());
int [] existingKeys = X_CM_CStageTTable.getAllIDs("CM_CStageTTable", msgx.toString(), get_TrxName());
if (existingKeys==null || existingKeys.length==0) { if (existingKeys==null || existingKeys.length==0) {
X_CM_CStageTTable newCStageTTable = new X_CM_CStageTTable(getCtx(), 0, get_TrxName()); X_CM_CStageTTable newCStageTTable = new X_CM_CStageTTable(getCtx(), 0, get_TrxName());
newCStageTTable.setAD_Client_ID(getAD_Client_ID()); newCStageTTable.setAD_Client_ID(getAD_Client_ID());

View File

@ -113,7 +113,8 @@ public class MCalendar extends X_C_Calendar
{ {
super(client.getCtx(), 0, client.get_TrxName()); super(client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); setClientOrg(client);
setName(client.getName() + " " + Msg.translate(client.getCtx(), "C_Calendar_ID")); StringBuilder msgset = new StringBuilder(client.getName()).append(" ").append(Msg.translate(client.getCtx(), "C_Calendar_ID"));
setName(msgset.toString());
} // MCalendar } // MCalendar
/** /**

View File

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

View File

@ -112,11 +112,11 @@ public class MCashPlanLine extends X_C_CashPlanLine
private boolean updateHeader() private boolean updateHeader()
{ {
// Update Cash Plan Header // Update Cash Plan Header
String sql = "UPDATE C_CashPlan " StringBuilder sql = new StringBuilder("UPDATE C_CashPlan ")
+ " SET GrandTotal=" .append(" SET GrandTotal=")
+ "(SELECT COALESCE(SUM(LineTotalAmt),0) FROM C_CashPlanLine WHERE C_CashPlan.C_CashPlan_ID=C_CashPlanLine.C_CashPlan_ID) " .append("(SELECT COALESCE(SUM(LineTotalAmt),0) FROM C_CashPlanLine WHERE C_CashPlan.C_CashPlan_ID=C_CashPlanLine.C_CashPlan_ID) ")
+ "WHERE C_CashPlan_ID=" + getC_CashPlan_ID(); .append("WHERE C_CashPlan_ID=").append(getC_CashPlan_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1) if (no != 1)
log.warning("(1) #" + no); log.warning("(1) #" + no);

View File

@ -61,7 +61,8 @@ public class MChangeRequest extends X_M_ChangeRequest
{ {
this (request.getCtx(), 0, request.get_TrxName()); this (request.getCtx(), 0, request.get_TrxName());
setClientOrg(request); setClientOrg(request);
setName(Msg.getElement(getCtx(), "R_Request_ID") + ": " + request.getDocumentNo()); StringBuilder msgset = new StringBuilder(Msg.getElement(getCtx(), "R_Request_ID")).append(": ").append(request.getDocumentNo());
setName(msgset.toString());
setHelp(request.getSummary()); setHelp(request.getSummary());
// //
setPP_Product_BOM_ID(group.getPP_Product_BOM_ID()); setPP_Product_BOM_ID(group.getPP_Product_BOM_ID());

View File

@ -195,8 +195,10 @@ public class MChat extends X_CM_Chat
{ {
if (Description != null && Description.length() > 0) if (Description != null && Description.length() > 0)
super.setDescription (Description); super.setDescription (Description);
else else{
super.setDescription (getAD_Table_ID() + "#" + getRecord_ID()); StringBuilder msgsd = new StringBuilder(getAD_Table_ID()).append("#").append(getRecord_ID());
super.setDescription (msgsd.toString());
}
} // setDescription } // setDescription
/** /**

View File

@ -202,7 +202,8 @@ public class MClick extends X_W_Click
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, null);
pstmt.setString(1, "%" + url + "%"); StringBuilder msgstr = new StringBuilder("%").append(url).append("%");
pstmt.setString(1, msgstr.toString());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
@ -271,6 +272,7 @@ public class MClick extends X_W_Click
} }
} }
} }
System.out.println("#" + counter); System.out.println("#" + counter);
} // main } // main

View File

@ -108,15 +108,15 @@ public class MClickCount extends X_W_ClickCount
protected ValueNamePair[] getCount (String DateFormat) protected ValueNamePair[] getCount (String DateFormat)
{ {
ArrayList<ValueNamePair> list = new ArrayList<ValueNamePair>(); ArrayList<ValueNamePair> list = new ArrayList<ValueNamePair>();
String sql = "SELECT TRUNC(Created, '" + DateFormat + "'), Count(*) " StringBuilder sql = new StringBuilder("SELECT TRUNC(Created, '").append(DateFormat).append("'), Count(*) ")
+ "FROM W_Click " .append("FROM W_Click ")
+ "WHERE W_ClickCount_ID=? " .append("WHERE W_ClickCount_ID=? ")
+ "GROUP BY TRUNC(Created, '" + DateFormat + "')"; .append("GROUP BY TRUNC(Created, '").append(DateFormat).append("')");
// //
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, getW_ClickCount_ID()); pstmt.setInt(1, getW_ClickCount_ID());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
@ -132,7 +132,7 @@ public class MClickCount extends X_W_ClickCount
} }
catch (SQLException ex) catch (SQLException ex)
{ {
log.log(Level.SEVERE, sql, ex); log.log(Level.SEVERE, sql.toString(), ex);
} }
try try
{ {

View File

@ -212,7 +212,7 @@ public class MClient extends X_AD_Client
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer ("MClient[") StringBuilder sb = new StringBuilder ("MClient[")
.append(get_ID()).append("-").append(getValue()) .append(get_ID()).append("-").append(getValue())
.append("]"); .append("]");
return sb.toString(); return sb.toString();
@ -289,13 +289,13 @@ public class MClient extends X_AD_Client
public boolean setupClientInfo (String language) public boolean setupClientInfo (String language)
{ {
// Create Trees // Create Trees
String sql = null; StringBuilder sql = null;
if (Env.isBaseLanguage (language, "AD_Ref_List")) // Get TreeTypes & Name if (Env.isBaseLanguage (language, "AD_Ref_List")) // Get TreeTypes & Name
sql = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=120 AND IsActive='Y'"; sql = new StringBuilder("SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=120 AND IsActive='Y'");
else else
sql = "SELECT l.Value, t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t " sql = new StringBuilder("SELECT l.Value, t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t ")
+ "WHERE l.AD_Reference_ID=120 AND l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.IsActive='Y'" .append("WHERE l.AD_Reference_ID=120 AND l.AD_Ref_List_ID=t.AD_Ref_List_ID AND l.IsActive='Y'")
+ " AND t.AD_Language=" + DB.TO_STRING(language); .append(" AND t.AD_Language=").append(DB.TO_STRING(language));
// Tree IDs // Tree IDs
int AD_Tree_Org_ID=0, AD_Tree_BPartner_ID=0, AD_Tree_Project_ID=0, int AD_Tree_Org_ID=0, AD_Tree_BPartner_ID=0, AD_Tree_Project_ID=0,
@ -305,59 +305,59 @@ public class MClient extends X_AD_Client
boolean success = false; boolean success = false;
try try
{ {
PreparedStatement stmt = DB.prepareStatement(sql, get_TrxName()); PreparedStatement stmt = DB.prepareStatement(sql.toString(), get_TrxName());
ResultSet rs = stmt.executeQuery(); ResultSet rs = stmt.executeQuery();
MTree_Base tree = null; MTree_Base tree = null;
while (rs.next()) while (rs.next())
{ {
String value = rs.getString(1); String value = rs.getString(1);
String name = getName() + " " + rs.getString(2); StringBuilder name = new StringBuilder(getName()).append(" ").append(rs.getString(2));
// //
if (value.equals(X_AD_Tree.TREETYPE_Organization)) if (value.equals(X_AD_Tree.TREETYPE_Organization))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_Org_ID = tree.getAD_Tree_ID(); AD_Tree_Org_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_BPartner)) else if (value.equals(X_AD_Tree.TREETYPE_BPartner))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_BPartner_ID = tree.getAD_Tree_ID(); AD_Tree_BPartner_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_Project)) else if (value.equals(X_AD_Tree.TREETYPE_Project))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_Project_ID = tree.getAD_Tree_ID(); AD_Tree_Project_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_SalesRegion)) else if (value.equals(X_AD_Tree.TREETYPE_SalesRegion))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_SalesRegion_ID = tree.getAD_Tree_ID(); AD_Tree_SalesRegion_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_Product)) else if (value.equals(X_AD_Tree.TREETYPE_Product))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_Product_ID = tree.getAD_Tree_ID(); AD_Tree_Product_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_ElementValue)) else if (value.equals(X_AD_Tree.TREETYPE_ElementValue))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
m_AD_Tree_Account_ID = tree.getAD_Tree_ID(); m_AD_Tree_Account_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_Campaign)) else if (value.equals(X_AD_Tree.TREETYPE_Campaign))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_Campaign_ID = tree.getAD_Tree_ID(); AD_Tree_Campaign_ID = tree.getAD_Tree_ID();
} }
else if (value.equals(X_AD_Tree.TREETYPE_Activity)) else if (value.equals(X_AD_Tree.TREETYPE_Activity))
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
AD_Tree_Activity_ID = tree.getAD_Tree_ID(); AD_Tree_Activity_ID = tree.getAD_Tree_ID();
} }
@ -365,7 +365,7 @@ public class MClient extends X_AD_Client
success = true; success = true;
else // PC (Product Category), BB (BOM) else // PC (Product Category), BB (BOM)
{ {
tree = new MTree_Base (this, name, value); tree = new MTree_Base (this, name.toString(), value);
success = tree.save(); success = tree.save();
} }
if (!success) if (!success)
@ -467,14 +467,18 @@ public class MClient extends X_AD_Client
*/ */
public String testEMail() public String testEMail()
{ {
if (getRequestEMail() == null || getRequestEMail().length() == 0) if (getRequestEMail() == null || getRequestEMail().length() == 0){
return "No Request EMail for " + getName(); StringBuilder msgreturn = new StringBuilder("No Request EMail for ").append(getName());
return msgreturn.toString();
}
// //
StringBuilder msgce = new StringBuilder("Adempiere EMail Test: ").append(toString());
EMail email = createEMail (getRequestEMail(), EMail email = createEMail (getRequestEMail(),
"Adempiere EMail Test", "Adempiere EMail Test",msgce.toString());
"Adempiere EMail Test: " + toString()); if (email == null){
if (email == null) StringBuilder msgreturn = new StringBuilder("Could not create EMail: ").append(getName());
return "Could not create EMail: " + getName(); return msgreturn.toString();
}
try try
{ {
String msg = null; String msg = null;
@ -920,52 +924,52 @@ public class MClient extends X_AD_Client
if (m_fieldAccess == null) if (m_fieldAccess == null)
{ {
m_fieldAccess = new ArrayList<Integer>(11000); m_fieldAccess = new ArrayList<Integer>(11000);
String sqlvalidate = StringBuilder sqlvalidate = new StringBuilder(
"SELECT AD_Field_ID " "SELECT AD_Field_ID ")
+ " FROM AD_Field " .append(" FROM AD_Field ")
+ " WHERE ( AD_Field_ID NOT IN ( " .append(" WHERE ( AD_Field_ID NOT IN ( ")
// ASP subscribed fields for client // ASP subscribed fields for client)
+ " SELECT f.AD_Field_ID " .append(" SELECT f.AD_Field_ID ")
+ " FROM ASP_Field f, ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl " .append(" FROM ASP_Field f, ASP_Tab t, ASP_Window w, ASP_Level l, ASP_ClientLevel cl ")
+ " WHERE w.ASP_Level_ID = l.ASP_Level_ID " .append(" WHERE w.ASP_Level_ID = l.ASP_Level_ID ")
+ " AND cl.AD_Client_ID = " + getAD_Client_ID() .append(" AND cl.AD_Client_ID = ").append(getAD_Client_ID())
+ " AND cl.ASP_Level_ID = l.ASP_Level_ID " .append(" AND cl.ASP_Level_ID = l.ASP_Level_ID ")
+ " AND f.ASP_Tab_ID = t.ASP_Tab_ID " .append(" AND f.ASP_Tab_ID = t.ASP_Tab_ID ")
+ " AND t.ASP_Window_ID = w.ASP_Window_ID " .append(" AND t.ASP_Window_ID = w.ASP_Window_ID ")
+ " AND f.IsActive = 'Y' " .append(" AND f.IsActive = 'Y' ")
+ " AND t.IsActive = 'Y' " .append(" AND t.IsActive = 'Y' ")
+ " AND w.IsActive = 'Y' " .append(" AND w.IsActive = 'Y' ")
+ " AND l.IsActive = 'Y' " .append(" AND l.IsActive = 'Y' ")
+ " AND cl.IsActive = 'Y' " .append(" AND cl.IsActive = 'Y' ")
+ " AND f.ASP_Status = 'H' " .append(" AND f.ASP_Status = 'H' ")
+" AND f.AD_Field_ID NOT IN (" .append(" AND f.AD_Field_ID NOT IN (")
+" SELECT AD_Field_ID" .append(" SELECT AD_Field_ID")
+" FROM ASP_ClientException ce" .append(" FROM ASP_ClientException ce")
+" WHERE ce.AD_Client_ID ="+getAD_Client_ID() .append(" WHERE ce.AD_Client_ID =").append(getAD_Client_ID())
+" AND ce.IsActive = 'Y'" .append(" AND ce.IsActive = 'Y'")
+" AND ce.AD_Field_ID IS NOT NULL" .append(" AND ce.AD_Field_ID IS NOT NULL")
+" AND ce.ASP_Status <> 'H')" .append(" AND ce.ASP_Status <> 'H')")
+ " UNION ALL " .append(" UNION ALL ")
// minus ASP hide exceptions for client // minus ASP hide exceptions for client
+ " SELECT AD_Field_ID " .append(" SELECT AD_Field_ID ")
+ " FROM ASP_ClientException ce " .append(" FROM ASP_ClientException ce ")
+ " WHERE ce.AD_Client_ID = " + getAD_Client_ID() .append(" WHERE ce.AD_Client_ID = ").append(getAD_Client_ID())
+ " AND ce.IsActive = 'Y' " .append(" AND ce.IsActive = 'Y' ")
+ " AND ce.AD_Field_ID IS NOT NULL " .append(" AND ce.AD_Field_ID IS NOT NULL ")
+ " AND ce.ASP_Status = 'H'))" .append(" AND ce.ASP_Status = 'H'))")
+ " ORDER BY AD_Field_ID"; .append(" ORDER BY AD_Field_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sqlvalidate, get_TrxName()); pstmt = DB.prepareStatement(sqlvalidate.toString(), get_TrxName());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
m_fieldAccess.add(rs.getInt(1)); m_fieldAccess.add(rs.getInt(1));
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sqlvalidate, e); log.log(Level.SEVERE, sqlvalidate.toString(), e);
} }
finally finally
{ {

View File

@ -88,12 +88,12 @@ public class MClientShare extends X_AD_ClientShare
{ {
int Client_ID = rs.getInt(1); int Client_ID = rs.getInt(1);
int table_ID = rs.getInt(2); int table_ID = rs.getInt(2);
String key = Client_ID + "_" + table_ID; StringBuilder key = new StringBuilder(Client_ID).append("_").append(table_ID);
String ShareType = rs.getString(3); String ShareType = rs.getString(3);
if (ShareType.equals(SHARETYPE_ClientAllShared)) if (ShareType.equals(SHARETYPE_ClientAllShared))
s_shares.put(key, Boolean.TRUE); s_shares.put(key.toString(), Boolean.TRUE);
else if (ShareType.equals(SHARETYPE_OrgNotShared)) else if (ShareType.equals(SHARETYPE_OrgNotShared))
s_shares.put(key, Boolean.FALSE); s_shares.put(key.toString(), Boolean.FALSE);
} }
rs.close (); rs.close ();
pstmt.close (); pstmt.close ();
@ -116,7 +116,7 @@ public class MClientShare extends X_AD_ClientShare
if (s_shares.isEmpty()) // put in something if (s_shares.isEmpty()) // put in something
s_shares.put("0_0", Boolean.TRUE); s_shares.put("0_0", Boolean.TRUE);
} // load } // load
String key = AD_Client_ID + "_" + AD_Table_ID; StringBuilder key = new StringBuilder(AD_Client_ID).append("_").append(AD_Table_ID);
return s_shares.get(key); return s_shares.get(key);
} // load } // load
@ -211,26 +211,26 @@ public class MClientShare extends X_AD_ClientShare
*/ */
public String setDataToLevel() public String setDataToLevel()
{ {
String info = "-"; StringBuilder info = new StringBuilder("-");
if (isClientLevelOnly()) if (isClientLevelOnly())
{ {
StringBuffer sql = new StringBuffer("UPDATE ") StringBuilder sql = new StringBuilder("UPDATE ")
.append(getTableName()) .append(getTableName())
.append(" SET AD_Org_ID=0 WHERE AD_Org_ID<>0 AND AD_Client_ID=?"); .append(" SET AD_Org_ID=0 WHERE AD_Org_ID<>0 AND AD_Client_ID=?");
int no = DB.executeUpdate(sql.toString(), getAD_Client_ID(), get_TrxName()); int no = DB.executeUpdate(sql.toString(), getAD_Client_ID(), get_TrxName());
info = getTableName() + " set to Shared #" + no; info = new StringBuilder(getTableName()).append(" set to Shared #").append(no);
log.info(info); log.info(info.toString());
} }
else if (isOrgLevelOnly()) else if (isOrgLevelOnly())
{ {
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ") StringBuilder sql = new StringBuilder("SELECT COUNT(*) FROM ")
.append(getTableName()) .append(getTableName())
.append(" WHERE AD_Org_ID=0 AND AD_Client_ID=?"); .append(" WHERE AD_Org_ID=0 AND AD_Client_ID=?");
int no = DB.getSQLValue(get_TrxName(), sql.toString(), getAD_Client_ID()); int no = DB.getSQLValue(get_TrxName(), sql.toString(), getAD_Client_ID());
info = getTableName() + " Shared records #" + no; info = new StringBuilder(getTableName()).append(" Shared records #").append(no);
log.info(info); log.info(info.toString());
} }
return info; return info.toString();
} // setDataToLevel } // setDataToLevel
/** /**
@ -239,7 +239,7 @@ public class MClientShare extends X_AD_ClientShare
*/ */
public String listChildRecords() public String listChildRecords()
{ {
StringBuffer info = new StringBuffer(); StringBuilder info = new StringBuilder();
String sql = "SELECT AD_Table_ID, TableName " String sql = "SELECT AD_Table_ID, TableName "
+ "FROM AD_Table t " + "FROM AD_Table t "
+ "WHERE AccessLevel='3' AND IsView='N'" + "WHERE AccessLevel='3' AND IsView='N'"

View File

@ -54,7 +54,8 @@ public class MColor extends X_AD_Color
*/ */
public String toString() public String toString()
{ {
return "MColor[ID=" + get_ID() + " - " + getName() + "]"; StringBuilder msgreturn = new StringBuilder("MColor[ID=").append(get_ID()).append(" - ").append(getName()).append("]");
return msgreturn.toString();
} // toString } // toString
/** /**

View File

@ -204,7 +204,7 @@ public class MColorSchema extends X_PA_ColorSchema
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MColorSchema["); StringBuilder sb = new StringBuilder ("MColorSchema[");
sb.append (get_ID()).append ("-").append (getName()).append ("]"); sb.append (get_ID()).append ("-").append (getName()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -304,7 +304,7 @@ public class MColumn extends X_AD_Column
|| is_ValueChanged(MColumn.COLUMNNAME_Description) || is_ValueChanged(MColumn.COLUMNNAME_Description)
|| is_ValueChanged(MColumn.COLUMNNAME_Help) || is_ValueChanged(MColumn.COLUMNNAME_Help)
) { ) {
StringBuffer sql = new StringBuffer("UPDATE AD_Field SET Name=") StringBuilder sql = new StringBuilder("UPDATE AD_Field SET Name=")
.append(DB.TO_STRING(getName())) .append(DB.TO_STRING(getName()))
.append(", Description=").append(DB.TO_STRING(getDescription())) .append(", Description=").append(DB.TO_STRING(getDescription()))
.append(", Help=").append(DB.TO_STRING(getHelp())) .append(", Help=").append(DB.TO_STRING(getHelp()))
@ -324,7 +324,7 @@ public class MColumn extends X_AD_Column
*/ */
public String getSQLAdd (MTable table) public String getSQLAdd (MTable table)
{ {
StringBuffer sql = new StringBuffer ("ALTER TABLE ") StringBuilder sql = new StringBuilder ("ALTER TABLE ")
.append(table.getTableName()) .append(table.getTableName())
.append(" ADD ").append(getSQLDDL()); .append(" ADD ").append(getSQLDDL());
String constraint = getConstraint(table.getTableName()); String constraint = getConstraint(table.getTableName());
@ -345,7 +345,7 @@ public class MColumn extends X_AD_Column
if (isVirtualColumn()) if (isVirtualColumn())
return null; return null;
StringBuffer sql = new StringBuffer (getColumnName()) StringBuilder sql = new StringBuilder (getColumnName())
.append(" ").append(getSQLDataType()); .append(" ").append(getSQLDataType());
// Default // Default
@ -393,13 +393,13 @@ public class MColumn extends X_AD_Column
*/ */
public String getSQLModify (MTable table, boolean setNullOption) public String getSQLModify (MTable table, boolean setNullOption)
{ {
StringBuffer sql = new StringBuffer(); StringBuilder sql = new StringBuilder();
StringBuffer sqlBase = new StringBuffer ("ALTER TABLE ") StringBuilder sqlBase = new StringBuilder ("ALTER TABLE ")
.append(table.getTableName()) .append(table.getTableName())
.append(" MODIFY ").append(getColumnName()); .append(" MODIFY ").append(getColumnName());
// Default // Default
StringBuffer sqlDefault = new StringBuffer(sqlBase) StringBuilder sqlDefault = new StringBuilder(sqlBase)
.append(" ").append(getSQLDataType()); .append(" ").append(getSQLDataType());
String defaultValue = getDefaultValue(); String defaultValue = getDefaultValue();
if (defaultValue != null if (defaultValue != null
@ -433,7 +433,7 @@ public class MColumn extends X_AD_Column
// Null Values // Null Values
if (isMandatory() && defaultValue != null && defaultValue.length() > 0) if (isMandatory() && defaultValue != null && defaultValue.length() > 0)
{ {
StringBuffer sqlSet = new StringBuffer("UPDATE ") StringBuilder sqlSet = new StringBuilder("UPDATE ")
.append(table.getTableName()) .append(table.getTableName())
.append(" SET ").append(getColumnName()) .append(" SET ").append(getColumnName())
.append("=").append(defaultValue) .append("=").append(defaultValue)
@ -444,7 +444,7 @@ public class MColumn extends X_AD_Column
// Null // Null
if (setNullOption) if (setNullOption)
{ {
StringBuffer sqlNull = new StringBuffer(sqlBase); StringBuilder sqlNull = new StringBuilder(sqlBase);
if (isMandatory()) if (isMandatory())
sqlNull.append(" NOT NULL"); sqlNull.append(" NOT NULL");
else else
@ -505,13 +505,14 @@ public class MColumn extends X_AD_Column
public String getConstraint(String tableName) public String getConstraint(String tableName)
{ {
if (isKey()) { if (isKey()) {
String constraintName; StringBuilder constraintName;
if (tableName.length() > 26) if (tableName.length() > 26)
// Oracle restricts object names to 30 characters // Oracle restricts object names to 30 characters
constraintName = tableName.substring(0, 26) + "_Key"; constraintName = new StringBuilder(tableName.substring(0, 26)).append("_Key");
else else
constraintName = tableName + "_Key"; constraintName = new StringBuilder(tableName).append("_Key");
return "CONSTRAINT " + constraintName + " PRIMARY KEY (" + getColumnName() + ")"; StringBuilder msgreturn = new StringBuilder("CONSTRAINT ").append(constraintName).append(" PRIMARY KEY (").append(getColumnName()).append(")");
return msgreturn.toString();
} }
/** /**
if (getAD_Reference_ID() == DisplayType.TableDir if (getAD_Reference_ID() == DisplayType.TableDir
@ -530,7 +531,7 @@ public class MColumn extends X_AD_Column
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer ("MColumn["); StringBuilder sb = new StringBuilder ("MColumn[");
sb.append (get_ID()).append ("-").append (getColumnName()).append ("]"); sb.append (get_ID()).append ("-").append (getColumnName()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -68,7 +68,7 @@ public class MColumnAccess extends X_AD_Column_Access
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MColumnAccess["); StringBuilder sb = new StringBuilder("MColumnAccess[");
sb.append("AD_Role_ID=").append(getAD_Role_ID()) sb.append("AD_Role_ID=").append(getAD_Role_ID())
.append(",AD_Table_ID=").append(getAD_Table_ID()) .append(",AD_Table_ID=").append(getAD_Table_ID())
.append(",AD_Column_ID=").append(getAD_Column_ID()) .append(",AD_Column_ID=").append(getAD_Column_ID())
@ -86,7 +86,7 @@ public class MColumnAccess extends X_AD_Column_Access
{ {
String in = Msg.getMsg(ctx, "Include"); String in = Msg.getMsg(ctx, "Include");
String ex = Msg.getMsg(ctx, "Exclude"); String ex = Msg.getMsg(ctx, "Exclude");
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(Msg.translate(ctx, "AD_Table_ID")) sb.append(Msg.translate(ctx, "AD_Table_ID"))
.append("=").append(getTableName(ctx)).append(", ") .append("=").append(getTableName(ctx)).append(", ")
.append(Msg.translate(ctx, "AD_Column_ID")) .append(Msg.translate(ctx, "AD_Column_ID"))
@ -157,8 +157,9 @@ public class MColumnAccess extends X_AD_Column_Access
pstmt = null; pstmt = null;
} }
// Get Clear Text // Get Clear Text
String realName = Msg.translate(ctx, m_tableName + "_ID"); StringBuilder msgrn = new StringBuilder(m_tableName).append("_ID");
if (!realName.equals(m_tableName + "_ID")) String realName = Msg.translate(ctx, msgrn.toString());
if (!realName.equals(msgrn.toString()))
m_tableName = realName; m_tableName = realName;
m_columnName = Msg.translate(ctx, m_columnName); m_columnName = Msg.translate(ctx, m_columnName);
} }

View File

@ -204,7 +204,7 @@ public class MContactInterest extends X_R_ContactInterest
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MContactInterest[") StringBuilder sb = new StringBuilder ("MContactInterest[")
.append("R_InterestArea_ID=").append(getR_InterestArea_ID()) .append("R_InterestArea_ID=").append(getR_InterestArea_ID())
.append(",AD_User_ID=").append(getAD_User_ID()) .append(",AD_User_ID=").append(getAD_User_ID())
.append(",Subscribed=").append(isSubscribed()) .append(",Subscribed=").append(isSubscribed())

View File

@ -274,18 +274,20 @@ public class MContainer extends X_CM_Container
.getProperty ("java.naming.provider.url")), log, getCtx (), .getProperty ("java.naming.provider.url")), log, getCtx (),
get_TrxName ()); get_TrxName ());
// First update the new ones... // First update the new ones...
StringBuilder msgx = new StringBuilder("CM_CStage_ID=").append(stage.get_ID ());
int[] tableKeys = X_CM_CStage_Element.getAllIDs ("CM_CStage_Element", int[] tableKeys = X_CM_CStage_Element.getAllIDs ("CM_CStage_Element",
"CM_CStage_ID=" + stage.get_ID (), trxName); msgx.toString(), trxName);
if (tableKeys != null && tableKeys.length > 0) if (tableKeys != null && tableKeys.length > 0)
{ {
for (int i = 0; i < tableKeys.length; i++) for (int i = 0; i < tableKeys.length; i++)
{ {
X_CM_CStage_Element thisStageElement = new X_CM_CStage_Element ( X_CM_CStage_Element thisStageElement = new X_CM_CStage_Element (
project.getCtx (), tableKeys[i], trxName); project.getCtx (), tableKeys[i], trxName);
msgx = new StringBuilder("CM_Container_ID=")
.append(stage.get_ID ()).append(" AND Name LIKE '")
.append(thisStageElement.getName ()).append("'");
int[] thisContainerElementKeys = X_CM_Container_Element int[] thisContainerElementKeys = X_CM_Container_Element
.getAllIDs ("CM_Container_Element", "CM_Container_ID=" .getAllIDs ("CM_Container_Element", msgx.toString(), trxName);
+ stage.get_ID () + " AND Name LIKE '"
+ thisStageElement.getName () + "'", trxName);
X_CM_Container_Element thisContainerElement; X_CM_Container_Element thisContainerElement;
if (thisContainerElementKeys != null if (thisContainerElementKeys != null
&& thisContainerElementKeys.length > 0) && thisContainerElementKeys.length > 0)
@ -318,18 +320,20 @@ public class MContainer extends X_CM_Container
} }
} }
// Now we are checking the existing ones to delete the unneeded ones... // Now we are checking the existing ones to delete the unneeded ones...
msgx = new StringBuilder("CM_Container_ID=").append(stage.get_ID ());
tableKeys = X_CM_Container_Element.getAllIDs ("CM_Container_Element", tableKeys = X_CM_Container_Element.getAllIDs ("CM_Container_Element",
"CM_Container_ID=" + stage.get_ID (), trxName); msgx.toString(), trxName);
if (tableKeys != null && tableKeys.length > 0) if (tableKeys != null && tableKeys.length > 0)
{ {
for (int i = 0; i < tableKeys.length; i++) for (int i = 0; i < tableKeys.length; i++)
{ {
X_CM_Container_Element thisContainerElement = new X_CM_Container_Element ( X_CM_Container_Element thisContainerElement = new X_CM_Container_Element (
project.getCtx (), tableKeys[i], trxName); project.getCtx (), tableKeys[i], trxName);
msgx = new StringBuilder("CM_CStage_ID=")
.append(stage.get_ID ()).append(" AND Name LIKE '")
.append(thisContainerElement.getName ()).append("'");
int[] thisCStageElementKeys = X_CM_CStage_Element int[] thisCStageElementKeys = X_CM_CStage_Element
.getAllIDs ("CM_CStage_Element", "CM_CStage_ID=" .getAllIDs ("CM_CStage_Element", msgx.toString(), trxName);
+ stage.get_ID () + " AND Name LIKE '"
+ thisContainerElement.getName () + "'", trxName);
// If we cannot find a representative in the Stage we will delete from production // If we cannot find a representative in the Stage we will delete from production
if (thisCStageElementKeys == null if (thisCStageElementKeys == null
|| thisCStageElementKeys.length < 1) || thisCStageElementKeys.length < 1)
@ -356,18 +360,20 @@ public class MContainer extends X_CM_Container
protected void updateTTables (MWebProject project, MCStage stage, protected void updateTTables (MWebProject project, MCStage stage,
String trxName) String trxName)
{ {
StringBuilder msgx = new StringBuilder("CM_CStage_ID=").append(stage.get_ID ());
int[] tableKeys = X_CM_CStageTTable.getAllIDs (I_CM_CStageTTable.Table_Name, int[] tableKeys = X_CM_CStageTTable.getAllIDs (I_CM_CStageTTable.Table_Name,
"CM_CStage_ID=" + stage.get_ID (), trxName); msgx.toString(), trxName);
if (tableKeys != null && tableKeys.length > 0) if (tableKeys != null && tableKeys.length > 0)
{ {
for (int i = 0; i < tableKeys.length; i++) for (int i = 0; i < tableKeys.length; i++)
{ {
X_CM_CStageTTable thisStageTTable = new X_CM_CStageTTable ( X_CM_CStageTTable thisStageTTable = new X_CM_CStageTTable (
project.getCtx (), tableKeys[i], trxName); project.getCtx (), tableKeys[i], trxName);
msgx = new StringBuilder("CM_Container_ID=").append(stage.get_ID ())
.append(" AND CM_TemplateTable_ID=")
.append(thisStageTTable.getCM_TemplateTable_ID ());
int[] thisContainerTTableKeys = X_CM_ContainerTTable.getAllIDs ( int[] thisContainerTTableKeys = X_CM_ContainerTTable.getAllIDs (
I_CM_ContainerTTable.Table_Name, "CM_Container_ID=" + stage.get_ID () I_CM_ContainerTTable.Table_Name, msgx.toString(), trxName);
+ " AND CM_TemplateTable_ID="
+ thisStageTTable.getCM_TemplateTable_ID (), trxName);
X_CM_ContainerTTable thisContainerTTable; X_CM_ContainerTTable thisContainerTTable;
if (thisContainerTTableKeys != null if (thisContainerTTableKeys != null
&& thisContainerTTableKeys.length > 0) && thisContainerTTableKeys.length > 0)
@ -407,7 +413,7 @@ public class MContainer extends X_CM_Container
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MContainer[").append (get_ID ()) StringBuilder sb = new StringBuilder ("MContainer[").append (get_ID ())
.append ("-").append (getName ()).append ("]"); .append ("-").append (getName ()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString
@ -427,10 +433,10 @@ public class MContainer extends X_CM_Container
return success; return success;
if (newRecord) if (newRecord)
{ {
StringBuffer sb = new StringBuffer ( StringBuilder sb = new StringBuilder (
"INSERT INTO AD_TreeNodeCMC " "INSERT INTO AD_TreeNodeCMC ")
+ "(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, " .append("(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, ")
+ "AD_Tree_ID, Node_ID, Parent_ID, SeqNo) " + "VALUES (") .append("AD_Tree_ID, Node_ID, Parent_ID, SeqNo) ").append("VALUES (")
.append (getAD_Client_ID ()).append ( .append (getAD_Client_ID ()).append (
",0, 'Y', SysDate, 0, SysDate, 0,").append ( ",0, 'Y', SysDate, 0, SysDate, 0,").append (
getAD_Tree_ID ()).append (",").append (get_ID ()).append ( getAD_Tree_ID ()).append (",").append (get_ID ()).append (
@ -447,7 +453,8 @@ public class MContainer extends X_CM_Container
protected MContainerElement[] getAllElements() protected MContainerElement[] getAllElements()
{ {
int elements[] = MContainerElement.getAllIDs("CM_Container_Element", "CM_Container_ID=" + get_ID(), get_TrxName()); StringBuilder msgmc = new StringBuilder("CM_Container_ID=").append(get_ID());
int elements[] = MContainerElement.getAllIDs("CM_Container_Element", msgmc.toString(), get_TrxName());
if (elements.length>0) if (elements.length>0)
{ {
MContainerElement[] containerElements = new MContainerElement[elements.length]; MContainerElement[] containerElements = new MContainerElement[elements.length];
@ -475,7 +482,7 @@ public class MContainer extends X_CM_Container
} }
} }
// //
StringBuffer sb = new StringBuffer ("DELETE FROM AD_TreeNodeCMC ") StringBuilder sb = new StringBuilder ("DELETE FROM AD_TreeNodeCMC ")
.append (" WHERE Node_ID=").append (get_ID ()).append ( .append (" WHERE Node_ID=").append (get_ID ()).append (
" AND AD_Tree_ID=").append (getAD_Tree_ID ()); " AND AD_Tree_ID=").append (getAD_Tree_ID ());
int no = DB.executeUpdate (sb.toString (), get_TrxName ()); int no = DB.executeUpdate (sb.toString (), get_TrxName ());
@ -497,7 +504,7 @@ public class MContainer extends X_CM_Container
if (!success) if (!success)
return success; return success;
// //
StringBuffer sb = new StringBuffer ("DELETE FROM AD_TreeNodeCMC ") StringBuilder sb = new StringBuilder ("DELETE FROM AD_TreeNodeCMC ")
.append (" WHERE Node_ID=").append (get_IDOld ()).append ( .append (" WHERE Node_ID=").append (get_IDOld ()).append (
" AND AD_Tree_ID=").append (getAD_Tree_ID ()); " AND AD_Tree_ID=").append (getAD_Tree_ID ());
int no = DB.executeUpdate (sb.toString (), get_TrxName ()); int no = DB.executeUpdate (sb.toString (), get_TrxName ());

View File

@ -372,7 +372,7 @@ public class MConversionRate extends X_C_Conversion_Rate
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MConversionRate["); StringBuilder sb = new StringBuilder("MConversionRate[");
sb.append(get_ID()) sb.append(get_ID())
.append(",Currency=").append(getC_Currency_ID()) .append(",Currency=").append(getC_Currency_ID())
.append(",To=").append(getC_Currency_ID_To()) .append(",To=").append(getC_Currency_ID_To())

View File

@ -463,22 +463,22 @@ public class MCost extends X_M_Cost
int M_ASI_ID, int AD_Org_ID, int C_Currency_ID) int M_ASI_ID, int AD_Org_ID, int C_Currency_ID)
{ {
BigDecimal retValue = null; BigDecimal retValue = null;
String sql = "SELECT currencyConvert(il.PriceActual, i.C_Currency_ID, ?, i.DateAcct, i.C_ConversionType_ID, il.AD_Client_ID, il.AD_Org_ID) " StringBuilder sql = new StringBuilder("SELECT currencyConvert(il.PriceActual, i.C_Currency_ID, ?, i.DateAcct, i.C_ConversionType_ID, il.AD_Client_ID, il.AD_Org_ID) ")
// ,il.PriceActual, il.QtyInvoiced, i.DateInvoiced, il.Line // ,il.PriceActual, il.QtyInvoiced, i.DateInvoiced, il.Line
+ "FROM C_InvoiceLine il " .append("FROM C_InvoiceLine il ")
+ " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) " .append(" INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) ")
+ "WHERE il.M_Product_ID=?" .append("WHERE il.M_Product_ID=?")
+ " AND i.IsSOTrx='N'"; .append(" AND i.IsSOTrx='N'");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND il.AD_Org_ID=?"; sql.append(" AND il.AD_Org_ID=?");
else if (M_ASI_ID != 0) else if (M_ASI_ID != 0)
sql += " AND il.M_AttributeSetInstance_ID=?"; sql.append(" AND il.M_AttributeSetInstance_ID=?");
sql += " ORDER BY i.DateInvoiced DESC, il.Line DESC"; sql.append(" ORDER BY i.DateInvoiced DESC, il.Line DESC");
// //
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, product.get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), product.get_TrxName());
pstmt.setInt (1, C_Currency_ID); pstmt.setInt (1, C_Currency_ID);
pstmt.setInt (2, product.getM_Product_ID()); pstmt.setInt (2, product.getM_Product_ID());
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
@ -494,7 +494,7 @@ public class MCost extends X_M_Cost
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log (Level.SEVERE, sql, e); s_log.log (Level.SEVERE, sql.toString(), e);
} }
try try
{ {
@ -527,24 +527,24 @@ public class MCost extends X_M_Cost
int M_ASI_ID, int AD_Org_ID, int C_Currency_ID) int M_ASI_ID, int AD_Org_ID, int C_Currency_ID)
{ {
BigDecimal retValue = null; BigDecimal retValue = null;
String sql = "SELECT currencyConvert(ol.PriceCost, o.C_Currency_ID, ?, o.DateAcct, o.C_ConversionType_ID, ol.AD_Client_ID, ol.AD_Org_ID)," StringBuilder sql = new StringBuilder("SELECT currencyConvert(ol.PriceCost, o.C_Currency_ID, ?, o.DateAcct, o.C_ConversionType_ID, ol.AD_Client_ID, ol.AD_Org_ID),")
+ " currencyConvert(ol.PriceActual, o.C_Currency_ID, ?, o.DateAcct, o.C_ConversionType_ID, ol.AD_Client_ID, ol.AD_Org_ID) " .append(" currencyConvert(ol.PriceActual, o.C_Currency_ID, ?, o.DateAcct, o.C_ConversionType_ID, ol.AD_Client_ID, ol.AD_Org_ID) ")
// ,ol.PriceCost,ol.PriceActual, ol.QtyOrdered, o.DateOrdered, ol.Line // ,ol.PriceCost,ol.PriceActual, ol.QtyOrdered, o.DateOrdered, ol.Line
+ "FROM C_OrderLine ol" .append("FROM C_OrderLine ol")
+ " INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) " .append(" INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) ")
+ "WHERE ol.M_Product_ID=?" .append("WHERE ol.M_Product_ID=?")
+ " AND o.IsSOTrx='N'"; .append(" AND o.IsSOTrx='N'");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND ol.AD_Org_ID=?"; sql.append(" AND ol.AD_Org_ID=?");
else if (M_ASI_ID != 0) else if (M_ASI_ID != 0)
sql += " AND ol.M_AttributeSetInstance_ID=?"; sql.append(" AND ol.M_AttributeSetInstance_ID=?");
sql += " ORDER BY o.DateOrdered DESC, ol.Line DESC"; sql.append(" ORDER BY o.DateOrdered DESC, ol.Line DESC");
// //
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, product.get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), product.get_TrxName());
pstmt.setInt (1, C_Currency_ID); pstmt.setInt (1, C_Currency_ID);
pstmt.setInt (2, C_Currency_ID); pstmt.setInt (2, C_Currency_ID);
pstmt.setInt (3, product.getM_Product_ID()); pstmt.setInt (3, product.getM_Product_ID());
@ -562,7 +562,7 @@ public class MCost extends X_M_Cost
} }
catch (SQLException e) catch (SQLException e)
{ {
throw new DBException(e, sql); throw new DBException(e, sql.toString());
} }
finally finally
{ {
@ -838,18 +838,18 @@ public class MCost extends X_M_Cost
public static BigDecimal calculateAverageInv (MProduct product, int M_AttributeSetInstance_ID, public static BigDecimal calculateAverageInv (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID) MAcctSchema as, int AD_Org_ID)
{ {
String sql = "SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual," StringBuilder sql = new StringBuilder("SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual,")
+ " i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID " .append(" i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID ")
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)" .append(" INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)")
+ " INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)" .append(" INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)")
+ " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) " .append(" INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) ")
+ "WHERE t.M_Product_ID=?"; .append("WHERE t.M_Product_ID=?");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND t.AD_Org_ID=?"; sql.append(" AND t.AD_Org_ID=?");
else if (M_AttributeSetInstance_ID != 0) else if (M_AttributeSetInstance_ID != 0)
sql += " AND t.M_AttributeSetInstance_ID=?"; sql.append(" AND t.M_AttributeSetInstance_ID=?");
sql += " ORDER BY t.M_Transaction_ID"; sql.append(" ORDER BY t.M_Transaction_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -859,7 +859,7 @@ public class MCost extends X_M_Cost
int oldTransaction_ID = 0; int oldTransaction_ID = 0;
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt (1, product.getM_Product_ID()); pstmt.setInt (1, product.getM_Product_ID());
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
pstmt.setInt (2, AD_Org_ID); pstmt.setInt (2, AD_Org_ID);
@ -904,7 +904,7 @@ public class MCost extends X_M_Cost
} }
catch (SQLException e) catch (SQLException e)
{ {
throw new DBException(e, sql); throw new DBException(e, sql.toString());
} }
finally finally
{ {
@ -931,19 +931,19 @@ public class MCost extends X_M_Cost
public static BigDecimal calculateAveragePO (MProduct product, int M_AttributeSetInstance_ID, public static BigDecimal calculateAveragePO (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID) MAcctSchema as, int AD_Org_ID)
{ {
String sql = "SELECT t.MovementQty, mp.Qty, ol.QtyOrdered, ol.PriceCost, ol.PriceActual," // 1..5 StringBuilder sql = new StringBuilder("SELECT t.MovementQty, mp.Qty, ol.QtyOrdered, ol.PriceCost, ol.PriceActual,") // 1..5
+ " o.C_Currency_ID, o.DateAcct, o.C_ConversionType_ID," // 6..8 .append(" o.C_Currency_ID, o.DateAcct, o.C_ConversionType_ID,") // 6..8
+ " o.AD_Client_ID, o.AD_Org_ID, t.M_Transaction_ID " // 9..11 .append(" o.AD_Client_ID, o.AD_Org_ID, t.M_Transaction_ID ") // 9..11
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_MatchPO mp ON (t.M_InOutLine_ID=mp.M_InOutLine_ID)" .append(" INNER JOIN M_MatchPO mp ON (t.M_InOutLine_ID=mp.M_InOutLine_ID)")
+ " INNER JOIN C_OrderLine ol ON (mp.C_OrderLine_ID=ol.C_OrderLine_ID)" .append(" INNER JOIN C_OrderLine ol ON (mp.C_OrderLine_ID=ol.C_OrderLine_ID)")
+ " INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) " .append(" INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) ")
+ "WHERE t.M_Product_ID=?"; .append("WHERE t.M_Product_ID=?");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND t.AD_Org_ID=?"; sql.append(" AND t.AD_Org_ID=?");
else if (M_AttributeSetInstance_ID != 0) else if (M_AttributeSetInstance_ID != 0)
sql += " AND t.M_AttributeSetInstance_ID=?"; sql.append(" AND t.M_AttributeSetInstance_ID=?");
sql += " ORDER BY t.M_Transaction_ID"; sql.append(" ORDER BY t.M_Transaction_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -953,7 +953,7 @@ public class MCost extends X_M_Cost
int oldTransaction_ID = 0; int oldTransaction_ID = 0;
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt (1, product.getM_Product_ID()); pstmt.setInt (1, product.getM_Product_ID());
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
pstmt.setInt (2, AD_Org_ID); pstmt.setInt (2, AD_Org_ID);
@ -1000,7 +1000,7 @@ public class MCost extends X_M_Cost
} }
catch (SQLException e) catch (SQLException e)
{ {
throw new DBException(e, sql); throw new DBException(e, sql.toString());
} }
finally finally
{ {
@ -1027,18 +1027,18 @@ public class MCost extends X_M_Cost
public static BigDecimal calculateFiFo (MProduct product, int M_AttributeSetInstance_ID, public static BigDecimal calculateFiFo (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID) MAcctSchema as, int AD_Org_ID)
{ {
String sql = "SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual," StringBuilder sql = new StringBuilder("SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual,")
+ " i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID " .append(" i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID ")
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)" .append(" INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)")
+ " INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)" .append(" INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)")
+ " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) " .append(" INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) ")
+ "WHERE t.M_Product_ID=?"; .append("WHERE t.M_Product_ID=?");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND t.AD_Org_ID=?"; sql.append(" AND t.AD_Org_ID=?");
else if (M_AttributeSetInstance_ID != 0) else if (M_AttributeSetInstance_ID != 0)
sql += " AND t.M_AttributeSetInstance_ID=?"; sql.append(" AND t.M_AttributeSetInstance_ID=?");
sql += " ORDER BY t.M_Transaction_ID"; sql.append(" ORDER BY t.M_Transaction_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -1047,7 +1047,7 @@ public class MCost extends X_M_Cost
ArrayList<QtyCost> fifo = new ArrayList<QtyCost>(); ArrayList<QtyCost> fifo = new ArrayList<QtyCost>();
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt (1, product.getM_Product_ID()); pstmt.setInt (1, product.getM_Product_ID());
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
pstmt.setInt (2, AD_Org_ID); pstmt.setInt (2, AD_Org_ID);
@ -1136,7 +1136,7 @@ public class MCost extends X_M_Cost
} }
catch (SQLException e) catch (SQLException e)
{ {
throw new DBException(e, sql); throw new DBException(e, sql.toString());
} }
finally finally
{ {
@ -1164,19 +1164,19 @@ public class MCost extends X_M_Cost
public static BigDecimal calculateLiFo (MProduct product, int M_AttributeSetInstance_ID, public static BigDecimal calculateLiFo (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID) MAcctSchema as, int AD_Org_ID)
{ {
String sql = "SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual," StringBuilder sql = new StringBuilder("SELECT t.MovementQty, mi.Qty, il.QtyInvoiced, il.PriceActual,")
+ " i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID " .append(" i.C_Currency_ID, i.DateAcct, i.C_ConversionType_ID, i.AD_Client_ID, i.AD_Org_ID, t.M_Transaction_ID ")
+ "FROM M_Transaction t" .append("FROM M_Transaction t")
+ " INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)" .append(" INNER JOIN M_MatchInv mi ON (t.M_InOutLine_ID=mi.M_InOutLine_ID)")
+ " INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)" .append(" INNER JOIN C_InvoiceLine il ON (mi.C_InvoiceLine_ID=il.C_InvoiceLine_ID)")
+ " INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) " .append(" INNER JOIN C_Invoice i ON (il.C_Invoice_ID=i.C_Invoice_ID) ")
+ "WHERE t.M_Product_ID=?"; .append("WHERE t.M_Product_ID=?");
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
sql += " AND t.AD_Org_ID=?"; sql.append(" AND t.AD_Org_ID=?");
else if (M_AttributeSetInstance_ID != 0) else if (M_AttributeSetInstance_ID != 0)
sql += " AND t.M_AttributeSetInstance_ID=?"; sql.append(" AND t.M_AttributeSetInstance_ID=?");
// Starting point? // Starting point?
sql += " ORDER BY t.M_Transaction_ID DESC"; sql.append(" ORDER BY t.M_Transaction_ID DESC");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -1185,7 +1185,7 @@ public class MCost extends X_M_Cost
ArrayList<QtyCost> lifo = new ArrayList<QtyCost>(); ArrayList<QtyCost> lifo = new ArrayList<QtyCost>();
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt (1, product.getM_Product_ID()); pstmt.setInt (1, product.getM_Product_ID());
if (AD_Org_ID != 0) if (AD_Org_ID != 0)
pstmt.setInt (2, AD_Org_ID); pstmt.setInt (2, AD_Org_ID);
@ -1255,7 +1255,7 @@ public class MCost extends X_M_Cost
} }
catch (SQLException e) catch (SQLException e)
{ {
throw new DBException(e, sql); throw new DBException(e, sql.toString());
} }
finally finally
{ {
@ -1299,7 +1299,7 @@ public class MCost extends X_M_Cost
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("Qty=").append(Qty) StringBuilder sb = new StringBuilder ("Qty=").append(Qty)
.append (",Cost=").append (Cost); .append (",Cost=").append (Cost);
return sb.toString (); return sb.toString ();
} // toString } // toString
@ -1562,7 +1562,7 @@ public class MCost extends X_M_Cost
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MCost["); StringBuilder sb = new StringBuilder ("MCost[");
sb.append ("AD_Client_ID=").append (getAD_Client_ID()); sb.append ("AD_Client_ID=").append (getAD_Client_ID());
if (getAD_Org_ID() != 0) if (getAD_Org_ID() != 0)
sb.append (",AD_Org_ID=").append (getAD_Org_ID()); sb.append (",AD_Org_ID=").append (getAD_Org_ID());

View File

@ -73,12 +73,12 @@ public class MCostDetail extends X_M_CostDetail
String Description, String trxName) String Description, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND C_OrderLine_ID=" + C_OrderLine_ID .append(" AND C_OrderLine_ID=").append(C_OrderLine_ID)
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "C_OrderLine_ID=?", MCostDetail cd = get (as.getCtx(), "C_OrderLine_ID=?",
@ -140,12 +140,12 @@ public class MCostDetail extends X_M_CostDetail
String Description, String trxName) String Description, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND C_InvoiceLine_ID=" + C_InvoiceLine_ID .append(" AND C_InvoiceLine_ID=").append(C_InvoiceLine_ID)
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=?", MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=?",
@ -207,12 +207,12 @@ public class MCostDetail extends X_M_CostDetail
String Description, boolean IsSOTrx, String trxName) String Description, boolean IsSOTrx, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND M_InOutLine_ID=" + M_InOutLine_ID .append(" AND M_InOutLine_ID=").append(M_InOutLine_ID)
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "M_InOutLine_ID=?", MCostDetail cd = get (as.getCtx(), "M_InOutLine_ID=?",
@ -274,12 +274,12 @@ public class MCostDetail extends X_M_CostDetail
String Description, String trxName) String Description, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND M_InventoryLine_ID=" + M_InventoryLine_ID .append(" AND M_InventoryLine_ID=").append(M_InventoryLine_ID)
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "M_InventoryLine_ID=?", MCostDetail cd = get (as.getCtx(), "M_InventoryLine_ID=?",
@ -341,17 +341,18 @@ public class MCostDetail extends X_M_CostDetail
String Description, String trxName) String Description, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND M_MovementLine_ID=" + M_MovementLine_ID .append(" AND M_MovementLine_ID=").append(M_MovementLine_ID)
+ " AND IsSOTrx=" + (from ? "'Y'" : "'N'") .append(" AND IsSOTrx=").append((from ? "'Y'" : "'N'"))
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "M_MovementLine_ID=? AND IsSOTrx=" StringBuilder msget = new StringBuilder( "M_MovementLine_ID=? AND IsSOTrx=")
+ (from ? "'Y'" : "'N'"), .append((from ? "'Y'" : "'N'"));
MCostDetail cd = get (as.getCtx(),msget.toString(),
M_MovementLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); M_MovementLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName);
// //
if (cd == null) // createNew if (cd == null) // createNew
@ -410,12 +411,12 @@ public class MCostDetail extends X_M_CostDetail
String Description, String trxName) String Description, String trxName)
{ {
// Delete Unprocessed zero Differences // Delete Unprocessed zero Differences
String sql = "DELETE M_CostDetail " StringBuilder sql = new StringBuilder("DELETE M_CostDetail ")
+ "WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0" .append("WHERE Processed='N' AND COALESCE(DeltaAmt,0)=0 AND COALESCE(DeltaQty,0)=0")
+ " AND M_ProductionLine_ID=" + M_ProductionLine_ID .append(" AND M_ProductionLine_ID=").append(M_ProductionLine_ID)
+ " AND C_AcctSchema_ID =" + as.getC_AcctSchema_ID() .append(" AND C_AcctSchema_ID =").append(as.getC_AcctSchema_ID())
+ " AND M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID; .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID);
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql.toString(), trxName);
if (no != 0) if (no != 0)
s_log.config("Deleted #" + no); s_log.config("Deleted #" + no);
MCostDetail cd = get (as.getCtx(), "M_ProductionLine_ID=?", MCostDetail cd = get (as.getCtx(), "M_ProductionLine_ID=?",
@ -467,21 +468,21 @@ public class MCostDetail extends X_M_CostDetail
public static MCostDetail get (Properties ctx, String whereClause, public static MCostDetail get (Properties ctx, String whereClause,
int ID, int M_AttributeSetInstance_ID, String trxName) int ID, int M_AttributeSetInstance_ID, String trxName)
{ {
String sql = "SELECT * FROM M_CostDetail WHERE " + whereClause; StringBuilder sql = new StringBuilder("SELECT * FROM M_CostDetail WHERE ").append(whereClause);
MClientInfo clientInfo = MClientInfo.get(ctx); MClientInfo clientInfo = MClientInfo.get(ctx);
MAcctSchema primary = clientInfo.getMAcctSchema1(); MAcctSchema primary = clientInfo.getMAcctSchema1();
int C_AcctSchema_ID = primary != null ? primary.getC_AcctSchema_ID() : 0; int C_AcctSchema_ID = primary != null ? primary.getC_AcctSchema_ID() : 0;
if (C_AcctSchema_ID > 0) if (C_AcctSchema_ID > 0)
{ {
sql = sql + " AND C_AcctSchema_ID=?"; sql.append(" AND C_AcctSchema_ID=?");
} }
MCostDetail retValue = null; MCostDetail retValue = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql.toString(), null);
pstmt.setInt (1, ID); pstmt.setInt (1, ID);
pstmt.setInt (2, M_AttributeSetInstance_ID); pstmt.setInt (2, M_AttributeSetInstance_ID);
if (C_AcctSchema_ID > 0) if (C_AcctSchema_ID > 0)
@ -515,10 +516,10 @@ public class MCostDetail extends X_M_CostDetail
public static MCostDetail get (Properties ctx, String whereClause, public static MCostDetail get (Properties ctx, String whereClause,
int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName)
{ {
final String localWhereClause = whereClause StringBuilder localWhereClause = new StringBuilder(whereClause)
+ " AND M_AttributeSetInstance_ID=?" .append(" AND M_AttributeSetInstance_ID=?")
+ " AND C_AcctSchema_ID=?"; .append(" AND C_AcctSchema_ID=?");
MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,localWhereClause,trxName) MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,localWhereClause.toString(),trxName)
.setParameters(ID,M_AttributeSetInstance_ID,C_AcctSchema_ID) .setParameters(ID,M_AttributeSetInstance_ID,C_AcctSchema_ID)
.first(); .first();
return retValue; return retValue;
@ -714,7 +715,7 @@ public class MCostDetail extends X_M_CostDetail
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MCostDetail["); StringBuilder sb = new StringBuilder ("MCostDetail[");
sb.append (get_ID()); sb.append (get_ID());
if (getC_OrderLine_ID() != 0) if (getC_OrderLine_ID() != 0)
sb.append (",C_OrderLine_ID=").append (getC_OrderLine_ID()); sb.append (",C_OrderLine_ID=").append (getC_OrderLine_ID());
@ -1001,17 +1002,17 @@ public class MCostDetail extends X_M_CostDetail
* Solution: * Solution:
* Make sure the current qty is reflecting the actual qty in storage * Make sure the current qty is reflecting the actual qty in storage
*/ */
String sql = "SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage" StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage")
+ " WHERE AD_Client_ID=" + cost.getAD_Client_ID() .append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID())
+ " AND M_Product_ID=" + cost.getM_Product_ID(); .append(" AND M_Product_ID=").append(cost.getM_Product_ID());
//Costing Level //Costing Level
String CostingLevel = product.getCostingLevel(as); String CostingLevel = product.getCostingLevel(as);
if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel)) if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel))
sql += " AND AD_Org_ID=" + cost.getAD_Org_ID(); sql.append(" AND AD_Org_ID=").append(cost.getAD_Org_ID());
else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel))
sql += " AND M_AttributeSetInstance_ID=" + M_ASI_ID; sql.append(" AND M_AttributeSetInstance_ID=").append(M_ASI_ID);
// //
BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql); BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql.toString());
if (qtyOnhand.signum() != 0) if (qtyOnhand.signum() != 0)
{ {
BigDecimal oldSum = cost.getCurrentCostPrice().multiply(cost.getCurrentQty()); BigDecimal oldSum = cost.getCurrentCostPrice().multiply(cost.getCurrentQty());
@ -1158,17 +1159,17 @@ public class MCostDetail extends X_M_CostDetail
MCostElement[] lce = MCostElement.getNonCostingMethods(this); MCostElement[] lce = MCostElement.getNonCostingMethods(this);
if (lce.length > 0) if (lce.length > 0)
{ {
String sql = "SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage" StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_Storage")
+ " WHERE AD_Client_ID=" + cost.getAD_Client_ID() .append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID())
+ " AND M_Product_ID=" + cost.getM_Product_ID(); .append(" AND M_Product_ID=").append(cost.getM_Product_ID());
//Costing Level //Costing Level
String CostingLevel = product.getCostingLevel(as); String CostingLevel = product.getCostingLevel(as);
if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel)) if (MAcctSchema.COSTINGLEVEL_Organization.equals(CostingLevel))
sql += " AND AD_Org_ID=" + cost.getAD_Org_ID(); sql.append(" AND AD_Org_ID=").append(cost.getAD_Org_ID());
else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel)) else if (MAcctSchema.COSTINGLEVEL_BatchLot.equals(CostingLevel))
sql += " AND M_AttributeSetInstance_ID=" + M_ASI_ID; sql.append(" AND M_AttributeSetInstance_ID=").append(M_ASI_ID);
// //
BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql); BigDecimal qtyOnhand = DB.getSQLValueBD(get_TrxName(), sql.toString());
for (int i = 0 ; i < lce.length ; i++) for (int i = 0 ; i < lce.length ; i++)
{ {
MCost lCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(), MCost lCost = MCost.get(getCtx(), cost.getAD_Client_ID(), cost.getAD_Org_ID(),

View File

@ -441,7 +441,7 @@ public class MCostElement extends X_M_CostElement
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MCostElement["); StringBuilder sb = new StringBuilder ("MCostElement[");
sb.append (get_ID ()) sb.append (get_ID ())
.append ("-").append (getName()) .append ("-").append (getName())
.append(",Type=").append(getCostElementType()) .append(",Type=").append(getCostElementType())

View File

@ -115,21 +115,21 @@ public class MCostQueue extends X_M_CostQueue
MAcctSchema as, int Org_ID, MCostElement ce, String trxName) MAcctSchema as, int Org_ID, MCostElement ce, String trxName)
{ {
ArrayList<MCostQueue> list = new ArrayList<MCostQueue>(); ArrayList<MCostQueue> list = new ArrayList<MCostQueue>();
String sql = "SELECT * FROM M_CostQueue " StringBuilder sql = new StringBuilder("SELECT * FROM M_CostQueue ")
+ "WHERE AD_Client_ID=? AND AD_Org_ID=?" .append("WHERE AD_Client_ID=? AND AD_Org_ID=?")
+ " AND M_Product_ID=?" .append(" AND M_Product_ID=?")
+ " AND M_CostType_ID=? AND C_AcctSchema_ID=?" .append(" AND M_CostType_ID=? AND C_AcctSchema_ID=?")
+ " AND M_CostElement_ID=?"; .append(" AND M_CostElement_ID=?");
if (M_ASI_ID != 0) if (M_ASI_ID != 0)
sql += " AND M_AttributeSetInstance_ID=?"; sql.append(" AND M_AttributeSetInstance_ID=?");
sql += " AND CurrentQty<>0 " sql.append(" AND CurrentQty<>0 ")
+ "ORDER BY M_AttributeSetInstance_ID "; .append("ORDER BY M_AttributeSetInstance_ID ");
if (!ce.isFifo()) if (!ce.isFifo())
sql += "DESC"; sql.append("DESC");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, trxName); pstmt = DB.prepareStatement (sql.toString(), trxName);
pstmt.setInt (1, product.getAD_Client_ID()); pstmt.setInt (1, product.getAD_Client_ID());
pstmt.setInt (2, Org_ID); pstmt.setInt (2, Org_ID);
pstmt.setInt (3, product.getM_Product_ID()); pstmt.setInt (3, product.getM_Product_ID());
@ -147,7 +147,7 @@ public class MCostQueue extends X_M_CostQueue
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log (Level.SEVERE, sql, e); s_log.log (Level.SEVERE, sql.toString(), e);
} }
try try
{ {

View File

@ -61,7 +61,7 @@ public class MCostType extends X_M_CostType
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MCostType["); StringBuilder sb = new StringBuilder ("MCostType[");
sb.append (get_ID()).append ("-").append (getName ()).append ("]"); sb.append (get_ID()).append ("-").append (getName ()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -146,15 +146,15 @@ public class MCurrency extends X_C_Currency
*/ */
public static String getISO_Code (Properties ctx, int C_Currency_ID) public static String getISO_Code (Properties ctx, int C_Currency_ID)
{ {
String contextKey = "C_Currency_" + C_Currency_ID; StringBuilder contextKey = new StringBuilder("C_Currency_").append(C_Currency_ID);
String retValue = ctx.getProperty(contextKey); String retValue = ctx.getProperty(contextKey.toString());
if (retValue != null) if (retValue != null)
return retValue; return retValue;
// Create it // Create it
MCurrency c = get(ctx, C_Currency_ID); MCurrency c = get(ctx, C_Currency_ID);
retValue = c.getISO_Code(); retValue = c.getISO_Code();
ctx.setProperty(contextKey, retValue); ctx.setProperty(contextKey.toString(), retValue);
return retValue; return retValue;
} // getISO } // getISO
@ -176,10 +176,11 @@ public class MCurrency extends X_C_Currency
*/ */
public String toString() public String toString()
{ {
return "MCurrency[" + getC_Currency_ID() StringBuilder msgreturn = new StringBuilder("MCurrency[").append(getC_Currency_ID())
+ "-" + getISO_Code() + "-" + getCurSymbol() .append("-").append(getISO_Code()).append("-").append(getCurSymbol())
+ "," + getDescription() .append(",").append(getDescription())
+ ",Precision=" + getStdPrecision() + "/" + getCostingPrecision(); .append(",Precision=").append(getStdPrecision()).append("/").append(getCostingPrecision());
return msgreturn.toString();
} // toString } // toString

View File

@ -37,24 +37,24 @@ public class MDashboardContent extends X_PA_DashboardContent
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
String whereClause = COLUMNNAME_IsShowInDashboard+"=?"; StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?");
if (AD_Role_ID == 0) if (AD_Role_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_Role_ID+" IS NULL OR "+COLUMNNAME_AD_Role_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_Role_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0) if (AD_User_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_User_ID+" IS NULL OR "+COLUMNNAME_AD_User_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_User_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>(); List<Object> parameters = new ArrayList<Object>();
parameters.add(isShowInDashboard); parameters.add(isShowInDashboard);
parameters.add(AD_Role_ID); parameters.add(AD_Role_ID);
parameters.add(AD_User_ID); parameters.add(AD_User_ID);
return new Query(ctx, Table_Name, whereClause, null) return new Query(ctx, Table_Name, whereClause.toString(), null)
.setParameters(parameters) .setParameters(parameters)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setApplyAccessFilter(true, false) .setApplyAccessFilter(true, false)
@ -71,23 +71,23 @@ public class MDashboardContent extends X_PA_DashboardContent
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
String whereClause = ""; StringBuilder whereClause = new StringBuilder();
if (AD_Role_ID == 0) if (AD_Role_ID == 0)
whereClause += "("+COLUMNNAME_AD_Role_ID+" IS NULL OR "+COLUMNNAME_AD_Role_ID+"=?)"; whereClause.append("(").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else else
whereClause += COLUMNNAME_AD_Role_ID+"=?"; whereClause.append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0) if (AD_User_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_User_ID+" IS NULL OR "+COLUMNNAME_AD_User_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_User_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>(); List<Object> parameters = new ArrayList<Object>();
parameters.add(AD_Role_ID); parameters.add(AD_Role_ID);
parameters.add(AD_User_ID); parameters.add(AD_User_ID);
return new Query(ctx, Table_Name, whereClause, null) return new Query(ctx, Table_Name, whereClause.toString(), null)
.setParameters(parameters) .setParameters(parameters)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setApplyAccessFilter(true, false) .setApplyAccessFilter(true, false)

View File

@ -49,24 +49,24 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
String whereClause = COLUMNNAME_IsShowInDashboard+"=?"; StringBuilder whereClause = new StringBuilder(COLUMNNAME_IsShowInDashboard).append("=?");
if (AD_Role_ID == 0) if (AD_Role_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_Role_ID+" IS NULL OR "+COLUMNNAME_AD_Role_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_Role_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0) if (AD_User_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_User_ID+" IS NULL OR "+COLUMNNAME_AD_User_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_User_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>(); List<Object> parameters = new ArrayList<Object>();
parameters.add(isShowInDashboard); parameters.add(isShowInDashboard);
parameters.add(AD_Role_ID); parameters.add(AD_Role_ID);
parameters.add(AD_User_ID); parameters.add(AD_User_ID);
return new Query(ctx, Table_Name, whereClause, null) return new Query(ctx, Table_Name, whereClause.toString(), null)
.setParameters(parameters) .setParameters(parameters)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setApplyAccessFilter(true, false) .setApplyAccessFilter(true, false)
@ -83,23 +83,23 @@ public class MDashboardPreference extends X_PA_DashboardPreference
{ {
Properties ctx = Env.getCtx(); Properties ctx = Env.getCtx();
String whereClause = ""; StringBuilder whereClause = new StringBuilder();
if (AD_Role_ID == 0) if (AD_Role_ID == 0)
whereClause += "("+COLUMNNAME_AD_Role_ID+" IS NULL OR "+COLUMNNAME_AD_Role_ID+"=?)"; whereClause.append("(").append(COLUMNNAME_AD_Role_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_Role_ID).append("=?)");
else else
whereClause += COLUMNNAME_AD_Role_ID+"=?"; whereClause.append(COLUMNNAME_AD_Role_ID).append("=?");
if (AD_User_ID == 0) if (AD_User_ID == 0)
whereClause += " AND ("+COLUMNNAME_AD_User_ID+" IS NULL OR "+COLUMNNAME_AD_User_ID+"=?)"; whereClause.append(" AND (").append(COLUMNNAME_AD_User_ID).append(" IS NULL OR ").append(COLUMNNAME_AD_User_ID).append("=?)");
else else
whereClause += " AND "+COLUMNNAME_AD_User_ID+"=?"; whereClause.append(" AND ").append(COLUMNNAME_AD_User_ID).append("=?");
List<Object> parameters = new ArrayList<Object>(); List<Object> parameters = new ArrayList<Object>();
parameters.add(AD_Role_ID); parameters.add(AD_Role_ID);
parameters.add(AD_User_ID); parameters.add(AD_User_ID);
return new Query(ctx, Table_Name, whereClause, null) return new Query(ctx, Table_Name, whereClause.toString(), null)
.setParameters(parameters) .setParameters(parameters)
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setApplyAccessFilter(true, false) .setApplyAccessFilter(true, false)

View File

@ -63,9 +63,9 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
int p_wkasset_ID = 0; int p_wkasset_ID = 0;
//p_A_Asset_ID = getA_Asset_ID(); //p_A_Asset_ID = getA_Asset_ID();
p_wkasset_ID = getA_Depreciation_Workfile_ID(); p_wkasset_ID = getA_Depreciation_Workfile_ID();
StringBuffer sqlB = new StringBuffer ("UPDATE A_Depreciation_Workfile " StringBuilder sqlB = new StringBuilder ("UPDATE A_Depreciation_Workfile ")
+ "SET Processing = 'Y'" .append("SET Processing = 'Y'")
+ " WHERE A_Depreciation_Workfile_ID = " + p_wkasset_ID ); .append(" WHERE A_Depreciation_Workfile_ID = " ).append(p_wkasset_ID );
int no = DB.executeUpdate (sqlB.toString(),null); int no = DB.executeUpdate (sqlB.toString(),null);
if (no == -1) if (no == -1)

View File

@ -72,22 +72,22 @@ public class MDesktop
{ {
AD_Desktop_ID = ad_Desktop_ID; AD_Desktop_ID = ad_Desktop_ID;
// Get WB info // Get WB info
String sql = null; StringBuilder sql = null;
if (Env.isBaseLanguage(m_ctx, "AD_Desktop")) if (Env.isBaseLanguage(m_ctx, "AD_Desktop"))
sql = "SELECT Name,Description,Help," // 1..3 sql = new StringBuilder("SELECT Name,Description,Help,") // 1..3
+ " AD_Column_ID,AD_Image_ID,AD_Color_ID,PA_Goal_ID " // 4..7 .append(" AD_Column_ID,AD_Image_ID,AD_Color_ID,PA_Goal_ID ") // 4..7
+ "FROM AD_Desktop " .append("FROM AD_Desktop ")
+ "WHERE AD_Desktop_ID=? AND IsActive='Y'"; .append("WHERE AD_Desktop_ID=? AND IsActive='Y'");
else else
sql = "SELECT t.Name,t.Description,t.Help," sql = new StringBuilder("SELECT t.Name,t.Description,t.Help,")
+ " w.AD_Column_ID,w.AD_Image_ID,w.AD_Color_ID,w.PA_Goal_ID " .append(" w.AD_Column_ID,w.AD_Image_ID,w.AD_Color_ID,w.PA_Goal_ID ")
+ "FROM AD_Desktop w, AD_Desktop_Trl t " .append("FROM AD_Desktop w, AD_Desktop_Trl t ")
+ "WHERE w.AD_Desktop_ID=? AND w.IsActive='Y'" .append("WHERE w.AD_Desktop_ID=? AND w.IsActive='Y'")
+ " AND w.AD_Desktop_ID=t.AD_Desktop_ID" .append(" AND w.AD_Desktop_ID=t.AD_Desktop_ID")
+ " AND t.AD_Language='" + Env.getAD_Language(m_ctx) + "'"; .append(" AND t.AD_Language='").append(Env.getAD_Language(m_ctx)).append("'");
try try
{ {
PreparedStatement pstmt = DB.prepareStatement(sql, null); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, AD_Desktop_ID); pstmt.setInt(1, AD_Desktop_ID);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
@ -112,7 +112,7 @@ public class MDesktop
} }
catch (SQLException e) catch (SQLException e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
} }
if (AD_Desktop_ID == 0) if (AD_Desktop_ID == 0)
@ -126,7 +126,8 @@ public class MDesktop
*/ */
public String toString() public String toString()
{ {
return "MDesktop ID=" + AD_Desktop_ID + " " + Name; StringBuilder msgreturn = new StringBuilder("MDesktop ID=").append(AD_Desktop_ID).append(" ").append(Name);
return msgreturn.toString();
} }
/************************************************************************** /**************************************************************************

View File

@ -109,7 +109,7 @@ public class MDiscountSchemaBreak extends X_M_DiscountSchemaBreak
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MDiscountSchemaBreak["); StringBuilder sb = new StringBuilder ("MDiscountSchemaBreak[");
sb.append(get_ID()).append("-Seq=").append(getSeqNo()); sb.append(get_ID()).append("-Seq=").append(getSeqNo());
if (getM_Product_Category_ID() != 0) if (getM_Product_Category_ID() != 0)
sb.append(",M_Product_Category_ID=").append(getM_Product_Category_ID()); sb.append(",M_Product_Category_ID=").append(getM_Product_Category_ID());

View File

@ -270,12 +270,12 @@ public class MDistribution extends X_GL_Distribution
*/ */
public String validate() public String validate()
{ {
String retValue = null; StringBuilder retValue = null;
getLines(true); getLines(true);
if (m_lines.length == 0) if (m_lines.length == 0)
retValue = "@NoLines@"; retValue = new StringBuilder("@NoLines@");
else if (getPercentTotal().compareTo(Env.ONEHUNDRED) != 0) else if (getPercentTotal().compareTo(Env.ONEHUNDRED) != 0)
retValue = "@PercentTotal@ <> 100"; retValue = new StringBuilder("@PercentTotal@ <> 100");
else else
{ {
// More then one line with 0 // More then one line with 0
@ -286,8 +286,8 @@ public class MDistribution extends X_GL_Distribution
{ {
if (lineFound >= 0 && m_lines[i].getPercent().compareTo(Env.ZERO) == 0) if (lineFound >= 0 && m_lines[i].getPercent().compareTo(Env.ZERO) == 0)
{ {
retValue = "@Line@ " + lineFound retValue = new StringBuilder("@Line@ ").append(lineFound)
+ " + " + m_lines[i].getLine() + ": == 0"; .append(" + ").append(m_lines[i].getLine()).append(": == 0");
break; break;
} }
lineFound = m_lines[i].getLine(); lineFound = m_lines[i].getLine();
@ -296,7 +296,7 @@ public class MDistribution extends X_GL_Distribution
} }
setIsValid (retValue == null); setIsValid (retValue == null);
return retValue; return retValue.toString();
} // validate } // validate

View File

@ -52,15 +52,15 @@ public class MDistributionRunDetail extends X_T_DistributionRunDetail
boolean orderBP, String trxName) boolean orderBP, String trxName)
{ {
ArrayList<MDistributionRunDetail> list = new ArrayList<MDistributionRunDetail>(); ArrayList<MDistributionRunDetail> list = new ArrayList<MDistributionRunDetail>();
String sql = "SELECT * FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=? "; StringBuilder sql = new StringBuilder("SELECT * FROM T_DistributionRunDetail WHERE M_DistributionRun_ID=? ");
if (orderBP) if (orderBP)
sql += "ORDER BY C_BPartner_ID, C_BPartner_Location_ID"; sql.append("ORDER BY C_BPartner_ID, C_BPartner_Location_ID");
else else
sql += "ORDER BY M_DistributionRunLine_ID"; sql.append("ORDER BY M_DistributionRunLine_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, trxName); pstmt = DB.prepareStatement (sql.toString(), trxName);
pstmt.setInt (1, M_DistributionRun_ID); pstmt.setInt (1, M_DistributionRun_ID);
ResultSet rs = pstmt.executeQuery (); ResultSet rs = pstmt.executeQuery ();
while (rs.next ()) while (rs.next ())
@ -71,7 +71,7 @@ public class MDistributionRunDetail extends X_T_DistributionRunDetail
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log(Level.SEVERE, sql, e); s_log.log(Level.SEVERE, sql.toString(), e);
} }
try try
{ {
@ -191,7 +191,7 @@ public class MDistributionRunDetail extends X_T_DistributionRunDetail
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MDistributionRunDetail[") StringBuilder sb = new StringBuilder ("MDistributionRunDetail[")
.append (get_ID ()) .append (get_ID ())
.append (";M_DistributionListLine_ID=").append (getM_DistributionListLine_ID()) .append (";M_DistributionListLine_ID=").append (getM_DistributionListLine_ID())
.append(";Qty=").append(getQty()) .append(";Qty=").append(getQty())

View File

@ -235,7 +235,7 @@ public class MDistributionRunLine extends X_M_DistributionRunLine
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MDistributionRunLine[") StringBuilder sb = new StringBuilder ("MDistributionRunLine[")
.append(get_ID()).append("-") .append(get_ID()).append("-")
.append(getInfo()) .append(getInfo())
.append ("]"); .append ("]");
@ -248,7 +248,7 @@ public class MDistributionRunLine extends X_M_DistributionRunLine
*/ */
public String getInfo() public String getInfo()
{ {
StringBuffer sb = new StringBuffer (); StringBuilder sb = new StringBuilder ();
sb.append("Line=").append(getLine()) sb.append("Line=").append(getLine())
.append (",TotalQty=").append(getTotalQty()) .append (",TotalQty=").append(getTotalQty())
.append(",SumMin=").append(getActualMin()) .append(",SumMin=").append(getActualMin())

View File

@ -192,7 +192,7 @@ public class MDocType extends X_C_DocType
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MDocType["); StringBuilder sb = new StringBuilder("MDocType[");
sb.append(get_ID()).append("-").append(getName()) sb.append(get_ID()).append("-").append(getName())
.append(",DocNoSequence_ID=").append(getDocNoSequence_ID()) .append(",DocNoSequence_ID=").append(getDocNoSequence_ID())
.append("]"); .append("]");
@ -266,23 +266,23 @@ public class MDocType extends X_C_DocType
if (newRecord && success) if (newRecord && success)
{ {
// Add doctype/docaction access to all roles of client // Add doctype/docaction access to all roles of client
String sqlDocAction = "INSERT INTO AD_Document_Action_Access " StringBuilder sqlDocAction = new StringBuilder("INSERT INTO AD_Document_Action_Access ")
+ "(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy," .append("(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,")
+ "C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) " .append("C_DocType_ID , AD_Ref_List_ID, AD_Role_ID) ")
+ "(SELECT " .append("(SELECT ")
+ getAD_Client_ID() + ",0,'Y', SysDate," .append(getAD_Client_ID()).append(",0,'Y', SysDate,")
+ getUpdatedBy() + ", SysDate," + getUpdatedBy() .append(getUpdatedBy()).append(", SysDate,").append(getUpdatedBy())
+ ", doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID " .append(", doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID ")
+ "FROM AD_Client client " .append("FROM AD_Client client ")
+ "INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) " .append("INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) ")
+ "INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) " .append("INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) ")
+ "INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) " .append("INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID) ")
+ "WHERE client.AD_Client_ID=" + getAD_Client_ID() .append("WHERE client.AD_Client_ID=").append(getAD_Client_ID())
+ " AND doctype.C_DocType_ID=" + get_ID() .append(" AND doctype.C_DocType_ID=").append(get_ID())
+ " AND rol.IsManual='N'" .append(" AND rol.IsManual='N'")
+ ")"; .append(")");
int docact = DB.executeUpdate(sqlDocAction, get_TrxName()); int docact = DB.executeUpdate(sqlDocAction.toString(), get_TrxName());
log.fine("AD_Document_Action_Access=" + docact); log.fine("AD_Document_Action_Access=" + docact);
} }
return success; return success;
@ -296,7 +296,8 @@ public class MDocType extends X_C_DocType
protected boolean beforeDelete () protected boolean beforeDelete ()
{ {
// delete access records // delete access records
int docactDel = DB.executeUpdate("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=" + get_ID(), get_TrxName()); StringBuilder msgdb = new StringBuilder("DELETE FROM AD_Document_Action_Access WHERE C_DocType_ID=").append(get_ID());
int docactDel = DB.executeUpdate(msgdb.toString(), get_TrxName());
log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_ID()); log.fine("Delete AD_Document_Action_Access=" + docactDel + " for C_DocType_ID: " + get_ID());
return docactDel >= 0; return docactDel >= 0;
} // beforeDelete } // beforeDelete
@ -334,7 +335,7 @@ public class MDocType extends X_C_DocType
if (relatedDocTypeName != null) if (relatedDocTypeName != null)
{ {
StringBuffer whereClause = new StringBuffer(30); StringBuilder whereClause = new StringBuilder(30);
whereClause.append("Name='").append(relatedDocTypeName).append("' "); whereClause.append("Name='").append(relatedDocTypeName).append("' ");
whereClause.append("and AD_Client_ID=").append(Env.getAD_Client_ID(Env.getCtx())); whereClause.append("and AD_Client_ID=").append(Env.getAD_Client_ID(Env.getCtx()));
whereClause.append(" AND IsActive='Y'"); whereClause.append(" AND IsActive='Y'");

View File

@ -354,7 +354,7 @@ public class MDocTypeCounter extends X_C_DocTypeCounter
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MDocTypeCounter["); StringBuilder sb = new StringBuilder ("MDocTypeCounter[");
sb.append(get_ID()).append(",").append(getName()) sb.append(get_ID()).append(",").append(getName())
.append(",C_DocType_ID=").append(getC_DocType_ID()) .append(",C_DocType_ID=").append(getC_DocType_ID())
.append(",Counter=").append(getCounter_C_DocType_ID()) .append(",Counter=").append(getCounter_C_DocType_ID())

View File

@ -63,7 +63,7 @@ public class MDunning extends X_C_Dunning
@Override @Override
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MDunning[").append(get_ID()) StringBuilder sb = new StringBuilder("MDunning[").append(get_ID())
.append("-").append(getName()); .append("-").append(getName());
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();

View File

@ -145,13 +145,13 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
} }
else if (firstActive != null) else if (firstActive != null)
{ {
String msg = "@C_BPartner_ID@ " + bp.getName(); StringBuilder msg = new StringBuilder("@C_BPartner_ID@ ").append(bp.getName());
if (isSOTrx) if (isSOTrx)
msg += " @No@ @IsPayFrom@"; msg.append(" @No@ @IsPayFrom@");
else else
msg += " @No@ @IsRemitTo@"; msg.append(" @No@ @IsRemitTo@");
msg += " & @IsBillTo@"; msg.append(" & @IsBillTo@");
log.info(msg); log.info(msg.toString());
setC_BPartner_Location_ID (firstActive.getC_BPartner_Location_ID()); setC_BPartner_Location_ID (firstActive.getC_BPartner_Location_ID());
} }
} }
@ -199,13 +199,13 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
public MDunningRunLine[] getLines (boolean onlyInvoices) public MDunningRunLine[] getLines (boolean onlyInvoices)
{ {
ArrayList<MDunningRunLine> list = new ArrayList<MDunningRunLine>(); ArrayList<MDunningRunLine> list = new ArrayList<MDunningRunLine>();
String sql = "SELECT * FROM C_DunningRunLine WHERE C_DunningRunEntry_ID=?"; StringBuilder sql = new StringBuilder("SELECT * FROM C_DunningRunLine WHERE C_DunningRunEntry_ID=?");
if (onlyInvoices) if (onlyInvoices)
sql += " AND C_Invoice_ID IS NOT NULL"; sql.append(" AND C_Invoice_ID IS NOT NULL");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
pstmt.setInt(1, get_ID ()); pstmt.setInt(1, get_ID ());
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
@ -216,7 +216,7 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log(Level.SEVERE, sql, e); s_log.log(Level.SEVERE, sql.toString(), e);
} }
try try
{ {

View File

@ -340,17 +340,17 @@ public class MDunningRunLine extends X_C_DunningRunLine
private void updateEntry() private void updateEntry()
{ {
// we do not count the fee line as an item, but it sum it up. // we do not count the fee line as an item, but it sum it up.
String sql = "UPDATE C_DunningRunEntry e " StringBuilder sql = new StringBuilder("UPDATE C_DunningRunEntry e ")
+ "SET Amt=NVL((SELECT SUM(ConvertedAmt)+SUM(FeeAmt)+SUM(InterestAmt)" .append("SET Amt=NVL((SELECT SUM(ConvertedAmt)+SUM(FeeAmt)+SUM(InterestAmt)")
+ " FROM C_DunningRunLine l " .append(" FROM C_DunningRunLine l ")
+ "WHERE e.C_DunningRunEntry_ID=l.C_DunningRunEntry_ID), 0), " .append("WHERE e.C_DunningRunEntry_ID=l.C_DunningRunEntry_ID), 0), ")
+ "QTY=(SELECT COUNT(*)" .append("QTY=(SELECT COUNT(*)")
+ " FROM C_DunningRunLine l " .append(" FROM C_DunningRunLine l ")
+ "WHERE e.C_DunningRunEntry_ID=l.C_DunningRunEntry_ID " .append("WHERE e.C_DunningRunEntry_ID=l.C_DunningRunEntry_ID ")
+ " AND (NOT C_Invoice_ID IS NULL OR NOT C_Payment_ID IS NULL))" .append(" AND (NOT C_Invoice_ID IS NULL OR NOT C_Payment_ID IS NULL))")
+ " WHERE C_DunningRunEntry_ID=" + getC_DunningRunEntry_ID(); .append(" WHERE C_DunningRunEntry_ID=").append(getC_DunningRunEntry_ID());
DB.executeUpdate(sql, get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
} // updateEntry } // updateEntry
} // MDunningRunLine } // MDunningRunLine

View File

@ -131,7 +131,7 @@ public class MEXPFormat extends X_EXP_Format {
if(retValue!=null) if(retValue!=null)
return retValue; return retValue;
StringBuffer whereClause = new StringBuffer(X_EXP_Format.COLUMNNAME_Value).append("=?") StringBuilder whereClause = new StringBuilder(X_EXP_Format.COLUMNNAME_Value).append("=?")
.append(" AND AD_Client_ID = ?") .append(" AND AD_Client_ID = ?")
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?"); .append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
@ -157,7 +157,7 @@ public class MEXPFormat extends X_EXP_Format {
if(retValue!=null) if(retValue!=null)
return retValue; return retValue;
StringBuffer whereClause = new StringBuffer(" AD_Client_ID = ? ") StringBuilder whereClause = new StringBuilder(" AD_Client_ID = ? ")
.append(" AND ").append(X_EXP_Format.COLUMNNAME_AD_Table_ID).append(" = ? ") .append(" AND ").append(X_EXP_Format.COLUMNNAME_AD_Table_ID).append(" = ? ")
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?"); .append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
@ -176,7 +176,7 @@ public class MEXPFormat extends X_EXP_Format {
@Override @Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer ("X_EXP_Format[ID=").append(get_ID()).append("; Value = "+getValue()+"]"); StringBuilder sb = new StringBuilder ("X_EXP_Format[ID=").append(get_ID()).append("; Value = ").append(getValue()).append("]");
return sb.toString(); return sb.toString();
} }

View File

@ -61,7 +61,7 @@ public class MEXPFormatLine extends X_EXP_FormatLine {
@Override @Override
public String toString() { public String toString() {
StringBuffer sb = new StringBuffer ("X_EXP_FormatLine[ID=").append(get_ID()).append("; Value="+getValue()+"; Type="+getType()+"]"); StringBuilder sb = new StringBuilder ("X_EXP_FormatLine[ID=").append(get_ID()).append("; Value=").append(getValue()).append("; Type=").append(getType()).append("]");
return sb.toString(); return sb.toString();
} }
@ -70,7 +70,7 @@ public class MEXPFormatLine extends X_EXP_FormatLine {
{ {
MEXPFormatLine result = null; MEXPFormatLine result = null;
StringBuffer sql = new StringBuffer("SELECT * ") StringBuilder sql = new StringBuilder("SELECT * ")
.append(" FROM ").append(X_EXP_FormatLine.Table_Name) .append(" FROM ").append(X_EXP_FormatLine.Table_Name)
.append(" WHERE ").append(X_EXP_Format.COLUMNNAME_Value).append("=?") .append(" WHERE ").append(X_EXP_Format.COLUMNNAME_Value).append("=?")
//.append(" AND IsActive = ?") //.append(" AND IsActive = ?")

View File

@ -78,7 +78,7 @@ public class MEXPProcessor extends X_EXP_Processor {
List<X_EXP_ProcessorParameter> resultList = new ArrayList<X_EXP_ProcessorParameter>(); List<X_EXP_ProcessorParameter> resultList = new ArrayList<X_EXP_ProcessorParameter>();
StringBuffer sql = new StringBuffer("SELECT * ") StringBuilder sql = new StringBuilder("SELECT * ")
.append(" FROM ").append(X_EXP_ProcessorParameter.Table_Name) .append(" FROM ").append(X_EXP_ProcessorParameter.Table_Name)
.append(" WHERE ").append(X_EXP_ProcessorParameter.COLUMNNAME_EXP_Processor_ID).append("=?") // # 1 .append(" WHERE ").append(X_EXP_ProcessorParameter.COLUMNNAME_EXP_Processor_ID).append("=?") // # 1
.append(" AND IsActive = ?") // # 2 .append(" AND IsActive = ?") // # 2

View File

@ -183,7 +183,7 @@ public class MElementValue extends X_C_ElementValue
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer (); StringBuilder sb = new StringBuilder();
sb.append(getValue()).append(" - ").append(getName()); sb.append(getValue()).append(" - ").append(getName());
return sb.toString (); return sb.toString ();
} // toString } // toString
@ -194,7 +194,7 @@ public class MElementValue extends X_C_ElementValue
*/ */
public String toStringX () public String toStringX ()
{ {
StringBuffer sb = new StringBuffer ("MElementValue["); StringBuilder sb = new StringBuilder ("MElementValue[");
sb.append(get_ID()).append(",").append(getValue()).append(" - ").append(getName()) sb.append(get_ID()).append(",").append(getValue()).append(" - ").append(getName())
.append ("]"); .append ("]");
return sb.toString (); return sb.toString ();

View File

@ -67,7 +67,8 @@ public class MExpenseType extends X_S_ExpenseType
{ {
if (m_product == null) if (m_product == null)
{ {
MProduct[] products = MProduct.get(getCtx(), "S_ExpenseType_ID=" + getS_ExpenseType_ID(), get_TrxName()); StringBuilder msgmp = new StringBuilder("S_ExpenseType_ID=").append(getS_ExpenseType_ID());
MProduct[] products = MProduct.get(getCtx(), msgmp.toString(), get_TrxName());
if (products.length > 0) if (products.length > 0)
m_product = products[0]; m_product = products[0];
} }

View File

@ -110,7 +110,7 @@ public class MFactAcct extends X_Fact_Acct
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MFactAcct["); StringBuilder sb = new StringBuilder ("MFactAcct[");
sb.append(get_ID()).append("-Acct=").append(getAccount_ID()) sb.append(get_ID()).append("-Acct=").append(getAccount_ID())
.append(",Dr=").append(getAmtSourceDr()).append("|").append(getAmtAcctDr()) .append(",Dr=").append(getAmtSourceDr()).append("|").append(getAmtAcctDr())
.append(",Cr=").append(getAmtSourceCr()).append("|").append(getAmtAcctCr()) .append(",Cr=").append(getAmtSourceCr()).append("|").append(getAmtAcctCr())

View File

@ -167,11 +167,12 @@ public class MGLCategory extends X_GL_Category
@Override @Override
public String toString() public String toString()
{ {
return getClass().getSimpleName()+"["+get_ID() StringBuilder msgreturn = new StringBuilder(getClass().getSimpleName()).append("[").append(get_ID())
+", Name="+getName() .append(", Name=").append(getName())
+", IsDefault="+isDefault() .append(", IsDefault=").append(isDefault())
+", IsActive="+isActive() .append(", IsActive=").append(isActive())
+", CategoryType="+getCategoryType() .append(", CategoryType=").append(getCategoryType())
+"]"; .append("]");
return msgreturn.toString();
} }
} // MGLCategory } // MGLCategory

View File

@ -511,7 +511,7 @@ public class MGoal extends X_PA_Goal
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MGoal["); StringBuilder sb = new StringBuilder ("MGoal[");
sb.append (get_ID ()) sb.append (get_ID ())
.append ("-").append (getName()) .append ("-").append (getName())
.append(",").append(getGoalPerformance()) .append(",").append(getGoalPerformance())

View File

@ -63,7 +63,7 @@ public class MGoalRestriction extends X_PA_GoalRestriction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MGoalRestriction["); StringBuilder sb = new StringBuilder ("MGoalRestriction[");
sb.append (get_ID()).append ("-").append (getName()).append ("]"); sb.append (get_ID()).append ("-").append (getName()).append ("]");
return sb.toString (); return sb.toString ();
} // toString } // toString

View File

@ -134,21 +134,22 @@ public class MIMPProcessor
{ {
if (getKeepLogDays() < 1) if (getKeepLogDays() < 1)
return 0; return 0;
String sql = "DELETE " + X_IMP_ProcessorLog.Table_Name + " " StringBuilder sql = new StringBuilder("DELETE ").append(X_IMP_ProcessorLog.Table_Name).append(" ")
+ "WHERE "+X_IMP_ProcessorLog.COLUMNNAME_IMP_Processor_ID+"=" + getIMP_Processor_ID() .append("WHERE ").append(X_IMP_ProcessorLog.COLUMNNAME_IMP_Processor_ID).append("=").append(getIMP_Processor_ID())
+ " AND (Created+" + getKeepLogDays() + ") < SysDate"; .append(" AND (Created+").append(getKeepLogDays()).append(") < SysDate");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
return no; return no;
} }
public String getServerID() { public String getServerID() {
return "ReplicationProcessor" + get_ID(); StringBuilder msgreturn = new StringBuilder("ReplicationProcessor").append(get_ID());
return msgreturn.toString();
} }
public X_IMP_ProcessorParameter[] getIMP_ProcessorParameters(String trxName) { public X_IMP_ProcessorParameter[] getIMP_ProcessorParameters(String trxName) {
List<X_IMP_ProcessorParameter> resultList = new ArrayList<X_IMP_ProcessorParameter>(); List<X_IMP_ProcessorParameter> resultList = new ArrayList<X_IMP_ProcessorParameter>();
StringBuffer sql = new StringBuffer("SELECT * ") StringBuilder sql = new StringBuilder("SELECT * ")
.append(" FROM ").append(X_IMP_ProcessorParameter.Table_Name) .append(" FROM ").append(X_IMP_ProcessorParameter.Table_Name)
.append(" WHERE ").append(X_IMP_ProcessorParameter.COLUMNNAME_IMP_Processor_ID).append("=?") // # 1 .append(" WHERE ").append(X_IMP_ProcessorParameter.COLUMNNAME_IMP_Processor_ID).append("=?") // # 1
.append(" AND IsActive = ?") // # 2 .append(" AND IsActive = ?") // # 2

View File

@ -290,7 +290,8 @@ public class MImage extends X_AD_Image
*/ */
public String toString() public String toString()
{ {
return "MImage[ID=" + get_ID() + ",Name=" + getName() + "]"; StringBuilder msgreturn = new StringBuilder("MImage[ID=").append(get_ID()).append(",Name=").append(getName()).append("]");
return msgreturn.toString();
} // toString } // toString

View File

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

View File

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

View File

@ -423,8 +423,10 @@ public class MInOutLine extends X_M_InOutLine
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -628,7 +630,7 @@ public class MInOutLine extends X_M_InOutLine
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInOutLine[").append (get_ID()) StringBuilder sb = new StringBuilder ("MInOutLine[").append (get_ID())
.append(",M_Product_ID=").append(getM_Product_ID()) .append(",M_Product_ID=").append(getM_Product_ID())
.append(",QtyEntered=").append(getQtyEntered()) .append(",QtyEntered=").append(getQtyEntered())
.append(",MovementQty=").append(getMovementQty()) .append(",MovementQty=").append(getMovementQty())

View File

@ -62,10 +62,10 @@ public class MInOutLineMA extends X_M_InOutLineMA
*/ */
public static int deleteInOutMA (int M_InOut_ID, String trxName) public static int deleteInOutMA (int M_InOut_ID, String trxName)
{ {
String sql = "DELETE FROM M_InOutLineMA ma WHERE EXISTS " StringBuilder sql = new StringBuilder("DELETE FROM M_InOutLineMA ma WHERE EXISTS ")
+ "(SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=ma.M_InOutLine_ID" .append("(SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=ma.M_InOutLine_ID")
+ " AND M_InOut_ID=" + M_InOut_ID + ")"; .append(" AND M_InOut_ID=").append(M_InOut_ID).append(")");
return DB.executeUpdate(sql, trxName); return DB.executeUpdate(sql.toString(), trxName);
} // deleteInOutMA } // deleteInOutMA
/** /**
@ -130,7 +130,7 @@ public class MInOutLineMA extends X_M_InOutLineMA
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInOutLineMA["); StringBuilder sb = new StringBuilder ("MInOutLineMA[");
sb.append("M_InOutLine_ID=").append(getM_InOutLine_ID()) sb.append("M_InOutLine_ID=").append(getM_InOutLine_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID()) .append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
.append(", Qty=").append(getMovementQty()) .append(", Qty=").append(getMovementQty())

View File

@ -72,10 +72,10 @@ public class MIndex extends X_K_Index
*/ */
public static int cleanUp (String trxName, int AD_Client_ID, int AD_Table_ID, int Record_ID) public static int cleanUp (String trxName, int AD_Client_ID, int AD_Table_ID, int Record_ID)
{ {
StringBuffer sb = new StringBuffer ("DELETE FROM K_Index " StringBuilder sb = new StringBuilder ("DELETE FROM K_Index ")
+ "WHERE AD_Client_ID=" + AD_Client_ID + " AND " .append("WHERE AD_Client_ID=").append(AD_Client_ID).append( " AND ")
+ "AD_Table_ID=" + AD_Table_ID + " AND " .append("AD_Table_ID=").append(AD_Table_ID).append( " AND ")
+ "Record_ID=" + Record_ID); .append("Record_ID=").append(Record_ID);
int no = DB.executeUpdate(sb.toString(), trxName); int no = DB.executeUpdate(sb.toString(), trxName);
return no; return no;
} }
@ -214,20 +214,20 @@ public class MIndex extends X_K_Index
public static void reIndex(boolean runCleanUp, String[] toBeIndexed, Properties ctx, public static void reIndex(boolean runCleanUp, String[] toBeIndexed, Properties ctx,
int AD_Client_ID, int AD_Table_ID, int Record_ID, int CM_WebProject_ID, Timestamp lastUpdated) int AD_Client_ID, int AD_Table_ID, int Record_ID, int CM_WebProject_ID, Timestamp lastUpdated)
{ {
String trxName = "ReIndex_" + AD_Table_ID + "_" + Record_ID; StringBuilder trxName = new StringBuilder("ReIndex_").append(AD_Table_ID).append("_").append(Record_ID);
try { try {
if (!runCleanUp) if (!runCleanUp)
{ {
MIndex.cleanUp(trxName, AD_Client_ID, AD_Table_ID, Record_ID); MIndex.cleanUp(trxName.toString(), AD_Client_ID, AD_Table_ID, Record_ID);
} }
for (int i=0;i<toBeIndexed.length;i++) { for (int i=0;i<toBeIndexed.length;i++) {
MIndex.runIndex(toBeIndexed[i], ctx, trxName, AD_Table_ID, Record_ID, MIndex.runIndex(toBeIndexed[i], ctx, trxName.toString(), AD_Table_ID, Record_ID,
CM_WebProject_ID, lastUpdated); CM_WebProject_ID, lastUpdated);
} }
DB.commit (true, trxName); DB.commit (true, trxName.toString());
} catch (SQLException sqlE) { } catch (SQLException sqlE) {
try { try {
DB.rollback (true, trxName); DB.rollback (true, trxName.toString());
} catch (SQLException sqlE2) { } catch (SQLException sqlE2) {
} }
} }
@ -260,7 +260,7 @@ public class MIndex extends X_K_Index
return null; return null;
// //
keyword = keyword.toUpperCase(); // default locale keyword = keyword.toUpperCase(); // default locale
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
char[] chars = keyword.toCharArray(); char[] chars = keyword.toCharArray();
for (int i = 0; i < chars.length; i++) for (int i = 0; i < chars.length; i++)
{ {

View File

@ -159,7 +159,7 @@ public class MInterestArea extends X_R_InterestArea
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInterestArea[") StringBuilder sb = new StringBuilder ("MInterestArea[")
.append (get_ID()).append(" - ").append(getName()) .append (get_ID()).append(" - ").append(getName())
.append ("]"); .append ("]");
return sb.toString (); return sb.toString ();

View File

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

View File

@ -206,8 +206,10 @@ public class MInventoryLine extends X_M_InventoryLine
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -236,7 +238,7 @@ public class MInventoryLine extends X_M_InventoryLine
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInventoryLine["); StringBuilder sb = new StringBuilder ("MInventoryLine[");
sb.append (get_ID()) sb.append (get_ID())
.append("-M_Product_ID=").append (getM_Product_ID()) .append("-M_Product_ID=").append (getM_Product_ID())
.append(",QtyCount=").append(getQtyCount()) .append(",QtyCount=").append(getQtyCount())

View File

@ -85,10 +85,10 @@ public class MInventoryLineMA extends X_M_InventoryLineMA
*/ */
public static int deleteInventoryMA (int M_Inventory_ID, String trxName) public static int deleteInventoryMA (int M_Inventory_ID, String trxName)
{ {
String sql = "DELETE FROM M_InventoryLineMA ma WHERE EXISTS " StringBuilder sql = new StringBuilder("DELETE FROM M_InventoryLineMA ma WHERE EXISTS ")
+ "(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID" .append("(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID")
+ " AND M_Inventory_ID=" + M_Inventory_ID + ")"; .append(" AND M_Inventory_ID=").append(M_Inventory_ID).append(")");
return DB.executeUpdate(sql, trxName); return DB.executeUpdate(sql.toString(), trxName);
} // deleteInventoryMA } // deleteInventoryMA
/** /**
@ -99,10 +99,10 @@ public class MInventoryLineMA extends X_M_InventoryLineMA
*/ */
public static int deleteInventoryLineMA (int M_InventoryLine_ID, String trxName) public static int deleteInventoryLineMA (int M_InventoryLine_ID, String trxName)
{ {
String sql = "DELETE FROM M_InventoryLineMA ma WHERE EXISTS " StringBuilder sql = new StringBuilder("DELETE FROM M_InventoryLineMA ma WHERE EXISTS ")
+ "(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID" .append("(SELECT * FROM M_InventoryLine l WHERE l.M_InventoryLine_ID=ma.M_InventoryLine_ID")
+ " AND M_InventoryLine_ID=" + M_InventoryLine_ID + ")"; .append(" AND M_InventoryLine_ID=").append(M_InventoryLine_ID).append(")");
return DB.executeUpdate(sql, trxName); return DB.executeUpdate(sql.toString(), trxName);
} // deleteInventoryMA } // deleteInventoryMA
/** Logger */ /** Logger */
@ -155,7 +155,7 @@ public class MInventoryLineMA extends X_M_InventoryLineMA
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInventoryLineMA["); StringBuilder sb = new StringBuilder ("MInventoryLineMA[");
sb.append("M_InventoryLine_ID=").append(getM_InventoryLine_ID()) sb.append("M_InventoryLine_ID=").append(getM_InventoryLine_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID()) .append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())
.append(", Qty=").append(getMovementQty()) .append(", Qty=").append(getMovementQty())

View File

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

View File

@ -136,9 +136,9 @@ public class MInvoiceBatch extends X_C_InvoiceBatch
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
String set = "SET Processed='" StringBuilder set = new StringBuilder("SET Processed='")
+ (processed ? "Y" : "N") .append((processed ? "Y" : "N"))
+ "' WHERE C_InvoiceBatch_ID=" + getC_InvoiceBatch_ID(); .append("' WHERE C_InvoiceBatch_ID=").append(getC_InvoiceBatch_ID());
int noLine = DB.executeUpdate("UPDATE C_InvoiceBatchLine " + set, get_TrxName()); int noLine = DB.executeUpdate("UPDATE C_InvoiceBatchLine " + set, get_TrxName());
m_lines = null; m_lines = null;
log.fine(processed + " - Lines=" + noLine); log.fine(processed + " - Lines=" + noLine);

View File

@ -111,11 +111,11 @@ public class MInvoiceBatchLine extends X_C_InvoiceBatchLine
{ {
if (success) if (success)
{ {
String sql = "UPDATE C_InvoiceBatch h " StringBuilder sql = new StringBuilder("UPDATE C_InvoiceBatch h ")
+ "SET DocumentAmt = NVL((SELECT SUM(LineTotalAmt) FROM C_InvoiceBatchLine l " .append("SET DocumentAmt = NVL((SELECT SUM(LineTotalAmt) FROM C_InvoiceBatchLine l ")
+ "WHERE h.C_InvoiceBatch_ID=l.C_InvoiceBatch_ID AND l.IsActive='Y'),0) " .append("WHERE h.C_InvoiceBatch_ID=l.C_InvoiceBatch_ID AND l.IsActive='Y'),0) ")
+ "WHERE C_InvoiceBatch_ID=" + getC_InvoiceBatch_ID(); .append("WHERE C_InvoiceBatch_ID=").append(getC_InvoiceBatch_ID());
DB.executeUpdate(sql, get_TrxName()); DB.executeUpdate(sql.toString(), get_TrxName());
} }
return success; return success;
} // afterSave } // afterSave

View File

@ -308,8 +308,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -702,7 +704,7 @@ public class MInvoiceLine extends X_C_InvoiceLine
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInvoiceLine[") StringBuilder sb = new StringBuilder ("MInvoiceLine[")
.append(get_ID()).append(",").append(getLine()) .append(get_ID()).append(",").append(getLine())
.append(",QtyInvoiced=").append(getQtyInvoiced()) .append(",QtyInvoiced=").append(getQtyInvoiced())
.append(",LineNetAmt=").append(getLineNetAmt()) .append(",LineNetAmt=").append(getLineNetAmt())
@ -1005,13 +1007,14 @@ public class MInvoiceLine extends X_C_InvoiceLine
MLandedCost[] lcs = MLandedCost.getLandedCosts(this); MLandedCost[] lcs = MLandedCost.getLandedCosts(this);
if (lcs.length == 0) if (lcs.length == 0)
return ""; return "";
String sql = "DELETE C_LandedCostAllocation WHERE C_InvoiceLine_ID=" + getC_InvoiceLine_ID(); StringBuilder sql = new StringBuilder("DELETE C_LandedCostAllocation WHERE C_InvoiceLine_ID=").append(getC_InvoiceLine_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0) if (no != 0)
log.info("Deleted #" + no); log.info("Deleted #" + no);
int inserted = 0; int inserted = 0;
// *** Single Criteria *** // *** Single Criteria ***
StringBuilder msgreturn;
if (lcs.length == 1) if (lcs.length == 1)
{ {
MLandedCost lc = lcs[0]; MLandedCost lc = lcs[0];
@ -1038,8 +1041,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
MInOutLine iol = (MInOutLine)list.get(i); MInOutLine iol = (MInOutLine)list.get(i);
total = total.add(iol.getBase(lc.getLandedCostDistribution())); total = total.add(iol.getBase(lc.getLandedCostDistribution()));
} }
if (total.signum() == 0) if (total.signum() == 0){
return "Total of Base values is 0 - " + lc.getLandedCostDistribution(); msgreturn = new StringBuilder("Total of Base values is 0 - ").append(lc.getLandedCostDistribution());
return msgreturn.toString();
}
// Create Allocations // Create Allocations
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {
@ -1059,8 +1064,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
result /= total.doubleValue(); result /= total.doubleValue();
lca.setAmt(result, getPrecision()); lca.setAmt(result, getPrecision());
} }
if (!lca.save()) if (!lca.save()){
return "Cannot save line Allocation = " + lca; msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);
return msgreturn.toString();
}
inserted++; inserted++;
} }
log.info("Inserted " + inserted); log.info("Inserted " + inserted);
@ -1071,8 +1078,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
else if (lc.getM_InOutLine_ID() != 0) else if (lc.getM_InOutLine_ID() != 0)
{ {
MInOutLine iol = new MInOutLine (getCtx(), lc.getM_InOutLine_ID(), get_TrxName()); MInOutLine iol = new MInOutLine (getCtx(), lc.getM_InOutLine_ID(), get_TrxName());
if (iol.isDescription() || iol.getM_Product_ID() == 0) if (iol.isDescription() || iol.getM_Product_ID() == 0){
return "Invalid Receipt Line - " + iol; msgreturn = new StringBuilder("Invalid Receipt Line - ").append(iol);
return msgreturn.toString();
}
MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID()); MLandedCostAllocation lca = new MLandedCostAllocation (this, lc.getM_CostElement_ID());
lca.setM_Product_ID(iol.getM_Product_ID()); lca.setM_Product_ID(iol.getM_Product_ID());
lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID()); lca.setM_AttributeSetInstance_ID(iol.getM_AttributeSetInstance_ID());
@ -1085,7 +1094,8 @@ public class MInvoiceLine extends X_C_InvoiceLine
// end MZ // end MZ
if (lca.save()) if (lca.save())
return ""; return "";
return "Cannot save single line Allocation = " + lc; msgreturn = new StringBuilder("Cannot save single line Allocation = ").append(lc);
return msgreturn.toString();
} }
// Single Product // Single Product
else if (lc.getM_Product_ID() != 0) else if (lc.getM_Product_ID() != 0)
@ -1095,10 +1105,13 @@ public class MInvoiceLine extends X_C_InvoiceLine
lca.setAmt(getLineNetAmt()); lca.setAmt(getLineNetAmt());
if (lca.save()) if (lca.save())
return ""; return "";
return "Cannot save Product Allocation = " + lc; msgreturn = new StringBuilder("Cannot save Product Allocation = ").append(lc);
return msgreturn.toString();
} }
else else{
return "No Reference for " + lc; msgreturn = new StringBuilder("No Reference for ").append(lc);
return msgreturn.toString();
}
} }
// *** Multiple Criteria *** // *** Multiple Criteria ***
@ -1149,8 +1162,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
MInOutLine iol = (MInOutLine)list.get(i); MInOutLine iol = (MInOutLine)list.get(i);
total = total.add(iol.getBase(LandedCostDistribution)); total = total.add(iol.getBase(LandedCostDistribution));
} }
if (total.signum() == 0) if (total.signum() == 0){
return "Total of Base values is 0 - " + LandedCostDistribution; msgreturn = new StringBuilder("Total of Base values is 0 - ").append(LandedCostDistribution);
return msgreturn.toString();
}
// Create Allocations // Create Allocations
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {
@ -1170,8 +1185,10 @@ public class MInvoiceLine extends X_C_InvoiceLine
result /= total.doubleValue(); result /= total.doubleValue();
lca.setAmt(result, getPrecision()); lca.setAmt(result, getPrecision());
} }
if (!lca.save()) if (!lca.save()){
return "Cannot save line Allocation = " + lca; msgreturn = new StringBuilder("Cannot save line Allocation = ").append(lca);
return msgreturn.toString();
}
inserted++; inserted++;
} }

View File

@ -53,19 +53,19 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
public static MInvoicePaySchedule[] getInvoicePaySchedule(Properties ctx, public static MInvoicePaySchedule[] getInvoicePaySchedule(Properties ctx,
int C_Invoice_ID, int C_InvoicePaySchedule_ID, String trxName) int C_Invoice_ID, int C_InvoicePaySchedule_ID, String trxName)
{ {
String sql = "SELECT * FROM C_InvoicePaySchedule ips WHERE IsActive='Y' "; StringBuilder sql = new StringBuilder("SELECT * FROM C_InvoicePaySchedule ips WHERE IsActive='Y' ");
if (C_Invoice_ID != 0) if (C_Invoice_ID != 0)
sql += "AND C_Invoice_ID=? "; sql.append("AND C_Invoice_ID=? ");
else else
sql += "AND EXISTS (SELECT * FROM C_InvoicePaySchedule x" sql.append("AND EXISTS (SELECT * FROM C_InvoicePaySchedule x")
+ " WHERE x.C_InvoicePaySchedule_ID=? AND ips.C_Invoice_ID=x.C_Invoice_ID) "; .append(" WHERE x.C_InvoicePaySchedule_ID=? AND ips.C_Invoice_ID=x.C_Invoice_ID) ");
sql += "ORDER BY DueDate"; sql.append("ORDER BY DueDate");
// //
ArrayList<MInvoicePaySchedule> list = new ArrayList<MInvoicePaySchedule>(); ArrayList<MInvoicePaySchedule> list = new ArrayList<MInvoicePaySchedule>();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement(sql, trxName); pstmt = DB.prepareStatement(sql.toString(), trxName);
if (C_Invoice_ID != 0) if (C_Invoice_ID != 0)
pstmt.setInt(1, C_Invoice_ID); pstmt.setInt(1, C_Invoice_ID);
else else
@ -205,9 +205,9 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("MInvoicePaySchedule["); StringBuilder sb = new StringBuilder("MInvoicePaySchedule[");
sb.append(get_ID()).append("-Due=" + getDueDate() + "/" + getDueAmt()) sb.append(get_ID()).append("-Due=").append(getDueDate()).append("/").append(getDueAmt())
.append(";Discount=").append(getDiscountDate() + "/" + getDiscountAmt()) .append(";Discount=").append(getDiscountDate()).append("/").append(getDiscountAmt())
.append("]"); .append("]");
return sb.toString(); return sb.toString();
} // toString } // toString

View File

@ -248,7 +248,7 @@ public class MInvoiceTax extends X_C_InvoiceTax
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInvoiceTax["); StringBuilder sb = new StringBuilder ("MInvoiceTax[");
sb.append("C_Invoice_ID=").append(getC_Invoice_ID()) sb.append("C_Invoice_ID=").append(getC_Invoice_ID())
.append(",C_Tax_ID=").append(getC_Tax_ID()) .append(",C_Tax_ID=").append(getC_Tax_ID())
.append(", Base=").append(getTaxBaseAmt()).append(",Tax=").append(getTaxAmt()) .append(", Base=").append(getTaxBaseAmt()).append(",Tax=").append(getTaxAmt())

View File

@ -155,7 +155,7 @@ public class MIssue extends X_AD_Issue
public MIssue (LogRecord record) public MIssue (LogRecord record)
{ {
this (Env.getCtx(), 0, null); this (Env.getCtx(), 0, null);
String summary = record.getMessage(); StringBuilder summary = new StringBuilder(record.getMessage());
setSourceClassName(record.getSourceClassName()); setSourceClassName(record.getSourceClassName());
setSourceMethodName(record.getSourceMethodName()); setSourceMethodName(record.getSourceMethodName());
setLoggerName(record.getLoggerName()); setLoggerName(record.getLoggerName());
@ -163,11 +163,11 @@ public class MIssue extends X_AD_Issue
if (t != null) if (t != null)
{ {
if (summary != null && summary.length() > 0) if (summary != null && summary.length() > 0)
summary = t.toString() + " " + summary; summary = new StringBuilder(t.toString()).append(" ").append(summary);
if (summary == null || summary.length() == 0) if (summary == null || summary.length() == 0)
summary = t.toString(); summary = new StringBuilder(t.toString());
// //
StringBuffer error = new StringBuffer(); StringBuilder error = new StringBuilder();
StackTraceElement[] tes = t.getStackTrace(); StackTraceElement[] tes = t.getStackTrace();
int count = 0; int count = 0;
for (int i = 0; i < tes.length; i++) for (int i = 0; i < tes.length; i++)
@ -179,9 +179,9 @@ public class MIssue extends X_AD_Issue
error.append(s).append("\n"); error.append(s).append("\n");
if (count == 0) if (count == 0)
{ {
String source = element.getClassName() StringBuilder source = new StringBuilder(element.getClassName())
+ "." + element.getMethodName(); .append(".").append(element.getMethodName());
setSourceClassName(source); setSourceClassName(source.toString());
setLineNo(element.getLineNumber()); setLineNo(element.getLineNumber());
} }
count++; count++;
@ -197,8 +197,8 @@ public class MIssue extends X_AD_Issue
setStackTrace(cWriter.toString()); setStackTrace(cWriter.toString());
} }
if (summary == null || summary.length() == 0) if (summary == null || summary.length() == 0)
summary = "??"; summary = new StringBuilder("??");
setIssueSummary(summary); setIssueSummary(summary.toString());
setRecord_ID(1); setRecord_ID(1);
} // MIssue } // MIssue
@ -304,8 +304,10 @@ public class MIssue extends X_AD_Issue
if (old == null || old.length() == 0) if (old == null || old.length() == 0)
setComments (Comments); setComments (Comments);
else if (!old.equals(Comments) else if (!old.equals(Comments)
&& old.indexOf(Comments) == -1) // something new && old.indexOf(Comments) == -1){ // something new
setComments (Comments + " | " + old); StringBuilder msgc = new StringBuilder(Comments).append(" | ").append(old);
setComments (msgc.toString());
}
} // addComments } // addComments
/** /**
@ -357,7 +359,7 @@ public class MIssue extends X_AD_Issue
*/ */
public String createAnswer() public String createAnswer()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
if (getA_Asset_ID() != 0) if (getA_Asset_ID() != 0)
sb.append("Sign up for support at http://www.adempiere.org to receive answers."); sb.append("Sign up for support at http://www.adempiere.org to receive answers.");
else else
@ -416,7 +418,7 @@ public class MIssue extends X_AD_Issue
{ {
if (true) if (true)
return "-"; return "-";
StringBuffer parameter = new StringBuffer("?"); StringBuilder parameter = new StringBuilder("?");
if (getRecord_ID() == 0) // don't report if (getRecord_ID() == 0) // don't report
return "ID=0"; return "ID=0";
if (getRecord_ID() == 1) // new if (getRecord_ID() == 1) // new
@ -435,7 +437,8 @@ public class MIssue extends X_AD_Issue
catch (Exception e) catch (Exception e)
{ {
log.severe(e.getLocalizedMessage()); log.severe(e.getLocalizedMessage());
return "New-" + e.getLocalizedMessage(); StringBuilder msgreturn = new StringBuilder("New-").append(e.getLocalizedMessage());
return msgreturn.toString();
} }
} }
else // existing else // existing
@ -449,7 +452,8 @@ public class MIssue extends X_AD_Issue
catch (Exception e) catch (Exception e)
{ {
log.severe(e.getLocalizedMessage()); log.severe(e.getLocalizedMessage());
return "Update-" + e.getLocalizedMessage(); StringBuilder msgreturn = new StringBuilder("Update-").append(e.getLocalizedMessage());
return msgreturn.toString();
} }
} }
@ -457,7 +461,7 @@ public class MIssue extends X_AD_Issue
String target = "http://dev1/wstore/issueReportServlet"; String target = "http://dev1/wstore/issueReportServlet";
try // Send GET Request try // Send GET Request
{ {
StringBuffer urlString = new StringBuffer(target) StringBuilder urlString = new StringBuilder(target)
.append(parameter); .append(parameter);
URL url = new URL (urlString.toString()); URL url = new URL (urlString.toString());
URLConnection uc = url.openConnection(); URLConnection uc = url.openConnection();
@ -465,15 +469,15 @@ public class MIssue extends X_AD_Issue
} }
catch (Exception e) catch (Exception e)
{ {
String msg = "Cannot connect to http://" + target; StringBuilder msg = new StringBuilder("Cannot connect to http://").append(target);
if (e instanceof FileNotFoundException || e instanceof ConnectException) if (e instanceof FileNotFoundException || e instanceof ConnectException)
msg += "\nServer temporarily down - Please try again later"; msg.append("\nServer temporarily down - Please try again later");
else else
{ {
msg += "\nCheck connection - " + e.getLocalizedMessage(); msg.append("\nCheck connection - ").append(e.getLocalizedMessage());
log.log(Level.FINE, msg); log.log(Level.FINE, msg.toString());
} }
return msg; return msg.toString();
} }
return readResponse(in); return readResponse(in);
} // report } // report
@ -485,7 +489,7 @@ public class MIssue extends X_AD_Issue
*/ */
private String readResponse(InputStreamReader in) private String readResponse(InputStreamReader in)
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
int Record_ID = 0; int Record_ID = 0;
String ResponseText = null; String ResponseText = null;
String RequestDocumentNo = null; String RequestDocumentNo = null;
@ -543,7 +547,7 @@ public class MIssue extends X_AD_Issue
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MIssue["); StringBuilder sb = new StringBuilder ("MIssue[");
sb.append (get_ID()) sb.append (get_ID())
.append ("-").append (getIssueSummary()) .append ("-").append (getIssueSummary())
.append (",Record=").append (getRecord_ID()) .append (",Record=").append (getRecord_ID())

Some files were not shown because too many files have changed in this diff Show More