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,6 +703,7 @@ public abstract class SvrProcess implements ProcessCall
if (log.isLoggable(Level.FINE)) log.fine("AD_PInstance_ID=" + m_pi.getAD_PInstance_ID()); if (log.isLoggable(Level.FINE)) log.fine("AD_PInstance_ID=" + m_pi.getAD_PInstance_ID());
try try
{ {
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=" DB.executeUpdate("UPDATE AD_PInstance SET IsProcessing='Y' WHERE AD_PInstance_ID="
+ m_pi.getAD_PInstance_ID(), null); // outside trx + m_pi.getAD_PInstance_ID(), null); // outside trx
} catch (Exception e) } catch (Exception e)
@ -728,10 +729,11 @@ public abstract class SvrProcess implements ProcessCall
if (Thread.currentThread().isInterrupted()) if (Thread.currentThread().isInterrupted())
Thread.interrupted(); Thread.interrupted();
if(m_pi.getAD_PInstance_ID() > 0) {
MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null); MPInstance mpi = new MPInstance (getCtx(), m_pi.getAD_PInstance_ID(), null);
if (mpi.get_ID() == 0) if (mpi.get_ID() == 0)
{ {
log.log(Level.SEVERE, "Did not find PInstance " + m_pi.getAD_PInstance_ID()); log.log(Level.INFO, "Did not find PInstance " + m_pi.getAD_PInstance_ID());
return; return;
} }
mpi.setIsProcessing(false); mpi.setIsProcessing(false);
@ -742,6 +744,7 @@ public abstract class SvrProcess implements ProcessCall
ProcessInfoUtil.saveLogToDB(m_pi); ProcessInfoUtil.saveLogToDB(m_pi);
} }
}
catch (Exception e) catch (Exception e)
{ {
log.severe("unlock() - " + e.getLocalizedMessage()); log.severe("unlock() - " + e.getLocalizedMessage());