IDEMPIERE-1559 create purchase order not success still make link / based on patch from hieplq
This commit is contained in:
parent
a99c11e203
commit
b1d9aad6f2
|
@ -265,8 +265,7 @@ public class InOutGenerateRMA extends SvrProcess
|
|||
}
|
||||
|
||||
// Add processing information to process log
|
||||
addLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString(),shipment.get_Table_ID(),shipment.getM_InOut_ID()
|
||||
);
|
||||
addBufferLog(shipment.getM_InOut_ID(), shipment.getMovementDate(), null, processMsg.toString(),shipment.get_Table_ID(),shipment.getM_InOut_ID());
|
||||
m_created++;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ public class InvoiceGenerateRMA extends SvrProcess
|
|||
|
||||
// Add processing information to process log
|
||||
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + processMsg.toString());
|
||||
addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, message, invoice.get_Table_ID(), invoice.getC_Invoice_ID());
|
||||
addBufferLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), null, message, invoice.get_Table_ID(), invoice.getC_Invoice_ID());
|
||||
m_created++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ public class AllocationAuto extends SvrProcess
|
|||
if (payment.allocateIt())
|
||||
{
|
||||
String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [1]");
|
||||
addLog(0, payment.getDateAcct(), openAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
|
||||
addBufferLog(0, payment.getDateAcct(), openAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
|
@ -444,7 +444,7 @@ public class AllocationAuto extends SvrProcess
|
|||
if (payment.allocateIt())
|
||||
{
|
||||
String message = Msg.parseTranslation(getCtx(), "@PaymentAllocated@ " + payment.getDocumentNo() + " [n]");
|
||||
addLog(0, payment.getDateAcct(), availableAmt, message);
|
||||
addBufferLog(0, payment.getDateAcct(), availableAmt, message, payment.get_Table_ID(), payment.getC_Payment_ID());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
while (rs.next())
|
||||
{
|
||||
StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" BOM without BOM lines");
|
||||
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
|
@ -120,7 +120,7 @@ public class BOMFlagValidate extends SvrProcess {
|
|||
while (rs.next())
|
||||
{
|
||||
StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" not BOM with BOM lines");
|
||||
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
addBufferLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw e;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class BOMValidate extends SvrProcess
|
|||
while (rs.next ())
|
||||
{
|
||||
String info = validateProduct(new MProduct(getCtx(), rs.getInt("M_Product_ID"), get_TrxName()));
|
||||
addLog(0, null, null, info, MProduct.Table_ID, rs.getInt("M_Product_ID"));
|
||||
addBufferLog(0, null, null, info, MProduct.Table_ID, rs.getInt("M_Product_ID"));
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public class BOMVerify extends SvrProcess
|
|||
if (p_fromButton)
|
||||
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue());
|
||||
else
|
||||
addLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID());
|
||||
addBufferLog(0, null, null, product.getValue() + " recursively contains " + pp.getValue(), MProduct.Table_ID, product.getM_Product_ID());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ public class BOMVerify extends SvrProcess
|
|||
if (p_fromButton)
|
||||
addLog(0, null, null, product.getValue() + " does not have lines");
|
||||
else
|
||||
addLog(0, null, null, product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID());
|
||||
addBufferLog(0, null, null, product.getValue() + " does not have lines", MProduct.Table_ID, product.getM_Product_ID());
|
||||
}
|
||||
|
||||
checkedproducts.add(product);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ConvertLead extends SvrProcess {
|
|||
bp.setName(lead.getName());
|
||||
|
||||
bp.saveEx();
|
||||
addLog(bp.getC_BPartner_ID(), null, null, "@C_BPartner_ID@ @Created@", MBPartner.Table_ID, bp.getC_BPartner_ID());
|
||||
addBufferLog(bp.getC_BPartner_ID(), null, null, "@C_BPartner_ID@ @Created@", MBPartner.Table_ID, bp.getC_BPartner_ID());
|
||||
|
||||
lead.setC_BPartner_ID(bp.getC_BPartner_ID());
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class ConvertLead extends SvrProcess {
|
|||
|
||||
op.saveEx();
|
||||
|
||||
addLog(op.getC_Opportunity_ID(), null, null, "@C_Opportunity_ID@ @Created@", MOpportunity.Table_ID, op.getC_Opportunity_ID());
|
||||
addBufferLog(op.getC_Opportunity_ID(), null, null, "@C_Opportunity_ID@ @Created@", MOpportunity.Table_ID, op.getC_Opportunity_ID());
|
||||
}
|
||||
|
||||
lead.setIsSalesLead(false);
|
||||
|
|
|
@ -338,7 +338,7 @@ public class CostUpdate extends SvrProcess
|
|||
msg.append(m_docType.getName()).append(" ").append(inventoryDoc.getDocumentNo());
|
||||
else
|
||||
msg.append(m_docType.get_Translation(I_C_DocType.COLUMNNAME_Name)).append(" ").append(inventoryDoc.getDocumentNo());
|
||||
addLog(getAD_PInstance_ID(), null, null, msg.toString(), I_M_Inventory.Table_ID, inventoryDoc.getM_Inventory_ID());
|
||||
addBufferLog(getAD_PInstance_ID(), null, null, msg.toString(), I_M_Inventory.Table_ID, inventoryDoc.getM_Inventory_ID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ public class ExpenseAPInvoice extends SvrProcess
|
|||
throw new IllegalStateException("Cannot save Invoice");
|
||||
//
|
||||
m_noInvoices++;
|
||||
addLog(invoice.get_ID(), invoice.getDateInvoiced(),
|
||||
addBufferLog(invoice.get_ID(), invoice.getDateInvoiced(),
|
||||
invoice.getGrandTotal(), invoice.getDocumentNo(), invoice.get_Table_ID(), invoice.getC_Invoice_ID());
|
||||
} // completeInvoice
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ public class ExpenseSOrder extends SvrProcess
|
|||
if (!m_order.save())
|
||||
throw new IllegalStateException("Cannot save Order");
|
||||
m_noOrders++;
|
||||
addLog (m_order.get_ID(), m_order.getDateOrdered(), m_order.getGrandTotal(), m_order.getDocumentNo(), m_order.get_Table_ID(), m_order.getC_Order_ID());
|
||||
addBufferLog (m_order.get_ID(), m_order.getDateOrdered(), m_order.getGrandTotal(), m_order.getDocumentNo(), m_order.get_Table_ID(), m_order.getC_Order_ID());
|
||||
m_order = null;
|
||||
} // completeOrder
|
||||
|
||||
|
|
|
@ -582,7 +582,7 @@ public class InOutGenerate extends SvrProcess
|
|||
}
|
||||
m_shipment.saveEx();
|
||||
String message = Msg.parseTranslation(getCtx(), "@ShipmentProcessed@ " + m_shipment.getDocumentNo());
|
||||
addLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, message, m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID());
|
||||
addBufferLog(m_shipment.getM_InOut_ID(), m_shipment.getMovementDate(), null, message, m_shipment.get_Table_ID(),m_shipment.getM_InOut_ID());
|
||||
m_created++;
|
||||
|
||||
//reset storage cache as MInOut.completeIt will update m_storage
|
||||
|
|
|
@ -167,7 +167,7 @@ public class InvoiceBatchProcess extends SvrProcess
|
|||
m_invoice.saveEx();
|
||||
|
||||
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
|
||||
addLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
addBufferLog(0, m_invoice.getDateInvoiced(), m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
m_count++;
|
||||
|
||||
m_invoice = null;
|
||||
|
|
|
@ -271,7 +271,7 @@ public class InvoiceGenerate extends SvrProcess
|
|||
if (completeOrder && !fullyDelivered)
|
||||
{
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Failed CompleteOrder - " + oLine);
|
||||
addLog(0, null, null,"Failed CompleteOrder - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); // Elaine 2008/11/25
|
||||
addBufferLog(0, null, null,"Failed CompleteOrder - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID()); // Elaine 2008/11/25
|
||||
completeOrder = false;
|
||||
break;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class InvoiceGenerate extends SvrProcess
|
|||
{
|
||||
if (log.isLoggable(Level.FINE)) log.fine("Failed: " + order.getInvoiceRule()
|
||||
+ " - ToInvoice=" + toInvoice + " - " + oLine);
|
||||
addLog(0, null, null,"Failed: " + order.getInvoiceRule()
|
||||
addBufferLog(0, null, null,"Failed: " + order.getInvoiceRule()
|
||||
+ " - ToInvoice=" + toInvoice + " - " + oLine,oLine.get_Table_ID(),oLine.getC_OrderLine_ID());
|
||||
}
|
||||
} // for all order lines
|
||||
|
@ -489,14 +489,14 @@ public class InvoiceGenerate extends SvrProcess
|
|||
if (!m_invoice.processIt(p_docAction))
|
||||
{
|
||||
log.warning("completeInvoice - failed: " + m_invoice);
|
||||
addLog(0, null, null,"completeInvoice - failed: " + m_invoice,m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); // Elaine 2008/11/25
|
||||
addBufferLog(0, null, null,"completeInvoice - failed: " + m_invoice,m_invoice.get_Table_ID(),m_invoice.getC_Invoice_ID()); // Elaine 2008/11/25
|
||||
throw new IllegalStateException("Invoice Process Failed: " + m_invoice + " - " + m_invoice.getProcessMsg());
|
||||
|
||||
}
|
||||
m_invoice.saveEx();
|
||||
|
||||
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
|
||||
addLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
addBufferLog(m_invoice.getC_Invoice_ID(), m_invoice.getDateInvoiced(), null, message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
m_created++;
|
||||
}
|
||||
m_invoice = null;
|
||||
|
|
|
@ -210,7 +210,7 @@ public class OrderPOCreate extends SvrProcess
|
|||
{
|
||||
po = createPOForVendor(rs.getInt(1), so);
|
||||
String message = Msg.parseTranslation(getCtx(), "@OrderCreated@ " + po.getDocumentNo());
|
||||
addLog(0, null, null, message, po.get_Table_ID(), po.getC_Order_ID());
|
||||
addBufferLog (0, null, null, message, po.get_Table_ID(), po.getC_Order_ID());
|
||||
counter++;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ public class RequestInvoice extends SvrProcess
|
|||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql.toString(), e);
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -180,7 +181,7 @@ public class RequestInvoice extends SvrProcess
|
|||
}
|
||||
m_invoice.saveEx();
|
||||
String message = Msg.parseTranslation(getCtx(), "@InvoiceProcessed@ " + m_invoice.getDocumentNo());
|
||||
addLog(0, null, m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
addBufferLog(0, null, m_invoice.getGrandTotal(), message, m_invoice.get_Table_ID(), m_invoice.getC_Invoice_ID());
|
||||
}
|
||||
}
|
||||
m_invoice = null;
|
||||
|
|
|
@ -382,7 +382,7 @@ public class RequisitionPOCreate extends SvrProcess
|
|||
{
|
||||
m_order.load(get_TrxName());
|
||||
String message = Msg.parseTranslation(getCtx(), "@GeneratedPO@ " + m_order.getDocumentNo());
|
||||
addLog(0, null, m_order.getGrandTotal(), message, m_order.get_Table_ID(), m_order.getC_Order_ID());
|
||||
addBufferLog(0, null, m_order.getGrandTotal(), message, m_order.get_Table_ID(), m_order.getC_Order_ID());
|
||||
}
|
||||
m_order = null;
|
||||
m_orderLine = null;
|
||||
|
|
|
@ -175,7 +175,7 @@ public class RfQCreatePO extends SvrProcess
|
|||
order.setSalesRep_ID(rfq.getSalesRep_ID());
|
||||
order.saveEx();
|
||||
noOrders++;
|
||||
addLog(0, null, null, order.getDocumentNo(), order.get_Table_ID(), order.getC_Order_ID());
|
||||
addBufferLog(0, null, null, order.getDocumentNo(), order.get_Table_ID(), order.getC_Order_ID());
|
||||
}
|
||||
// For all Qtys
|
||||
MRfQResponseLineQty[] qtys = line.getQtys(false);
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -54,6 +56,26 @@ public abstract class SvrProcess implements ProcessCall
|
|||
public static final String PROCESS_INFO_CTX_KEY = "ProcessInfo";
|
||||
public static final String PROCESS_UI_CTX_KEY = "ProcessUI";
|
||||
|
||||
private List<ProcessInfoLog> listEntryLog;
|
||||
|
||||
/**
|
||||
* Add log to buffer, only process total success, flush buffer
|
||||
* @param id
|
||||
* @param date
|
||||
* @param number
|
||||
* @param msg
|
||||
* @param tableId
|
||||
* @param recordId
|
||||
*/
|
||||
public void addBufferLog(int id, Timestamp date, BigDecimal number, String msg, int tableId ,int recordId) {
|
||||
ProcessInfoLog entryLog = new ProcessInfoLog(id, date, number, msg, tableId, recordId);
|
||||
|
||||
if (listEntryLog == null)
|
||||
listEntryLog = new ArrayList<ProcessInfoLog>();
|
||||
|
||||
listEntryLog.add(entryLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* Server Process.
|
||||
* Note that the class is initiated by startProcess.
|
||||
|
@ -192,6 +214,9 @@ public abstract class SvrProcess implements ProcessCall
|
|||
if ("@Error@".equals(msg))
|
||||
success = false;
|
||||
|
||||
if (success)
|
||||
flushBufferLog();
|
||||
|
||||
// Parse Variables
|
||||
msg = Msg.parseTranslation(m_ctx, msg);
|
||||
m_pi.setSummary (msg, !success);
|
||||
|
@ -449,7 +474,7 @@ public abstract class SvrProcess implements ProcessCall
|
|||
if (m_pi != null)
|
||||
m_pi.addLog(id, date, number, msg,tableId,recordId);
|
||||
|
||||
if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg +" - "+tableId);
|
||||
if (log.isLoggable(Level.INFO)) log.info(id + " - " + date + " - " + number + " - " + msg + " - " + tableId + " - " + recordId);
|
||||
} // addLog
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -476,6 +501,17 @@ public abstract class SvrProcess implements ProcessCall
|
|||
addLog (0, null, null, msg);
|
||||
} // addLog
|
||||
|
||||
private void flushBufferLog () {
|
||||
if (listEntryLog == null)
|
||||
return;
|
||||
|
||||
for (ProcessInfoLog entryLog : listEntryLog) {
|
||||
if (m_pi != null)
|
||||
m_pi.addLog(entryLog);
|
||||
if (log.isLoggable(Level.INFO)) log.info(entryLog.getP_ID() + " - " + entryLog.getP_Date() + " - " + entryLog.getP_Number() + " - " + entryLog.getP_Msg() + " - " + entryLog.getAD_Table_ID() + " - " + entryLog.getRecord_ID());
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Execute function
|
||||
* @param className class
|
||||
|
|
|
@ -164,7 +164,7 @@ public class BankTransfer extends SvrProcess
|
|||
throw new IllegalStateException("Payment Process Failed: " + paymentBankFrom + " - " + paymentBankFrom.getProcessMsg());
|
||||
}
|
||||
paymentBankFrom.saveEx();
|
||||
addLog(paymentBankFrom.getC_Payment_ID(), paymentBankFrom.getDateTrx(),
|
||||
addBufferLog(paymentBankFrom.getC_Payment_ID(), paymentBankFrom.getDateTrx(),
|
||||
null, paymentBankFrom.getC_DocType().getName() + " " + paymentBankFrom.getDocumentNo(),
|
||||
MPayment.Table_ID, paymentBankFrom.getC_Payment_ID());
|
||||
m_created++;
|
||||
|
@ -190,7 +190,7 @@ public class BankTransfer extends SvrProcess
|
|||
throw new IllegalStateException("Payment Process Failed: " + paymentBankTo + " - " + paymentBankTo.getProcessMsg());
|
||||
}
|
||||
paymentBankTo.saveEx();
|
||||
addLog(paymentBankTo.getC_Payment_ID(), paymentBankTo.getDateTrx(),
|
||||
addBufferLog(paymentBankTo.getC_Payment_ID(), paymentBankTo.getDateTrx(),
|
||||
null, paymentBankTo.getC_DocType().getName() + " " + paymentBankTo.getDocumentNo(),
|
||||
MPayment.Table_ID, paymentBankTo.getC_Payment_ID());
|
||||
m_created++;
|
||||
|
|
Loading…
Reference in New Issue