IDEMPIERE-308 Performance: Replace with StringBuilder / Thanks to Richard Morales and David Peñuela
This commit is contained in:
parent
2defc00efb
commit
a210231735
|
@ -113,71 +113,71 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
|
||||
// psel.getPayDate();
|
||||
|
||||
String sql = "SELECT C_Invoice_ID,"
|
||||
StringBuilder sql = new StringBuilder("SELECT C_Invoice_ID,")
|
||||
// Open
|
||||
+ " currencyConvert(invoiceOpen(i.C_Invoice_ID, 0)"
|
||||
+ ",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)," // ##1/2 Currency_To,PayDate
|
||||
.append(" currencyConvert(invoiceOpen(i.C_Invoice_ID, 0)")
|
||||
.append(",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##1/2 Currency_To,PayDate
|
||||
// Discount
|
||||
+ " currencyConvert(paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)" // ##3 PayDate
|
||||
+ ",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)," // ##4/5 Currency_To,PayDate
|
||||
+ " PaymentRule, IsSOTrx " // 4..6
|
||||
+ "FROM C_Invoice i "
|
||||
+ "WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')"
|
||||
+ " AND AD_Client_ID=?" // ##6
|
||||
.append(" currencyConvert(paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)") // ##3 PayDate
|
||||
.append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##4/5 Currency_To,PayDate
|
||||
.append(" PaymentRule, IsSOTrx ") // 4..6
|
||||
.append("FROM C_Invoice i ")
|
||||
.append("WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')")
|
||||
.append(" AND AD_Client_ID=?") // ##6
|
||||
// Existing Payments - Will reselect Invoice if prepared but not paid
|
||||
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl"
|
||||
+ " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)"
|
||||
+ " LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)"
|
||||
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'"
|
||||
+ " AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )";
|
||||
.append(" AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl")
|
||||
.append(" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)")
|
||||
.append(" LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)")
|
||||
.append(" WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'")
|
||||
.append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )");
|
||||
// Disputed
|
||||
if (!p_IncludeInDispute)
|
||||
sql += " AND i.IsInDispute='N'";
|
||||
sql.append(" AND i.IsInDispute='N'");
|
||||
// PaymentRule (optional)
|
||||
if (p_PaymentRule != null)
|
||||
sql += " AND PaymentRule=?"; // ##
|
||||
sql.append(" AND PaymentRule=?"); // ##
|
||||
// OnlyDiscount
|
||||
if (p_OnlyDiscount)
|
||||
{
|
||||
if (p_OnlyDue)
|
||||
sql += " AND (";
|
||||
sql.append(" AND (");
|
||||
else
|
||||
sql += " AND ";
|
||||
sql += "paymentTermDiscount(invoiceOpen(C_Invoice_ID, 0), C_Currency_ID, C_PaymentTerm_ID, DateInvoiced, ?) > 0"; // ##
|
||||
sql.append(" AND ");
|
||||
sql.append("paymentTermDiscount(invoiceOpen(C_Invoice_ID, 0), C_Currency_ID, C_PaymentTerm_ID, DateInvoiced, ?) > 0"); // ##
|
||||
}
|
||||
// OnlyDue
|
||||
if (p_OnlyDue)
|
||||
{
|
||||
if (p_OnlyDiscount)
|
||||
sql += " OR ";
|
||||
sql.append(" OR ");
|
||||
else
|
||||
sql += " AND ";
|
||||
sql += "paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"; // ##
|
||||
sql.append(" AND ");
|
||||
sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ##
|
||||
if (p_OnlyDiscount)
|
||||
sql += ")";
|
||||
sql.append(")");
|
||||
}
|
||||
// Business Partner
|
||||
if (p_C_BPartner_ID != 0)
|
||||
sql += " AND C_BPartner_ID=?"; // ##
|
||||
sql.append(" AND C_BPartner_ID=?"); // ##
|
||||
// Business Partner Group
|
||||
else if (p_C_BP_Group_ID != 0)
|
||||
sql += " AND EXISTS (SELECT * FROM C_BPartner bp "
|
||||
+ "WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ##
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
|
||||
.append("WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); // ##
|
||||
// PO Matching Requirement
|
||||
if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B"))
|
||||
{
|
||||
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il "
|
||||
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
|
||||
+ " AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m "
|
||||
+ "WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))";
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
|
||||
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
|
||||
.append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m ")
|
||||
.append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
|
||||
}
|
||||
// Receipt Matching Requirement
|
||||
if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B"))
|
||||
{
|
||||
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il "
|
||||
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
|
||||
+ " AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m "
|
||||
+ "WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))";
|
||||
sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
|
||||
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
|
||||
.append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m ")
|
||||
.append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -186,7 +186,7 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
int index = 1;
|
||||
pstmt.setInt (index++, C_CurrencyTo_ID);
|
||||
pstmt.setTimestamp(index++, psel.getPayDate());
|
||||
|
@ -234,7 +234,7 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -246,8 +246,8 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
{
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return "@C_PaySelectionLine_ID@ - #" + lines;
|
||||
StringBuilder msgreturn = new StringBuilder("@C_PaySelectionLine_ID@ - #").append(lines);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // PaySelectionCreateFrom
|
||||
|
|
|
@ -69,7 +69,7 @@ public class PeriodStatus extends SvrProcess
|
|||
if (period.get_ID() == 0)
|
||||
throw new AdempiereUserError("@NotFound@ @C_Period_ID@=" + p_C_Period_ID);
|
||||
|
||||
StringBuffer sql = new StringBuffer ("UPDATE C_PeriodControl ");
|
||||
StringBuilder sql = new StringBuilder ("UPDATE C_PeriodControl ");
|
||||
sql.append("SET PeriodStatus='");
|
||||
// Open
|
||||
if (MPeriodControl.PERIODACTION_OpenPeriod.equals(p_PeriodAction))
|
||||
|
@ -93,7 +93,8 @@ public class PeriodStatus extends SvrProcess
|
|||
|
||||
CacheMgt.get().reset("C_PeriodControl", 0);
|
||||
CacheMgt.get().reset("C_Period", p_C_Period_ID);
|
||||
return "@Updated@ #" + no;
|
||||
StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // PeriodStatus
|
||||
|
|
|
@ -72,55 +72,56 @@ public class ProductCategoryAcctCopy extends SvrProcess
|
|||
throw new AdempiereSystemError("Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID);
|
||||
|
||||
// Update
|
||||
String sql = "UPDATE M_Product_Acct pa "
|
||||
+ "SET (P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,"
|
||||
+ " P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,"
|
||||
+ " P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,"
|
||||
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,"
|
||||
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct)="
|
||||
+ " (SELECT P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,"
|
||||
+ " P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,"
|
||||
+ " P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,"
|
||||
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,"
|
||||
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct"
|
||||
+ " FROM M_Product_Category_Acct pca"
|
||||
+ " WHERE pca.M_Product_Category_ID=" + p_M_Product_Category_ID
|
||||
+ " AND pca.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ "), Updated=SysDate, UpdatedBy=0 "
|
||||
+ "WHERE pa.C_AcctSchema_ID=" + p_C_AcctSchema_ID
|
||||
+ " AND EXISTS (SELECT * FROM M_Product p "
|
||||
+ "WHERE p.M_Product_ID=pa.M_Product_ID"
|
||||
+ " AND p.M_Product_Category_ID=" + p_M_Product_Category_ID + ")";
|
||||
int updated = DB.executeUpdate(sql, get_TrxName());
|
||||
StringBuilder sql = new StringBuilder("UPDATE M_Product_Acct pa ")
|
||||
.append("SET (P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,")
|
||||
.append(" P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,")
|
||||
.append(" P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,")
|
||||
.append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
|
||||
.append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct)=")
|
||||
.append(" (SELECT P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,")
|
||||
.append(" P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,")
|
||||
.append(" P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,")
|
||||
.append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
|
||||
.append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct")
|
||||
.append(" FROM M_Product_Category_Acct pca")
|
||||
.append(" WHERE pca.M_Product_Category_ID=").append(p_M_Product_Category_ID)
|
||||
.append(" AND pca.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append("), Updated=SysDate, UpdatedBy=0 ")
|
||||
.append("WHERE pa.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
|
||||
.append(" AND EXISTS (SELECT * FROM M_Product p ")
|
||||
.append("WHERE p.M_Product_ID=pa.M_Product_ID")
|
||||
.append(" AND p.M_Product_Category_ID=").append(p_M_Product_Category_ID).append(")");
|
||||
int updated = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(updated), "@Updated@");
|
||||
|
||||
// Insert new Products
|
||||
sql = "INSERT INTO M_Product_Acct "
|
||||
+ "(M_Product_ID, C_AcctSchema_ID,"
|
||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,"
|
||||
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,"
|
||||
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,"
|
||||
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, "
|
||||
+ " P_WIP_Acct,P_FloorStock_Acct, P_MethodChangeVariance_Acct, P_UsageVariance_Acct, P_RateVariance_Acct,"
|
||||
+ " P_MixVariance_Acct, P_Labor_Acct, P_Burden_Acct, P_CostOfProduction_Acct, P_OutsideProcessing_Acct, P_Overhead_Acct, P_Scrap_Acct) "
|
||||
+ "SELECT p.M_Product_ID, acct.C_AcctSchema_ID,"
|
||||
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,"
|
||||
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,"
|
||||
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,"
|
||||
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct, "
|
||||
+ " acct.P_WIP_Acct, acct.P_FloorStock_Acct, acct.P_MethodChangeVariance_Acct, acct.P_UsageVariance_Acct, acct.P_RateVariance_Acct,"
|
||||
+ " acct.P_MixVariance_Acct, acct.P_Labor_Acct, acct.P_Burden_Acct, acct.P_CostOfProduction_Acct, acct.P_OutsideProcessing_Acct, acct.P_Overhead_Acct, acct.P_Scrap_Acct "
|
||||
+ "FROM M_Product p"
|
||||
+ " INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)"
|
||||
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // #
|
||||
+ " AND p.M_Product_Category_ID=" + p_M_Product_Category_ID // #
|
||||
+ " AND NOT EXISTS (SELECT * FROM M_Product_Acct pa "
|
||||
+ "WHERE pa.M_Product_ID=p.M_Product_ID"
|
||||
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)";
|
||||
int created = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("INSERT INTO M_Product_Acct ")
|
||||
.append("(M_Product_ID, C_AcctSchema_ID,")
|
||||
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
|
||||
.append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
|
||||
.append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
|
||||
.append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, ")
|
||||
.append(" P_WIP_Acct,P_FloorStock_Acct, P_MethodChangeVariance_Acct, P_UsageVariance_Acct, P_RateVariance_Acct,")
|
||||
.append(" P_MixVariance_Acct, P_Labor_Acct, P_Burden_Acct, P_CostOfProduction_Acct, P_OutsideProcessing_Acct, P_Overhead_Acct, P_Scrap_Acct) ")
|
||||
.append("SELECT p.M_Product_ID, acct.C_AcctSchema_ID,")
|
||||
.append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
|
||||
.append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
|
||||
.append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
|
||||
.append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct, ")
|
||||
.append(" acct.P_WIP_Acct, acct.P_FloorStock_Acct, acct.P_MethodChangeVariance_Acct, acct.P_UsageVariance_Acct, acct.P_RateVariance_Acct,")
|
||||
.append(" acct.P_MixVariance_Acct, acct.P_Labor_Acct, acct.P_Burden_Acct, acct.P_CostOfProduction_Acct, acct.P_OutsideProcessing_Acct, acct.P_Overhead_Acct, acct.P_Scrap_Acct ")
|
||||
.append("FROM M_Product p")
|
||||
.append(" INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)")
|
||||
.append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
|
||||
.append(" AND p.M_Product_Category_ID=").append(p_M_Product_Category_ID) // #
|
||||
.append(" AND NOT EXISTS (SELECT * FROM M_Product_Acct pa ")
|
||||
.append("WHERE pa.M_Product_ID=p.M_Product_ID")
|
||||
.append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
|
||||
int created = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
addLog(0, null, new BigDecimal(created), "@Created@");
|
||||
|
||||
return "@Created@=" + created + ", @Updated@=" + updated;
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@=").append(created).append(", @Updated@=").append(updated);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // ProductCategoryAcctCopy
|
||||
|
|
|
@ -105,7 +105,8 @@ public class ProductionCreate extends SvrProcess {
|
|||
|
||||
m_production.setIsCreated("Y");
|
||||
m_production.save(get_TrxName());
|
||||
return created + " production lines were created";
|
||||
StringBuilder msgreturn = new StringBuilder(created).append(" production lines were created");
|
||||
return msgreturn.toString();
|
||||
}
|
||||
|
||||
protected void isBom(int M_Product_ID) throws Exception
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ProductionProcess extends SvrProcess {
|
|||
int processed = 0;
|
||||
m_production.setMovementDate(p_MovementDate);
|
||||
MProductionLine[] lines = m_production.getLines();
|
||||
StringBuffer errors = new StringBuffer();
|
||||
StringBuilder errors = new StringBuilder();
|
||||
for ( int i = 0; i<lines.length; i++) {
|
||||
errors.append( lines[i].createTransactions(m_production.getMovementDate(), mustBeStocked) );
|
||||
//TODO error handling
|
||||
|
@ -84,7 +84,8 @@ public class ProductionProcess extends SvrProcess {
|
|||
m_production.setProcessed(true);
|
||||
|
||||
m_production.saveEx(get_TrxName());
|
||||
return processed + " production lines were processed";
|
||||
StringBuilder msgreturn = new StringBuilder(processed).append(" production lines were processed");
|
||||
return msgreturn.toString();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -105,7 +105,8 @@ public class ProjectGenOrder extends SvrProcess
|
|||
log.log(Level.SEVERE, "Lines difference - ProjectLines=" + lines.length + " <> Saved=" + count);
|
||||
} // Order Lines
|
||||
|
||||
return "@C_Order_ID@ " + order.getDocumentNo() + " (" + count + ")";
|
||||
StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (").append(count).append(")");
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
|
|
|
@ -196,8 +196,8 @@ public class ProjectIssue extends SvrProcess
|
|||
addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null);
|
||||
counter++;
|
||||
} // all InOutLines
|
||||
|
||||
return "@Created@ " + counter;
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@ ").append(counter);
|
||||
return msgreturn.toString();
|
||||
} // issueReceipt
|
||||
|
||||
|
||||
|
@ -258,8 +258,9 @@ public class ProjectIssue extends SvrProcess
|
|||
addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null);
|
||||
counter++;
|
||||
} // allExpenseLines
|
||||
|
||||
return "@Created@ " + counter;
|
||||
|
||||
StringBuilder msgreturn = new StringBuilder("@Created@ ").append(counter);
|
||||
return msgreturn.toString();
|
||||
} // issueExpense
|
||||
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ public class ProjectLinePricing extends SvrProcess
|
|||
projectLine.setPlannedMarginAmt(pp.getPriceStd().subtract(pp.getPriceLimit()));
|
||||
projectLine.saveEx();
|
||||
//
|
||||
String retValue = Msg.getElement(getCtx(), "PriceList") + pp.getPriceList() + " - "
|
||||
+ Msg.getElement(getCtx(), "PriceStd") + pp.getPriceStd() + " - "
|
||||
+ Msg.getElement(getCtx(), "PriceLimit") + pp.getPriceLimit();
|
||||
return retValue;
|
||||
StringBuilder retValue = new StringBuilder(Msg.getElement(getCtx(), "PriceList")).append(pp.getPriceList()).append(" - ")
|
||||
.append(Msg.getElement(getCtx(), "PriceStd")).append(pp.getPriceStd()).append(" - ")
|
||||
.append(Msg.getElement(getCtx(), "PriceLimit")).append(pp.getPriceLimit());
|
||||
return retValue.toString();
|
||||
} // doIt
|
||||
|
||||
} // ProjectLinePricing
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
|
|||
{
|
||||
MOrderLine ol = new MOrderLine(order);
|
||||
ol.setLine(fromPhase.getSeqNo());
|
||||
StringBuffer sb = new StringBuffer (fromPhase.getName());
|
||||
StringBuilder sb = new StringBuilder (fromPhase.getName());
|
||||
if (fromPhase.getDescription() != null && fromPhase.getDescription().length() > 0)
|
||||
sb.append(" - ").append(fromPhase.getDescription());
|
||||
ol.setDescription(sb.toString());
|
||||
|
@ -90,7 +90,8 @@ public class ProjectPhaseGenOrder extends SvrProcess
|
|||
ol.setTax();
|
||||
if (!ol.save())
|
||||
log.log(Level.SEVERE, "doIt - Lines not generated");
|
||||
return "@C_Order_ID@ " + order.getDocumentNo() + " (1)";
|
||||
StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (1)");
|
||||
return msgreturn.toString();
|
||||
}
|
||||
|
||||
// Project Phase Lines
|
||||
|
@ -121,7 +122,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
|
|||
{
|
||||
MOrderLine ol = new MOrderLine(order);
|
||||
ol.setLine(tasks[i].getSeqNo());
|
||||
StringBuffer sb = new StringBuffer (tasks[i].getName());
|
||||
StringBuilder sb = new StringBuilder (tasks[i].getName());
|
||||
if (tasks[i].getDescription() != null && tasks[i].getDescription().length() > 0)
|
||||
sb.append(" - ").append(tasks[i].getDescription());
|
||||
ol.setDescription(sb.toString());
|
||||
|
@ -136,7 +137,8 @@ public class ProjectPhaseGenOrder extends SvrProcess
|
|||
if (tasks.length != count - lines.length)
|
||||
log.log(Level.SEVERE, "doIt - Lines difference - ProjectTasks=" + tasks.length + " <> Saved=" + count);
|
||||
|
||||
return "@C_Order_ID@ " + order.getDocumentNo() + " (" + count + ")";
|
||||
StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (").append(count).append(")");
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // ProjectPhaseGenOrder
|
||||
|
|
|
@ -86,7 +86,7 @@ public class RegisterSystem extends SvrProcess
|
|||
// Create Query String
|
||||
String enc = WebEnv.ENCODING;
|
||||
// Send GET Request
|
||||
StringBuffer urlString = new StringBuffer ("http://www.adempiere.com")
|
||||
StringBuilder urlString = new StringBuilder ("http://www.adempiere.com")
|
||||
.append("/wstore/registrationServlet?");
|
||||
// System Info
|
||||
urlString.append("Name=").append(URLEncoder.encode(sys.getName(), enc))
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ReplenishReport extends SvrProcess
|
|||
/** Document Type */
|
||||
private int p_C_DocType_ID = 0;
|
||||
/** Return Info */
|
||||
private String m_info = "";
|
||||
private StringBuffer m_info = new StringBuffer();
|
||||
|
||||
/**
|
||||
* Prepare - e.g., get Parameters.
|
||||
|
@ -130,7 +130,7 @@ public class ReplenishReport extends SvrProcess
|
|||
createMovements();
|
||||
else if (p_ReplenishmentCreate.equals("DOO"))
|
||||
createDO();
|
||||
return m_info;
|
||||
return m_info.toString();
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
|
@ -435,8 +435,8 @@ public class ReplenishReport extends SvrProcess
|
|||
line.setPrice();
|
||||
line.saveEx();
|
||||
}
|
||||
m_info = "#" + noOrders + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noOrders).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
} // createPO
|
||||
|
||||
/**
|
||||
|
@ -481,8 +481,8 @@ public class ReplenishReport extends SvrProcess
|
|||
line.setPrice();
|
||||
line.saveEx();
|
||||
}
|
||||
m_info = "#" + noReqs + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noReqs).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
} // createRequisition
|
||||
|
||||
/**
|
||||
|
@ -567,13 +567,13 @@ public class ReplenishReport extends SvrProcess
|
|||
}
|
||||
if (replenishs.length == 0)
|
||||
{
|
||||
m_info = "No Source Warehouse";
|
||||
log.warning(m_info);
|
||||
m_info = new StringBuffer("No Source Warehouse");
|
||||
log.warning(m_info.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info = "#" + noMoves + info;
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#") .append(noMoves).append(info);
|
||||
log.info(m_info.toString());
|
||||
}
|
||||
} // Create Inventory Movements
|
||||
|
||||
|
@ -608,10 +608,11 @@ public class ReplenishReport extends SvrProcess
|
|||
M_WarehouseSource_ID = replenish.getM_WarehouseSource_ID();
|
||||
M_Warehouse_ID = replenish.getM_Warehouse_ID();
|
||||
|
||||
order = new MDDOrder (getCtx(), 0, get_TrxName());
|
||||
order = new MDDOrder (getCtx(), 0, get_TrxName());
|
||||
order.setC_DocType_ID(p_C_DocType_ID);
|
||||
order.setDescription(Msg.getMsg(getCtx(), "Replenishment")
|
||||
+ ": " + whSource.getName() + "->" + wh.getName());
|
||||
StringBuffer msgsd = new StringBuffer(Msg.getMsg(getCtx(), "Replenishment"))
|
||||
.append(": ").append(whSource.getName()).append("->").append(wh.getName());
|
||||
order.setDescription(msgsd.toString());
|
||||
// Set Org
|
||||
order.setAD_Org_ID(whSource.getAD_Org_ID());
|
||||
// Set Org Trx
|
||||
|
@ -714,13 +715,13 @@ public class ReplenishReport extends SvrProcess
|
|||
}
|
||||
if (replenishs.length == 0)
|
||||
{
|
||||
m_info = "No Source Warehouse";
|
||||
log.warning(m_info);
|
||||
m_info = new StringBuffer("No Source Warehouse");
|
||||
log.warning(m_info.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info = "#" + noMoves + info;
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noMoves).append(info);
|
||||
log.info(m_info.toString());
|
||||
}
|
||||
} // create Distribution Order
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
/** Document Type */
|
||||
private int p_C_DocType_ID = 0;
|
||||
/** Return Info */
|
||||
private String m_info = "";
|
||||
private StringBuffer m_info = new StringBuffer();
|
||||
private int p_M_Product_Category_ID = 0;
|
||||
private String isKanban = null;
|
||||
|
||||
|
@ -108,12 +108,12 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
* @throws Exception if not successful
|
||||
*/
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
StringBuilder msglog = new StringBuilder("M_Warehouse_ID=").append(p_M_Warehouse_ID)
|
||||
.append(", C_BPartner_ID=").append(p_C_BPartner_ID)
|
||||
.append(" - ReplenishmentCreate=").append(p_ReplenishmentCreate)
|
||||
.append(", C_DocType_ID=").append(p_C_DocType_ID);
|
||||
log.info(msglog.toString());
|
||||
{
|
||||
log.info("M_Warehouse_ID=" + p_M_Warehouse_ID
|
||||
+ ", C_BPartner_ID=" + p_C_BPartner_ID
|
||||
+" - ReplenishmentCreate=" + p_ReplenishmentCreate
|
||||
+ ", C_DocType_ID=" + p_C_DocType_ID);
|
||||
|
||||
if (p_ReplenishmentCreate != null && p_C_DocType_ID == 0 && !p_ReplenishmentCreate.equals("PRD"))
|
||||
throw new AdempiereUserError("@FillMandatory@ @C_DocType_ID@");
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
createDO();
|
||||
else if (p_ReplenishmentCreate.equals("PRD"))
|
||||
createProduction();
|
||||
return m_info;
|
||||
return m_info.toString();
|
||||
} // doIt
|
||||
|
||||
/**
|
||||
|
@ -470,8 +470,8 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
line.setPrice();
|
||||
line.saveEx();
|
||||
}
|
||||
m_info = "#" + noOrders + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noOrders).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
} // createPO
|
||||
|
||||
/**
|
||||
|
@ -516,8 +516,8 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
line.setPrice();
|
||||
line.saveEx();
|
||||
}
|
||||
m_info = "#" + noReqs + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noReqs).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
} // createRequisition
|
||||
|
||||
/**
|
||||
|
@ -554,8 +554,9 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
|
||||
move = new MMovement (getCtx(), 0, get_TrxName());
|
||||
move.setC_DocType_ID(p_C_DocType_ID);
|
||||
move.setDescription(Msg.getMsg(getCtx(), "Replenishment")
|
||||
+ ": " + whSource.getName() + "->" + wh.getName());
|
||||
StringBuilder msgsd = new StringBuilder(Msg.getMsg(getCtx(), "Replenishment"))
|
||||
.append(": ").append(whSource.getName()).append("->").append(wh.getName());
|
||||
move.setDescription(msgsd.toString());
|
||||
// Set Org
|
||||
move.setAD_Org_ID(whSource.getAD_Org_ID());
|
||||
if (!move.save())
|
||||
|
@ -602,13 +603,13 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
}
|
||||
if (replenishs.length == 0)
|
||||
{
|
||||
m_info = "No Source Warehouse";
|
||||
log.warning(m_info);
|
||||
m_info = new StringBuffer("No Source Warehouse");
|
||||
log.warning(m_info.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info = "#" + noMoves + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noMoves).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
}
|
||||
} // Create Inventory Movements
|
||||
|
||||
|
@ -645,8 +646,9 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
|
||||
order = new MDDOrder (getCtx(), 0, get_TrxName());
|
||||
order.setC_DocType_ID(p_C_DocType_ID);
|
||||
order.setDescription(Msg.getMsg(getCtx(), "Replenishment")
|
||||
+ ": " + whSource.getName() + "->" + wh.getName());
|
||||
StringBuilder msgsd = new StringBuilder(Msg.getMsg(getCtx(), "Replenishment"))
|
||||
.append(": ").append(whSource.getName()).append("->").append(wh.getName());
|
||||
order.setDescription(msgsd.toString());
|
||||
// Set Org
|
||||
order.setAD_Org_ID(whSource.getAD_Org_ID());
|
||||
// Set Org Trx
|
||||
|
@ -749,13 +751,13 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
}
|
||||
if (replenishs.length == 0)
|
||||
{
|
||||
m_info = "No Source Warehouse";
|
||||
log.warning(m_info);
|
||||
m_info = new StringBuffer("No Source Warehouse");
|
||||
log.warning(m_info.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info = "#" + noMoves + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noMoves).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
}
|
||||
} // create Distribution Order
|
||||
/**
|
||||
|
@ -820,8 +822,8 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
}
|
||||
|
||||
}
|
||||
m_info = "#" + noProds + info.toString();
|
||||
log.info(m_info);
|
||||
m_info = new StringBuffer("#").append(noProds).append(info.toString());
|
||||
log.info(m_info.toString());
|
||||
} // createRequisition
|
||||
|
||||
/**
|
||||
|
|
|
@ -251,7 +251,7 @@ public class ReplicationLocal extends SvrProcess
|
|||
data.Test = m_test;
|
||||
data.TableName = TableName;
|
||||
// Create SQL
|
||||
StringBuffer sql = new StringBuffer("SELECT * FROM ")
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM ")
|
||||
.append(TableName)
|
||||
.append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID());
|
||||
if (m_replication.getRemote_Org_ID() != 0)
|
||||
|
@ -289,12 +289,12 @@ public class ReplicationLocal extends SvrProcess
|
|||
// send it
|
||||
pi = m_serverRemote.process (new Properties (), pi);
|
||||
ProcessInfoLog[] logs = pi.getLogs();
|
||||
String msg = "< ";
|
||||
StringBuilder msg = new StringBuilder("< ");
|
||||
if (logs != null && logs.length > 0)
|
||||
msg += logs[0].getP_Msg(); // Remote Message
|
||||
msg.append(logs[0].getP_Msg()); // Remote Message
|
||||
log.info("mergeDataTable - " + pi);
|
||||
//
|
||||
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg, get_TrxName());
|
||||
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg.toString(), get_TrxName());
|
||||
if (pi.isError())
|
||||
{
|
||||
log.severe ("mergeDataTable Error - " + pi);
|
||||
|
@ -429,7 +429,7 @@ public class ReplicationLocal extends SvrProcess
|
|||
data.Test = m_test;
|
||||
data.TableName = TableName;
|
||||
// Create SQL
|
||||
StringBuffer sql = new StringBuffer ("SELECT * FROM ")
|
||||
StringBuilder sql = new StringBuilder ("SELECT * FROM ")
|
||||
.append(TableName)
|
||||
.append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID());
|
||||
if (m_replication.getRemote_Org_ID() != 0)
|
||||
|
@ -488,11 +488,11 @@ public class ReplicationLocal extends SvrProcess
|
|||
pi = m_serverRemote.process (new Properties (), pi);
|
||||
log.info("sendUpdatesTable - " + pi);
|
||||
ProcessInfoLog[] logs = pi.getLogs();
|
||||
String msg = "> ";
|
||||
StringBuilder msg = new StringBuilder("> ");
|
||||
if (logs != null && logs.length > 0)
|
||||
msg += logs[0].getP_Msg(); // Remote Message
|
||||
msg.append(logs[0].getP_Msg()); // Remote Message
|
||||
//
|
||||
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg, get_TrxName());
|
||||
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg.toString(), get_TrxName());
|
||||
if (pi.isError())
|
||||
m_replicated = false;
|
||||
rLog.setIsReplicated(!pi.isError());
|
||||
|
|
|
@ -152,21 +152,21 @@ public class ReplicationRemote extends SvrProcess
|
|||
*/
|
||||
private void setupRemoteAD_Sequence (BigDecimal IDRangeStart) throws Exception
|
||||
{
|
||||
String sql = "UPDATE AD_Sequence SET StartNo = " + IDRangeStart
|
||||
+ " WHERE IsTableID='Y' AND StartNo < " + IDRangeStart;
|
||||
int no = DB.executeUpdate(sql, get_TrxName());
|
||||
StringBuilder sql = new StringBuilder("UPDATE AD_Sequence SET StartNo = ").append(IDRangeStart)
|
||||
.append(" WHERE IsTableID='Y' AND StartNo < ").append(IDRangeStart);
|
||||
int no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteAD_Sequence_Start");
|
||||
//
|
||||
sql = "UPDATE AD_Sequence SET CurrentNext = " + IDRangeStart
|
||||
+ " WHERE IsTableID='Y' AND CurrentNext < " + IDRangeStart;
|
||||
no = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE AD_Sequence SET CurrentNext = ").append(IDRangeStart)
|
||||
.append(" WHERE IsTableID='Y' AND CurrentNext < ").append(IDRangeStart);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteAD_Sequence_Next");
|
||||
//
|
||||
sql = "UPDATE AD_Sequence SET CurrentNextSys = -1"
|
||||
+ " WHERE IsTableID='Y' AND CurrentNextSys <> -1";
|
||||
no = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE AD_Sequence SET CurrentNextSys = -1")
|
||||
.append(" WHERE IsTableID='Y' AND CurrentNextSys <> -1");
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteAD_Sequence_Sys");
|
||||
} // setupRemoteAD_Sequence
|
||||
|
@ -185,17 +185,17 @@ public class ReplicationRemote extends SvrProcess
|
|||
if (Suffix == null)
|
||||
Suffix = "";
|
||||
// DocNoSequence_ID
|
||||
String sql = "UPDATE AD_Sequence SET Prefix=" + DB.TO_STRING(Prefix) + ", Suffix=" + DB.TO_STRING(Suffix)
|
||||
+ " WHERE AD_Sequence_ID IN (SELECT DocNoSequence_ID FROM C_DocType"
|
||||
+ " WHERE AD_Client_ID=" + AD_Client_ID + " AND DocNoSequence_ID IS NOT NULL)";
|
||||
int no = DB.executeUpdate(sql, get_TrxName());
|
||||
StringBuilder sql = new StringBuilder("UPDATE AD_Sequence SET Prefix=").append(DB.TO_STRING(Prefix)).append(", Suffix=").append(DB.TO_STRING(Suffix))
|
||||
.append(" WHERE AD_Sequence_ID IN (SELECT DocNoSequence_ID FROM C_DocType")
|
||||
.append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND DocNoSequence_ID IS NOT NULL)");
|
||||
int no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteC_DocType_DocNo");
|
||||
// BatchNoSequence_ID
|
||||
sql = "UPDATE AD_Sequence SET Prefix=" + DB.TO_STRING(Prefix) + ", Suffix=" + DB.TO_STRING(Suffix)
|
||||
+ " WHERE AD_Sequence_ID IN (SELECT BatchNoSequence_ID FROM C_DocType"
|
||||
+ " WHERE AD_Client_ID=" + AD_Client_ID + " AND BatchNoSequence_ID IS NOT NULL)";
|
||||
no = DB.executeUpdate(sql, get_TrxName());
|
||||
sql = new StringBuilder("UPDATE AD_Sequence SET Prefix=").append(DB.TO_STRING(Prefix)).append(", Suffix=").append(DB.TO_STRING(Suffix))
|
||||
.append(" WHERE AD_Sequence_ID IN (SELECT BatchNoSequence_ID FROM C_DocType")
|
||||
.append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND BatchNoSequence_ID IS NOT NULL)");
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteC_DocType_Batch");
|
||||
} // setupRemoteC_DocType
|
||||
|
@ -208,9 +208,9 @@ public class ReplicationRemote extends SvrProcess
|
|||
*/
|
||||
private void setupRemoteAD_Table(String TableName, String ReplicationType) throws Exception
|
||||
{
|
||||
String sql = "UPDATE AD_Table SET ReplicationType = '" + ReplicationType
|
||||
+ "' WHERE TableName='" + TableName + "' AND ReplicationType <> '" + ReplicationType + "'";
|
||||
int no = DB.executeUpdate(sql, get_TrxName());
|
||||
StringBuilder sql = new StringBuilder("UPDATE AD_Table SET ReplicationType = '").append(ReplicationType)
|
||||
.append("' WHERE TableName='").append(TableName).append("' AND ReplicationType <> '").append(ReplicationType).append("'");
|
||||
int no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no == -1)
|
||||
throw new Exception("setupRemoteAD_Table");
|
||||
} // setupRemoteAD_Table
|
||||
|
|
|
@ -80,7 +80,8 @@ public class ReportColumnSet_Copy extends SvrProcess
|
|||
rc.saveEx();
|
||||
}
|
||||
// Oper 1/2 were set to Null !
|
||||
return "@Copied@=" + rcs.length;
|
||||
StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rcs.length);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // ReportColumnSet_Copy
|
||||
|
|
|
@ -90,7 +90,8 @@ public class ReportLineSet_Copy extends SvrProcess
|
|||
}
|
||||
// Oper 1/2 were set to Null !
|
||||
}
|
||||
return "@Copied@=" + rls.length;
|
||||
StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rls.length);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // ReportLineSet_Copy
|
||||
|
|
|
@ -160,9 +160,10 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
{
|
||||
}
|
||||
|
||||
return "processInBox - Total=" + noProcessed +
|
||||
" - Requests=" + noRequest +
|
||||
" - Errors=" + noError;
|
||||
StringBuilder msgreturn = new StringBuilder("processInBox - Total=").append(noProcessed)
|
||||
.append(" - Requests=").append(noRequest)
|
||||
.append(" - Errors=").append(noError);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -409,9 +410,11 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
|
||||
MRequest req = new MRequest(getCtx(), 0, get_TrxName());
|
||||
// Subject as summary
|
||||
req.setSummary("FROM: " + fromAddress + "\n" + msg.getSubject());
|
||||
StringBuilder msgreq = new StringBuilder("FROM: ").append(fromAddress).append("\n").append(msg.getSubject());
|
||||
req.setSummary(msgreq.toString());
|
||||
// Body as result
|
||||
req.setResult("FROM: " + from[0].toString() + "\n" + getMessage(msg));
|
||||
msgreq = new StringBuilder("FROM: ") .append(from[0].toString()).append("\n").append(getMessage(msg));
|
||||
req.setResult(msgreq.toString());
|
||||
// Message-ID as documentNo
|
||||
if (hdrs != null)
|
||||
req.setDocumentNo(hdrs[0].substring(0,30));
|
||||
|
@ -534,7 +537,8 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
MRequest requp = new MRequest(getCtx(), request_upd, get_TrxName());
|
||||
// Body as result
|
||||
Address[] from = msg.getFrom();
|
||||
requp.setResult("FROM: " + from[0].toString() + "\n" + getMessage(msg));
|
||||
StringBuilder msgreq = new StringBuilder("FROM: ").append(from[0].toString()).append("\n").append(getMessage(msg));
|
||||
requp.setResult(msgreq.toString());
|
||||
return requp.save();
|
||||
}
|
||||
|
||||
|
@ -605,7 +609,7 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
*/
|
||||
private String getMessage (Part msg)
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
// Text
|
||||
|
@ -790,30 +794,37 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
{
|
||||
printOut("-----------------------------------------------------------------");
|
||||
Address[] a;
|
||||
StringBuilder msgout = new StringBuilder();
|
||||
// FROM
|
||||
if ((a = m.getFrom()) != null)
|
||||
{
|
||||
for (int j = 0; j < a.length; j++)
|
||||
printOut("FROM: " + a[j].toString());
|
||||
for (int j = 0; j < a.length; j++){
|
||||
msgout = new StringBuilder("FROM: ").append(a[j].toString());
|
||||
printOut(msgout.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// TO
|
||||
if ((a = m.getRecipients(Message.RecipientType.TO)) != null)
|
||||
{
|
||||
for (int j = 0; j < a.length; j++)
|
||||
printOut("TO: " + a[j].toString());
|
||||
for (int j = 0; j < a.length; j++){
|
||||
msgout = new StringBuilder("TO: ").append(a[j].toString());
|
||||
printOut(msgout.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// SUBJECT
|
||||
printOut("SUBJECT: " + m.getSubject());
|
||||
msgout = new StringBuilder("SUBJECT: ").append(m.getSubject());
|
||||
printOut(msgout.toString());
|
||||
|
||||
// DATE
|
||||
java.util.Date d = m.getSentDate();
|
||||
printOut("SendDate: " + (d != null ? d.toString() : "UNKNOWN"));
|
||||
msgout = new StringBuilder("SendDate: ").append((d != null ? d.toString() : "UNKNOWN"));
|
||||
printOut(msgout.toString());
|
||||
|
||||
// FLAGS
|
||||
Flags flags = m.getFlags();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
|
||||
|
||||
boolean first = true;
|
||||
|
@ -851,13 +862,14 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
sb.append(' ');
|
||||
sb.append(uf[i]);
|
||||
}
|
||||
printOut("FLAGS: " + sb.toString());
|
||||
msgout = new StringBuilder("FLAGS: ").append(sb.toString());
|
||||
printOut(msgout.toString());
|
||||
|
||||
// X-MAILER
|
||||
String[] hdrs = m.getHeader("X-Mailer");
|
||||
if (hdrs != null)
|
||||
{
|
||||
StringBuffer sb1 = new StringBuffer("X-Mailer: ");
|
||||
StringBuilder sb1 = new StringBuilder("X-Mailer: ");
|
||||
for (int i = 0; i < hdrs.length; i++)
|
||||
sb1.append(hdrs[i]).append(" ");
|
||||
printOut(sb1.toString());
|
||||
|
@ -869,7 +881,7 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
hdrs = m.getHeader("Message-ID");
|
||||
if (hdrs != null)
|
||||
{
|
||||
StringBuffer sb1 = new StringBuffer("Message-ID: ");
|
||||
StringBuilder sb1 = new StringBuilder("Message-ID: ");
|
||||
for (int i = 0; i < hdrs.length; i++)
|
||||
sb1.append(hdrs[i]).append(" ");
|
||||
printOut(sb1.toString());
|
||||
|
@ -883,7 +895,8 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
while (en.hasMoreElements())
|
||||
{
|
||||
Header hdr = (Header)en.nextElement();
|
||||
printOut (" " + hdr.getName() + " = " + hdr.getValue());
|
||||
msgout = new StringBuilder(" ").append(hdr.getName()).append(" = ").append(hdr.getValue());
|
||||
printOut (msgout.toString());
|
||||
}
|
||||
|
||||
|
||||
|
@ -899,7 +912,8 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
{
|
||||
// http://www.iana.org/assignments/media-types/
|
||||
printOut("=================================================================");
|
||||
printOut("CONTENT-TYPE: " + p.getContentType());
|
||||
StringBuilder msgout = new StringBuilder("CONTENT-TYPE: ").append(p.getContentType());
|
||||
printOut(msgout.toString());
|
||||
/**
|
||||
Enumeration en = p.getAllHeaders();
|
||||
while (en.hasMoreElements())
|
||||
|
|
|
@ -98,26 +98,26 @@ public class RequestInvoice extends SvrProcess
|
|||
if (!type.isInvoiced())
|
||||
throw new AdempiereSystemError("@R_RequestType_ID@ <> @IsInvoiced@");
|
||||
|
||||
String sql = "SELECT * FROM R_Request r"
|
||||
+ " INNER JOIN R_Status s ON (r.R_Status_ID=s.R_Status_ID) "
|
||||
+ "WHERE s.IsClosed='Y'"
|
||||
+ " AND r.R_RequestType_ID=?";
|
||||
StringBuilder sql = new StringBuilder("SELECT * FROM R_Request r")
|
||||
.append(" INNER JOIN R_Status s ON (r.R_Status_ID=s.R_Status_ID) ")
|
||||
.append("WHERE s.IsClosed='Y'")
|
||||
.append(" AND r.R_RequestType_ID=?");
|
||||
// globalqss -- avoid double invoicing
|
||||
// + " AND EXISTS (SELECT 1 FROM R_RequestUpdate ru " +
|
||||
// "WHERE ru.R_Request_ID=r.R_Request_ID AND NVL(C_InvoiceLine_ID,0)=0";
|
||||
if (p_R_Group_ID != 0)
|
||||
sql += " AND r.R_Group_ID=?";
|
||||
sql.append(" AND r.R_Group_ID=?");
|
||||
if (p_R_Category_ID != 0)
|
||||
sql += " AND r.R_Category_ID=?";
|
||||
sql.append(" AND r.R_Category_ID=?");
|
||||
if (p_C_BPartner_ID != 0)
|
||||
sql += " AND r.C_BPartner_ID=?";
|
||||
sql += " AND r.IsInvoiced='Y' "
|
||||
+ "ORDER BY C_BPartner_ID";
|
||||
sql.append(" AND r.C_BPartner_ID=?");
|
||||
sql.append(" AND r.IsInvoiced='Y' ")
|
||||
.append("ORDER BY C_BPartner_ID");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
int index = 1;
|
||||
pstmt.setInt (index++, p_R_RequestType_ID);
|
||||
if (p_R_Group_ID != 0)
|
||||
|
@ -150,7 +150,7 @@ public class RequestInvoice extends SvrProcess
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
log.log (Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
|
|
@ -173,7 +173,7 @@ public class RequisitionPOCreate extends SvrProcess
|
|||
+ ", ConsolidateDocument" + p_ConsolidateDocument);
|
||||
|
||||
ArrayList<Object> params = new ArrayList<Object>();
|
||||
StringBuffer whereClause = new StringBuffer("C_OrderLine_ID IS NULL");
|
||||
StringBuilder whereClause = new StringBuilder("C_OrderLine_ID IS NULL");
|
||||
if (p_AD_Org_ID > 0)
|
||||
{
|
||||
whereClause.append(" AND AD_Org_ID=?");
|
||||
|
@ -355,8 +355,9 @@ public class RequisitionPOCreate extends SvrProcess
|
|||
// default po document type
|
||||
if (!p_ConsolidateDocument)
|
||||
{
|
||||
m_order.setDescription(Msg.getElement(getCtx(), "M_Requisition_ID")
|
||||
+ ": " + rLine.getParent().getDocumentNo());
|
||||
StringBuilder msgsd= new StringBuilder(Msg.getElement(getCtx(), "M_Requisition_ID"))
|
||||
.append(": ").append(rLine.getParent().getDocumentNo());
|
||||
m_order.setDescription(msgsd.toString());
|
||||
}
|
||||
|
||||
// Prepare Save
|
||||
|
|
|
@ -78,7 +78,8 @@ public class RfQClose extends SvrProcess
|
|||
counter++;
|
||||
}
|
||||
//
|
||||
return "# " + counter;
|
||||
StringBuilder msgreturn = new StringBuilder("# ").append(counter);
|
||||
return msgreturn.toString();
|
||||
} // doIt
|
||||
|
||||
} // RfQClose
|
||||
|
|
Loading…
Reference in New Issue