BF [2785633] - Adding a Notice in Alert Processor
Surround transaction with try/catch
This commit is contained in:
parent
d39d2a0869
commit
46c49edca8
|
@ -263,8 +263,10 @@ public class AlertProcessor extends AdempiereServer
|
|||
}
|
||||
}
|
||||
|
||||
Trx trx = Trx.get(Trx.createTrxName("AP_NU"), true);
|
||||
if (user.isNotificationNote()) {
|
||||
Trx trx = null;
|
||||
try {
|
||||
trx = Trx.get(Trx.createTrxName("AP_NU"), true);
|
||||
// Notice
|
||||
int AD_Message_ID = 52244; /* Hardcoded message=notes */
|
||||
MNote note = new MNote(getCtx(), AD_Message_ID, user_id, trx.getTrxName());
|
||||
|
@ -279,9 +281,14 @@ public class AlertProcessor extends AdempiereServer
|
|||
attachment.setTextMsg(message);
|
||||
attachment.saveEx();
|
||||
countMail++;
|
||||
}
|
||||
trx.commit();
|
||||
trx.close();
|
||||
} catch (Throwable e) {
|
||||
if (trx != null) trx.rollback();
|
||||
} finally {
|
||||
if (trx != null) trx.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return countMail;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue