BF [2968442] - Post without Application Server - journals and Allocations / Deprecate old way of TESTING -> AD_Client.IsPostImmediate

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2968442
This commit is contained in:
Carlos Ruiz 2010-03-14 05:23:15 +00:00
parent d92315b6d8
commit 1784eebf02
13 changed files with 399 additions and 103 deletions

View File

@ -31,7 +31,6 @@ import java.util.logging.Level;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.compiere.model.MAccount; import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchema;
import org.compiere.model.MClient;
import org.compiere.model.MConversionRate; import org.compiere.model.MConversionRate;
import org.compiere.model.MDocType; import org.compiere.model.MDocType;
import org.compiere.model.MNote; import org.compiere.model.MNote;
@ -358,6 +357,9 @@ public abstract class Doc
/** Log per Document */ /** Log per Document */
protected CLogger log = CLogger.getCLogger(getClass()); protected CLogger log = CLogger.getCLogger(getClass());
/* If the transaction must be managed locally (false if it's managed externally by the caller) */
private boolean m_manageLocalTrx;
/************************************************************************** /**************************************************************************
* Constructor * Constructor
@ -396,8 +398,11 @@ public abstract class Doc
// Document Type // Document Type
setDocumentType (defaultDocumentType); setDocumentType (defaultDocumentType);
m_trxName = trxName; m_trxName = trxName;
if (m_trxName == null) m_manageLocalTrx = false;
if (m_trxName == null) {
m_trxName = "Post" + m_DocumentType + p_po.get_ID(); m_trxName = "Post" + m_DocumentType + p_po.get_ID();
m_manageLocalTrx = true;
}
p_po.set_TrxName(m_trxName); p_po.set_TrxName(m_trxName);
// Amounts // Amounts
@ -551,7 +556,7 @@ public abstract class Doc
// Lock Record ---- // Lock Record ----
String trxName = null; // outside trx if on server String trxName = null; // outside trx if on server
if (MClient.isClientAccounting()) if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client trxName = getTrxName(); // on trx if it's in client
StringBuffer sql = new StringBuffer ("UPDATE "); StringBuffer sql = new StringBuffer ("UPDATE ");
sql.append(get_TableName()).append( " SET Processing='Y' WHERE ") sql.append(get_TableName()).append( " SET Processing='Y' WHERE ")
@ -830,8 +835,10 @@ public abstract class Doc
else else
{ {
log.log(Level.SEVERE, "(fact not saved) ... rolling back"); log.log(Level.SEVERE, "(fact not saved) ... rolling back");
trx.rollback(); if (m_manageLocalTrx) {
trx.close(); trx.rollback();
trx.close();
}
unlock(); unlock();
return STATUS_Error; return STATUS_Error;
} }
@ -841,30 +848,36 @@ public abstract class Doc
if (!save(getTrxName())) // contains unlock & document status update if (!save(getTrxName())) // contains unlock & document status update
{ {
log.log(Level.SEVERE, "(doc not saved) ... rolling back"); log.log(Level.SEVERE, "(doc not saved) ... rolling back");
trx.rollback(); if (m_manageLocalTrx) {
trx.close(); trx.rollback();
trx.close();
}
unlock(); unlock();
return STATUS_Error; return STATUS_Error;
} }
// Success // Success
trx.commit(true); if (m_manageLocalTrx) {
trx.close(); trx.commit(true);
trx = null; trx.close();
trx = null;
}
// *** Transaction End *** // *** Transaction End ***
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, "... rolling back", e); log.log(Level.SEVERE, "... rolling back", e);
status = STATUS_Error; status = STATUS_Error;
try { if (m_manageLocalTrx) {
if (trx != null) try {
trx.rollback(); if (trx != null)
} catch (Exception e2) {} trx.rollback();
try { } catch (Exception e2) {}
if (trx != null) try {
trx.close(); if (trx != null)
trx = null; trx.close();
} catch (Exception e3) {} trx = null;
} catch (Exception e3) {}
}
unlock(); unlock();
} }
p_Status = status; p_Status = status;
@ -886,7 +899,7 @@ public abstract class Doc
private void unlock() private void unlock()
{ {
String trxName = null; // outside trx if on server String trxName = null; // outside trx if on server
if (MClient.isClientAccounting()) if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client trxName = getTrxName(); // on trx if it's in client
StringBuffer sql = new StringBuffer ("UPDATE "); StringBuffer sql = new StringBuffer ("UPDATE ");
sql.append(get_TableName()).append( " SET Processing='N' WHERE ") sql.append(get_TableName()).append( " SET Processing='N' WHERE ")

View File

@ -39,7 +39,7 @@ public class MFactAcct extends X_Fact_Acct
/** /**
* *
*/ */
private static final long serialVersionUID = 756203818233903671L; private static final long serialVersionUID = 5251847162314796574L;
/** /**
* Delete Accounting * Delete Accounting
@ -135,19 +135,4 @@ public class MFactAcct extends X_Fact_Acct
return acct; return acct;
} // getMAccount } // getMAccount
/**
* Check if a document is already posted
* @param AD_Table_ID table
* @param Record_ID record
* @param trxName transaction
* @return boolean indicating if the document has already accounting facts
* @throws DBException on database exception
*/
public static boolean alreadyPosted(int AD_Table_ID, int Record_ID, String trxName) throws DBException
{
final String sql = "SELECT 1 FROM Fact_Acct WHERE AD_Table_ID=? AND Record_ID=?";
int one = DB.getSQLValue(trxName, sql, new Object[]{AD_Table_ID, Record_ID});
return (one == 1);
}
} // MFactAcct } // MFactAcct

