details: https://code.openbravo.com/erp/devel/pi/rev/6fa4003bddbe changeset: 33639:6fa4003bddbe user: Mark <markmm82 <at> gmail.com> date: Mon Mar 05 12:10:20 2018 -0500 summary: Fixes issue 37963: Payment in Awaiting payment status is created when an invoice cannot be voided because document cancelled is a return
A commit and close was performed at the end of the invoice processing to get the error message from the database, but it left all previously created data into the database just like the dummy payment when it is needed is to rollback the changes. If at the end of processing there is some error then a rollback is performed. Also the message is created from the pinstance object instead of retrieve the Instance data from the database. diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java | 12 +++++----- 1 files changed, 6 insertions(+), 6 deletions(-) diffs (37 lines): diff -r 5dbcb5394a22 -r 6fa4003bddbe modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java Thu Mar 01 18:45:40 2018 -0500 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java Mon Mar 05 12:10:20 2018 -0500 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2017 Openbravo SLU + * All portions are Copyright (C) 2010-2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************* @@ -544,12 +544,11 @@ OBContext.setAdminMode(); try { - // on error close popup + // on error close popup and rollback if (pinstance.getResult() == 0L) { - OBDal.getInstance().commitAndClose(); - final PInstanceProcessData[] pinstanceData = PInstanceProcessData.select(this, - pinstance.getId()); - myMessage = Utility.getProcessInstanceMessage(this, vars, pinstanceData); + OBDal.getInstance().rollbackAndClose(); + myMessage = Utility.translateError(this, vars, vars.getLanguage(), pinstance + .getErrorMsg().replaceFirst("@ERROR=", "")); log4j.debug(myMessage.getMessage()); vars.setMessage(strTabId, myMessage); @@ -557,6 +556,7 @@ if (strWindowPath.equals("")) strWindowPath = strDefaultServlet; printPageClosePopUp(response, vars, strWindowPath); + return; } } finally { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits