IDEMPIERE-5754 - Check PInstance_ID before Process Lock DB Update, PInstance 0 on createPricelist (#1874)

* IDEMPIERE-5754 - Check PInstance_ID before Process Lock DB Update, PInstance 0 on createPricelist

* IDEMPIERE-5754 - improve AD_PInstance_ID check on SvrProcess unlock

* IDEMPIERE-5754 - revert legacy check
This commit is contained in:
Peter Takács 2023-06-07 10:59:18 +02:00 committed by GitHub
parent 4b445e3107
commit f832d496e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 15 deletions

View File

@ -703,8 +703,9 @@ public abstract class SvrProcess implements ProcessCall
if (log.isLoggable(Level.FINE)) log.fine("AD_PInstance_ID=" + m_pi.getAD_PInstance_ID());
try
{
DB.executeUpdate("UPDATE AD_PInstance SET IsProcessing='Y' WHERE AD_PInstance_ID="
+ m_pi.getAD_PInstance_ID(), null); // outside trx
if(m_pi.getAD_PInstance_ID() > 0) // Update only when AD_PInstance_ID > 0 (When we Start Process w/o saving process instance (No Process Audit))
DB.executeUpdate("UPDATE AD_PInstance SET IsProcessing='Y' WHERE AD_PInstance_ID="
+ m_pi.getAD_PInstance_ID(), null); // outside trx
} catch (Exception e)
{
log.severe("lock() - " + e.getLocalizedMessage());
@ -727,20 +728,22 @@ public abstract class SvrProcess implements ProcessCall
//clear interrupt signal so that we can unlock the ad_pinstance record
if (Thread.currentThread().isInterrupted())
Thread.interrupted();
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0)
{
log.log(Level.SEVERE, "Did not find PInstance " + m_pi.getAD_PInstance_ID());
return;
}
mpi.setIsProcessing(false);
mpi.setResult(!m_pi.isError());
mpi.setErrorMsg(m_pi.getSummary());
mpi.saveEx();
if (log.isLoggable(Level.FINE)) log.fine(mpi.toString());
ProcessInfoUtil.saveLogToDB(m_pi);
if(m_pi.getAD_PInstance_ID() > 0) {
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0)
{
log.log(Level.INFO, "Did not find PInstance " + m_pi.getAD_PInstance_ID());
return;
}
mpi.setIsProcessing(false);
mpi.setResult(!m_pi.isError());
mpi.setErrorMsg(m_pi.getSummary());
mpi.saveEx();
if (log.isLoggable(Level.FINE)) log.fine(mpi.toString());
ProcessInfoUtil.saveLogToDB(m_pi);
}
}
catch (Exception e)
{