View File

@ -1486,6 +1486,9 @@ public class MInOut extends X_M_InOut implements DocAction
m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching"); m_processMsg = CLogger.retrieveErrorString("Could not create Inv Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(inv.getCtx(), inv.getAD_Client_ID(), inv.get_Table_ID(), inv.get_ID(), true, inv.get_TrxName());
}
} }
} }
@ -1500,6 +1503,9 @@ public class MInOut extends X_M_InOut implements DocAction
m_processMsg = "Could not create PO Matching"; m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
}
// Update PO with ASI // Update PO with ASI
if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0
&& sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ] && sLine.getMovementQty().compareTo(oLine.getQtyOrdered()) == 0) // just if full match [ 1876965 ]
@ -1523,6 +1529,9 @@ public class MInOut extends X_M_InOut implements DocAction
m_processMsg = "Could not create PO(Inv) Matching"; m_processMsg = "Could not create PO(Inv) Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
}
// Update PO with ASI // Update PO with ASI
oLine = new MOrderLine (getCtx(), po.getC_OrderLine_ID(), get_TrxName()); oLine = new MOrderLine (getCtx(), po.getC_OrderLine_ID(), get_TrxName());
if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0 if ( oLine != null && oLine.getM_AttributeSetInstance_ID() == 0

View File

@ -1681,8 +1681,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
m_processMsg = "Could not create PO Matching"; m_processMsg = "Could not create PO Matching";
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
else else {
matchPO++; matchPO++;
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(po.getCtx(), po.getAD_Client_ID(), po.get_Table_ID(), po.get_ID(), true, po.get_TrxName());
}
}
} }
} }
@ -1720,8 +1724,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching"); m_processMsg = CLogger.retrieveErrorString("Could not create Invoice Matching");
return DocAction.STATUS_Invalid; return DocAction.STATUS_Invalid;
} }
else else {
matchInv++; matchInv++;
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(inv.getCtx(), inv.getAD_Client_ID(), inv.get_Table_ID(), inv.get_ID(), true, inv.get_TrxName());
}
}
} }
} // for all lines } // for all lines
if (matchInv > 0) if (matchInv > 0)

