From 4e7e2a32445b12414d2779ebe99e113f1c970158 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 28 Apr 2008 20:06:00 +0000 Subject: [PATCH] Fix [ 1953628 ] Form WFActivity running out of transaction --- .../src/org/compiere/apps/wf/WFActivity.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/client/src/org/compiere/apps/wf/WFActivity.java b/client/src/org/compiere/apps/wf/WFActivity.java index 0e93522856..701cdd0caf 100644 --- a/client/src/org/compiere/apps/wf/WFActivity.java +++ b/client/src/org/compiere/apps/wf/WFActivity.java @@ -597,6 +597,11 @@ public class WFActivity extends CPanel MWFNode node = m_activity.getNode(); Object forward = fForward.getValue(); + + // ensure activity is ran within a transaction - [ 1953628 ] + Trx trx = Trx.get(Trx.createTrxName("FWFA"), true); + m_activity.set_TrxName(trx.getTrxName()); + if (forward != null) { log.config("Forward to " + forward); @@ -604,11 +609,15 @@ public class WFActivity extends CPanel if (fw == AD_User_ID || fw == 0) { log.log(Level.SEVERE, "Forward User=" + fw); + trx.rollback(); + trx.close(); return; } if (!m_activity.forwardTo(fw, textMsg)) { ADialog.error(m_WindowNo, this, "CannotForward"); + trx.rollback(); + trx.close(); return; } } @@ -628,6 +637,8 @@ public class WFActivity extends CPanel if (value == null || value.length() == 0) { ADialog.error(m_WindowNo, this, "FillMandatory", Msg.getMsg(Env.getCtx(), "Answer")); + trx.rollback(); + trx.close(); return; } // @@ -640,6 +651,8 @@ public class WFActivity extends CPanel { log.log(Level.SEVERE, node.getName(), e); ADialog.error(m_WindowNo, this, "Error", e.toString()); + trx.rollback(); + trx.close(); return; } } @@ -649,16 +662,24 @@ public class WFActivity extends CPanel log.config("Action=" + node.getAction() + " - " + textMsg); try { + // ensure activity is ran within a transaction + m_activity.set_TrxName(Trx.createTrxName("FWFA")); m_activity.setUserConfirmation(AD_User_ID, textMsg); } catch (Exception e) { log.log(Level.SEVERE, node.getName(), e); ADialog.error(m_WindowNo, this, "Error", e.toString()); + trx.rollback(); + trx.close(); return; } } + + trx.commit(); + trx.close(); + // Next loadActivities(); display();