View File

@ -474,16 +474,13 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
; ;
else else
{ {
String status = journal.completeIt(); journal.processIt(DocAction.ACTION_Complete);
if (!DocAction.STATUS_Completed.equals(status)) journal.saveEx();
if (!DocAction.STATUS_Completed.equals(journal.getDocStatus()))
{ {
journal.setDocStatus(status);
journal.save();
m_processMsg = journal.getProcessMsg(); m_processMsg = journal.getProcessMsg();
return status; return journal.getDocStatus();
} }
journal.setDocStatus(DOCSTATUS_Completed);
journal.save();
} }
// //
TotalDr = TotalDr.add(journal.getTotalDr()); TotalDr = TotalDr.add(journal.getTotalDr());

View File

@ -429,7 +429,11 @@ public class MMatchInv extends X_M_MatchInv
if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns)) if (receipt.getMovementType().equals(MInOut.MOVEMENTTYPE_VendorReturns))
qty = getQty().negate(); qty = getQty().negate();
// //
BigDecimal price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP); BigDecimal price = null;
if (cd.getQty().compareTo(Env.ZERO) == 0) // avoid division by zero
price = Env.ZERO;
else
price = cd.getAmt().divide(cd.getQty(),12,BigDecimal.ROUND_HALF_UP);
cd.setDeltaAmt(price.multiply(qty.negate())); cd.setDeltaAmt(price.multiply(qty.negate()));
cd.setDeltaQty(qty.negate()); cd.setDeltaQty(qty.negate());
cd.setProcessed(false); cd.setProcessed(false);

View File

@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.report.MReportTree;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;

View File

@ -1790,10 +1790,9 @@ public class MOrder extends X_C_Order implements DocAction
} }
} }
// Manually Process Shipment // Manually Process Shipment
String status = shipment.completeIt(); shipment.processIt(DocAction.ACTION_Complete);
shipment.setDocStatus(status); shipment.saveEx(get_TrxName());
shipment.save(get_TrxName()); if (!DOCSTATUS_Completed.equals(shipment.getDocStatus()))
if (!DOCSTATUS_Completed.equals(status))
{ {
m_processMsg = "@M_InOut_ID@: " + shipment.getProcessMsg(); m_processMsg = "@M_InOut_ID@: " + shipment.getProcessMsg();
return null; return null;
@ -1877,11 +1876,10 @@ public class MOrder extends X_C_Order implements DocAction
} }
} }
// Manually Process Invoice // Manually Process Invoice
String status = invoice.completeIt(); invoice.processIt(DocAction.ACTION_Complete);
invoice.setDocStatus(status); invoice.saveEx(get_TrxName());
invoice.save(get_TrxName());
setC_CashLine_ID(invoice.getC_CashLine_ID()); setC_CashLine_ID(invoice.getC_CashLine_ID());
if (!DOCSTATUS_Completed.equals(status)) if (!DOCSTATUS_Completed.equals(invoice.getDocStatus()))
{ {
m_processMsg = "@C_Invoice_ID@: " + invoice.getProcessMsg(); m_processMsg = "@C_Invoice_ID@: " + invoice.getProcessMsg();
return null; return null;

View File

@ -34,6 +34,7 @@ import org.compiere.model.MAllocationHdr;
import org.compiere.model.MBankStatement; import org.compiere.model.MBankStatement;
import org.compiere.model.MCash; import org.compiere.model.MCash;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MColumn;
import org.compiere.model.MInOut; import org.compiere.model.MInOut;
import org.compiere.model.MInventory; import org.compiere.model.MInventory;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
@ -42,6 +43,7 @@ import org.compiere.model.MJournalBatch;
import org.compiere.model.MMovement; import org.compiere.model.MMovement;
import org.compiere.model.MOrder; import org.compiere.model.MOrder;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
import org.compiere.model.MTable;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -287,20 +289,20 @@ public class DocumentEngine implements DocAction
return false; return false;
} }
status = completeIt(); status = completeIt();
if (m_document != null boolean ok = STATUS_Completed.equals(status)
&& !Ini.isClient()) // Post Immediate if on Server || STATUS_InProgress.equals(status)
|| STATUS_WaitingPayment.equals(status)
|| STATUS_WaitingConfirmation.equals(status);
if (m_document != null && ok)
{ {
MClient client = MClient.get(m_document.getCtx(), m_document.getAD_Client_ID()); MClient client = MClient.get(m_document.getCtx(), m_document.getAD_Client_ID());
if (STATUS_Completed.equals(status) && client.isPostImmediate()) if (STATUS_Completed.equals(status) && MClient.isClientAccountingImmediate())
{ {
m_document.save(); m_document.save();
postIt(); postIt();
} }
} }
return STATUS_Completed.equals(status) return ok;
|| STATUS_InProgress.equals(status)
|| STATUS_WaitingPayment.equals(status)
|| STATUS_WaitingConfirmation.equals(status);
} }
if (ACTION_ReActivate.equals(m_action)) if (ACTION_ReActivate.equals(m_action))
return reActivateIt(); return reActivateIt();
@ -1228,6 +1230,10 @@ public class DocumentEngine implements DocAction
public static String postImmediate (Properties ctx, public static String postImmediate (Properties ctx,
int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName) int AD_Client_ID, int AD_Table_ID, int Record_ID, boolean force, String trxName)
{ {
// Ensure the table has Posted column / i.e. GL_JournalBatch can be completed but not posted
if (MColumn.getColumn_ID(MTable.getTableName(ctx, AD_Table_ID), "Posted") <= 0)
return null;
String error = null; String error = null;
if (MClient.isClientAccounting()) { if (MClient.isClientAccounting()) {
log.info ("Table=" + AD_Table_ID + ", Record=" + Record_ID); log.info ("Table=" + AD_Table_ID + ", Record=" + Record_ID);

View File

@ -36,7 +36,6 @@ import org.compiere.model.MBPartner;
import org.compiere.model.MClient; import org.compiere.model.MClient;
import org.compiere.model.MColumn; import org.compiere.model.MColumn;
import org.compiere.model.MConversionRate; import org.compiere.model.MConversionRate;
import org.compiere.model.MFactAcct;
import org.compiere.model.MMailText; import org.compiere.model.MMailText;
import org.compiere.model.MNote; import org.compiere.model.MNote;
import org.compiere.model.MOrg; import org.compiere.model.MOrg;
@ -54,7 +53,6 @@ import org.compiere.model.Query;
import org.compiere.model.X_AD_WF_Activity; import org.compiere.model.X_AD_WF_Activity;
import org.compiere.print.ReportEngine; import org.compiere.print.ReportEngine;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfo;
import org.compiere.process.StateEngine; import org.compiere.process.StateEngine;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
@ -77,7 +75,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
/** /**
* *
*/ */
private static final long serialVersionUID = 1584816335412184476L; private static final long serialVersionUID = -3282235931100223816L;
/** /**
* Get Activities for table/record * Get Activities for table/record
@ -232,8 +230,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
private String m_newValue = null; private String m_newValue = null;
/** Process */ /** Process */
private MWFProcess m_process = null; private MWFProcess m_process = null;
/** Post Immediate Candidate */
private DocAction m_postImmediate = null;
/** List of email recipients */ /** List of email recipients */
private ArrayList<String> m_emails = new ArrayList<String>(); private ArrayList<String> m_emails = new ArrayList<String>();
@ -805,13 +801,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
setWFState (done ? StateEngine.STATE_Completed : StateEngine.STATE_Suspended); setWFState (done ? StateEngine.STATE_Completed : StateEngine.STATE_Suspended);
//end vpj-cd e-evolution 03/08/2005 PostgreSQL
if (m_postImmediate != null)
try {
postImmediate();
} catch (Exception e) {
log.warning("Error posting document: " + e.toString());
} // ignore any error in this posting
} }
catch (Exception e) catch (Exception e)
{ {
@ -868,7 +857,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
private boolean performWork (Trx trx) throws Exception private boolean performWork (Trx trx) throws Exception
{ {
log.info (m_node + " [" + trx.getTrxName() + "]"); log.info (m_node + " [" + trx.getTrxName() + "]");
m_postImmediate = null;
m_docStatus = null; m_docStatus = null;
if (m_node.getPriority() != 0) // overwrite priority if defined if (m_node.getPriority() != 0) // overwrite priority if defined
setPriority(m_node.getPriority()); setPriority(m_node.getPriority());
@ -918,14 +906,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
m_process.setProcessMsg(e.getLocalizedMessage()); m_process.setProcessMsg(e.getLocalizedMessage());
throw e; throw e;
} }
// Post Immediate
if (success && DocAction.STATUS_Completed.equals(doc.getDocStatus()) && DocAction.ACTION_Complete.equals(m_node.getDocAction()))
{
MClient client = MClient.get(doc.getCtx(), doc.getAD_Client_ID());
if (client.isPostImmediate() || MClient.isClientAccountingImmediate())
m_postImmediate = doc;
}
//
if (m_process != null) if (m_process != null)
m_process.setProcessMsg(processMsg); m_process.setProcessMsg(processMsg);
} }
@ -1521,19 +1501,6 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
} // instance parameter loop } // instance parameter loop
} // fillParameter } // fillParameter
/**
* Post Immediate
*/
private void postImmediate()
{
if (MFactAcct.alreadyPosted(m_postImmediate.get_Table_ID(), m_postImmediate.get_ID(), m_postImmediate.get_TrxName()))
return;
String error = DocumentEngine.postImmediate(m_postImmediate.getCtx(),
m_postImmediate.getAD_Client_ID(), m_postImmediate.get_Table_ID(), m_postImmediate.get_ID(), true,
m_postImmediate.get_TrxName());
} // PostImmediate
/********************************* /*********************************
* Send EMail * Send EMail
*/ */

View File

@ -23,6 +23,7 @@ import java.util.logging.Level;
import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.IDColumn;
import org.compiere.minigrid.IMiniTable; import org.compiere.minigrid.IMiniTable;
import org.compiere.model.MClient;
import org.compiere.model.MInOutLine; import org.compiere.model.MInOutLine;
import org.compiere.model.MInvoiceLine; import org.compiere.model.MInvoiceLine;
import org.compiere.model.MMatchInv; import org.compiere.model.MMatchInv;
@ -30,11 +31,13 @@ import org.compiere.model.MMatchPO;
import org.compiere.model.MOrderLine; import org.compiere.model.MOrderLine;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MStorage; import org.compiere.model.MStorage;
import org.compiere.process.DocumentEngine;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Trx;
public class Match public class Match
{ {
@ -199,7 +202,14 @@ public class Match
} }
// Create it // Create it
createMatchRecord(invoice, M_InOutLine_ID, Line_ID, new BigDecimal(qty)); String innerTrxName = Trx.createTrxName("Match");
Trx innerTrx = Trx.get(innerTrxName, true);
if (createMatchRecord(invoice, M_InOutLine_ID, Line_ID, new BigDecimal(qty), innerTrxName))
innerTrx.commit();
else
innerTrx.rollback();
innerTrx.close();
innerTrx = null;
} }
} }
// requery // requery
@ -379,10 +389,11 @@ public class Match
* @param M_InOutLine_ID shipment line * @param M_InOutLine_ID shipment line
* @param Line_ID C_InvoiceLine_ID or C_OrderLine_ID * @param Line_ID C_InvoiceLine_ID or C_OrderLine_ID
* @param qty quantity * @param qty quantity
* @param trxName
* @return true if created * @return true if created
*/ */
protected boolean createMatchRecord (boolean invoice, int M_InOutLine_ID, int Line_ID, protected boolean createMatchRecord (boolean invoice, int M_InOutLine_ID, int Line_ID,
BigDecimal qty) BigDecimal qty, String trxName)
{ {
if (qty.compareTo(Env.ZERO) == 0) if (qty.compareTo(Env.ZERO) == 0)
return true; return true;
@ -391,11 +402,11 @@ public class Match
+ ", Qty=" + qty); + ", Qty=" + qty);
// //
boolean success = false; boolean success = false;
MInOutLine sLine = new MInOutLine (Env.getCtx(), M_InOutLine_ID, null); MInOutLine sLine = new MInOutLine (Env.getCtx(), M_InOutLine_ID, trxName);
if (invoice) // Shipment - Invoice if (invoice) // Shipment - Invoice
{ {
// Update Invoice Line // Update Invoice Line
MInvoiceLine iLine = new MInvoiceLine (Env.getCtx(), Line_ID, null); MInvoiceLine iLine = new MInvoiceLine (Env.getCtx(), Line_ID, trxName);
iLine.setM_InOutLine_ID(M_InOutLine_ID); iLine.setM_InOutLine_ID(M_InOutLine_ID);
if (sLine.getC_OrderLine_ID() != 0) if (sLine.getC_OrderLine_ID() != 0)
iLine.setC_OrderLine_ID(sLine.getC_OrderLine_ID()); iLine.setC_OrderLine_ID(sLine.getC_OrderLine_ID());
@ -405,8 +416,12 @@ public class Match
{ {
MMatchInv match = new MMatchInv (iLine, null, qty); MMatchInv match = new MMatchInv (iLine, null, qty);
match.setM_InOutLine_ID(M_InOutLine_ID); match.setM_InOutLine_ID(M_InOutLine_ID);
if (match.save()) if (match.save()) {
success = true; success = true;
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(match.getCtx(), match.getAD_Client_ID(), match.get_Table_ID(), match.get_ID(), true, match.get_TrxName());
}
}
else else
log.log(Level.SEVERE, "Inv Match not created: " + match); log.log(Level.SEVERE, "Inv Match not created: " + match);
} }
@ -420,6 +435,9 @@ public class Match
matchPO.setM_InOutLine_ID(M_InOutLine_ID); matchPO.setM_InOutLine_ID(M_InOutLine_ID);
if (!matchPO.save()) if (!matchPO.save())
log.log(Level.SEVERE, "PO(Inv) Match not created: " + matchPO); log.log(Level.SEVERE, "PO(Inv) Match not created: " + matchPO);
if (MClient.isClientAccountingImmediate()) {
String ignoreError = DocumentEngine.postImmediate(matchPO.getCtx(), matchPO.getAD_Client_ID(), matchPO.get_Table_ID(), matchPO.get_ID(), true, matchPO.get_TrxName());
}
} }
} }
else // Shipment - Order else // Shipment - Order
@ -428,7 +446,7 @@ public class Match
sLine.setC_OrderLine_ID(Line_ID); sLine.setC_OrderLine_ID(Line_ID);
sLine.save(); sLine.save();
// Update Order Line // Update Order Line
MOrderLine oLine = new MOrderLine(Env.getCtx(), Line_ID, null); MOrderLine oLine = new MOrderLine(Env.getCtx(), Line_ID, trxName);
if (oLine.get_ID() != 0) // other in MInOut.completeIt if (oLine.get_ID() != 0) // other in MInOut.completeIt
{ {
oLine.setQtyReserved(oLine.getQtyReserved().subtract(qty)); oLine.setQtyReserved(oLine.getQtyReserved().subtract(qty));
@ -451,7 +469,7 @@ public class Match
sLine.getM_Locator_ID(), sLine.getM_Locator_ID(),
sLine.getM_Product_ID(), sLine.getM_Product_ID(),
sLine.getM_AttributeSetInstance_ID(), oLine.getM_AttributeSetInstance_ID(), sLine.getM_AttributeSetInstance_ID(), oLine.getM_AttributeSetInstance_ID(),
null, null, qty.negate(), null); null, null, qty.negate(), trxName);
} }
} }
else else

View File

@ -0,0 +1,146 @@
-- Mar 13, 2010 11:54:49 PM COT
-- BF_2968442_Post without Application Server
UPDATE AD_Element SET Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.', Name='Post Immediately (Deprecated)',Updated=TO_DATE('2010-03-13 23:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:49 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:49 PM COT
UPDATE AD_Column SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.', AD_Element_ID=2843 WHERE UPPER(ColumnName)='ISPOSTIMMEDIATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Element_ID=2843 AND IsCentrallyMaintained='Y'
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Field SET Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2843) AND IsCentrallyMaintained='Y'
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_PrintFormatItem pi SET PrintName='Post Immediate', Name='Post Immediately (Deprecated)' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=pi.AD_Column_ID AND c.AD_Element_ID=2843)
;
-- Mar 13, 2010 11:55:40 PM COT
UPDATE AD_Field SET IsSameLine='N',Updated=TO_DATE('2010-03-13 23:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12326
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12327
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=317
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=318
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=319
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=10318
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=5160
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=5759
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=11025
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=11205
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=3813
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=5887
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=5161
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=5162
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=5163
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=5164
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=12099
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=12098
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11024
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=12326
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=50158
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=50159
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=50160
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=50184
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=50185
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=50186
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54238
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=54680
;

View File

@ -0,0 +1,146 @@
-- Mar 13, 2010 11:54:49 PM COT
-- BF_2968442_Post without Application Server
UPDATE AD_Element SET Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.', Name='Post Immediately (Deprecated)',Updated=TO_TIMESTAMP('2010-03-13 23:54:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:49 PM COT
UPDATE AD_Element_Trl SET IsTranslated='N' WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:49 PM COT
UPDATE AD_Column SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Element_ID=2843
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.', AD_Element_ID=2843 WHERE UPPER(ColumnName)='ISPOSTIMMEDIATE' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Process_Para SET ColumnName='IsPostImmediate', Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Element_ID=2843 AND IsCentrallyMaintained='Y'
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_Field SET Name='Post Immediately (Deprecated)', Description='Post the accounting immediately for testing (Deprecated)', Help='If selected, the accounting consequences are immediately generated when completing a document. Otherwise the document is posted by a batch process. You should select this only if you are testing.
Deprecated column - use instead the functionality Client Accounting.' WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=2843) AND IsCentrallyMaintained='Y'
;
-- Mar 13, 2010 11:54:50 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Post Immediate', Name='Post Immediately (Deprecated)' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=2843)
;
-- Mar 13, 2010 11:55:40 PM COT
UPDATE AD_Field SET IsSameLine='N',Updated=TO_TIMESTAMP('2010-03-13 23:55:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12326
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12327
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=317
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=318
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=319
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=10318
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=5160
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=70,IsDisplayed='Y' WHERE AD_Field_ID=5759
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=11025
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=11205
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=3813
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=5887
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=5161
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=5162
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=5163
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=5164
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=12099
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=170,IsDisplayed='Y' WHERE AD_Field_ID=12098
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=180,IsDisplayed='Y' WHERE AD_Field_ID=11024
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=12326
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=50158
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=50159
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=50160
;
-- Mar 13, 2010 11:55:55 PM COT
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=50184
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=50185
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=50186
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54238
;
-- Mar 13, 2010 11:55:56 PM COT
UPDATE AD_Field SET SeqNo=270,IsDisplayed='Y' WHERE AD_Field_ID=54680
;