Fixes issue 28668: Pressing Cancel in Match Statement or in Process Reconciliation does not trigger a refresh.
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Wed, 29 Apr 2015 17:33:40 +0200
changeset 26392 5e2441fc0b3c
parent 26391 7c3c564c8591
child 26393 549146dc9be2
Fixes issue 28668: Pressing Cancel in Match Statement or in Process Reconciliation does not trigger a refresh.
Cancel button has been removed as it was considered confusing. Now there are two buttons, one for closing the window called 'OK', as it was before, and another one called 'Reconcile'.

Both triggers refresh. Messages have been added to improve user understanding on how the window works. New message to inform the user any change will be persisted. This message can be disabled once clear and will not popup again. Message to run algorithm as well improved.
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementActionHandler.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementOnLoadGetPreferenceActionHandler.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementOnLoadPreferenceActionHandler.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Apr 29 17:33:40 2015 +0200
@@ -1502,6 +1502,18 @@
 <!--EDB9CF491555465382F828F48291A0C0-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--EDB9CF491555465382F828F48291A0C0--></AD_ELEMENT>
 
+<!--EF3508748A6A42C186F6709D68728306--><AD_ELEMENT>
+<!--EF3508748A6A42C186F6709D68728306-->  <AD_ELEMENT_ID><![CDATA[EF3508748A6A42C186F6709D68728306]]></AD_ELEMENT_ID>
+<!--EF3508748A6A42C186F6709D68728306-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--EF3508748A6A42C186F6709D68728306-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--EF3508748A6A42C186F6709D68728306-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--EF3508748A6A42C186F6709D68728306-->  <COLUMNNAME><![CDATA[actions]]></COLUMNNAME>
+<!--EF3508748A6A42C186F6709D68728306-->  <NAME><![CDATA[Actions]]></NAME>
+<!--EF3508748A6A42C186F6709D68728306-->  <PRINTNAME><![CDATA[Actions]]></PRINTNAME>
+<!--EF3508748A6A42C186F6709D68728306-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--EF3508748A6A42C186F6709D68728306-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--EF3508748A6A42C186F6709D68728306--></AD_ELEMENT>
+
 <!--F109FCAF8CC1462AB2A94F73F4E51EA7--><AD_ELEMENT>
 <!--F109FCAF8CC1462AB2A94F73F4E51EA7-->  <AD_ELEMENT_ID><![CDATA[F109FCAF8CC1462AB2A94F73F4E51EA7]]></AD_ELEMENT_ID>
 <!--F109FCAF8CC1462AB2A94F73F4E51EA7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Apr 29 17:33:40 2015 +0200
@@ -835,7 +835,7 @@
 <!--8FC3C9524EE54E518B679D58F709119D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--8FC3C9524EE54E518B679D58F709119D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8FC3C9524EE54E518B679D58F709119D-->  <VALUE><![CDATA[APRM_AlgorithmConfirm]]></VALUE>
-<!--8FC3C9524EE54E518B679D58F709119D-->  <MSGTEXT><![CDATA[Do you want the algorithm to be run against unmatched bank statement lines?]]></MSGTEXT>
+<!--8FC3C9524EE54E518B679D58F709119D-->  <MSGTEXT><![CDATA[Do you want the algorithm to be run against unmatched bank statement lines? This process may create transactions which will be saved in the system.]]></MSGTEXT>
 <!--8FC3C9524EE54E518B679D58F709119D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--8FC3C9524EE54E518B679D58F709119D-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--8FC3C9524EE54E518B679D58F709119D-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
@@ -1267,7 +1267,7 @@
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <VALUE><![CDATA[APRM_GRID_PERSIST_MESSAGE]]></VALUE>
-<!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <MSGTEXT><![CDATA[All the changes you make in this grid will be immediately saved]]></MSGTEXT>
+<!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <MSGTEXT><![CDATA[All the changes done in this grid will be immediately saved.]]></MSGTEXT>
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--CE54F0E4ABA846C9BA9E5A91CF38BE09-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Wed Apr 29 17:33:40 2015 +0200
@@ -325,6 +325,18 @@
 <!--C1B4345A1F8841C2B1ADD403CA733D75-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--C1B4345A1F8841C2B1ADD403CA733D75--></AD_REFERENCE>
 
+<!--C20E5E22588E40E5B8CC6D80ED3015C5--><AD_REFERENCE>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <AD_REFERENCE_ID><![CDATA[C20E5E22588E40E5B8CC6D80ED3015C5]]></AD_REFERENCE_ID>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <NAME><![CDATA[Match Statement Actions]]></NAME>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <PARENTREFERENCE_ID><![CDATA[FF80818132F94B500132F9575619000A]]></PARENTREFERENCE_ID>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--C20E5E22588E40E5B8CC6D80ED3015C5--></AD_REFERENCE>
+
 <!--DA5377445D8D468DB17743F8082B3CFD--><AD_REFERENCE>
 <!--DA5377445D8D468DB17743F8082B3CFD-->  <AD_REFERENCE_ID><![CDATA[DA5377445D8D468DB17743F8082B3CFD]]></AD_REFERENCE_ID>
 <!--DA5377445D8D468DB17743F8082B3CFD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Wed Apr 29 17:33:40 2015 +0200
@@ -143,6 +143,18 @@
 <!--4A647396E4CE4E8B90D58E9FE4C12BBA-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--4A647396E4CE4E8B90D58E9FE4C12BBA--></AD_REF_LIST>
 
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC--><AD_REF_LIST>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <AD_REF_LIST_ID><![CDATA[4E4F2CBB72A3451B9F4BFB2540F517CC]]></AD_REF_LIST_ID>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <VALUE><![CDATA[OK]]></VALUE>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <NAME><![CDATA[OK]]></NAME>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <AD_REFERENCE_ID><![CDATA[C20E5E22588E40E5B8CC6D80ED3015C5]]></AD_REFERENCE_ID>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--4E4F2CBB72A3451B9F4BFB2540F517CC--></AD_REF_LIST>
+
 <!--52459CE549F14B35B4566E34426D79CD--><AD_REF_LIST>
 <!--52459CE549F14B35B4566E34426D79CD-->  <AD_REF_LIST_ID><![CDATA[52459CE549F14B35B4566E34426D79CD]]></AD_REF_LIST_ID>
 <!--52459CE549F14B35B4566E34426D79CD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -436,6 +448,18 @@
 <!--C5D1596D065545B49156C1F9426C9E14-->  <SEQNO><![CDATA[30]]></SEQNO>
 <!--C5D1596D065545B49156C1F9426C9E14--></AD_REF_LIST>
 
+<!--C69982184F634AC79728338D1F327B76--><AD_REF_LIST>
+<!--C69982184F634AC79728338D1F327B76-->  <AD_REF_LIST_ID><![CDATA[C69982184F634AC79728338D1F327B76]]></AD_REF_LIST_ID>
+<!--C69982184F634AC79728338D1F327B76-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C69982184F634AC79728338D1F327B76-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C69982184F634AC79728338D1F327B76-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C69982184F634AC79728338D1F327B76-->  <VALUE><![CDATA[RE]]></VALUE>
+<!--C69982184F634AC79728338D1F327B76-->  <NAME><![CDATA[Reconcile]]></NAME>
+<!--C69982184F634AC79728338D1F327B76-->  <AD_REFERENCE_ID><![CDATA[C20E5E22588E40E5B8CC6D80ED3015C5]]></AD_REFERENCE_ID>
+<!--C69982184F634AC79728338D1F327B76-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C69982184F634AC79728338D1F327B76-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--C69982184F634AC79728338D1F327B76--></AD_REF_LIST>
+
 <!--D82326E588CB4BF685FAE03B5097B108--><AD_REF_LIST>
 <!--D82326E588CB4BF685FAE03B5097B108-->  <AD_REF_LIST_ID><![CDATA[D82326E588CB4BF685FAE03B5097B108]]></AD_REF_LIST_ID>
 <!--D82326E588CB4BF685FAE03B5097B108-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Apr 29 17:33:40 2015 +0200
@@ -1656,6 +1656,29 @@
 <!--C511B1965C2A46C2BD8144DB918CD17B-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--C511B1965C2A46C2BD8144DB918CD17B--></OBUIAPP_PARAMETER>
 
+<!--C722D23258B64E50A9137C73598C418F--><OBUIAPP_PARAMETER>
+<!--C722D23258B64E50A9137C73598C418F-->  <OBUIAPP_PARAMETER_ID><![CDATA[C722D23258B64E50A9137C73598C418F]]></OBUIAPP_PARAMETER_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <NAME><![CDATA[Actions]]></NAME>
+<!--C722D23258B64E50A9137C73598C418F-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_REFERENCE_ID><![CDATA[FF80818132F94B500132F9575619000A]]></AD_REFERENCE_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_REFERENCE_VALUE_ID><![CDATA[C20E5E22588E40E5B8CC6D80ED3015C5]]></AD_REFERENCE_VALUE_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <COLUMNNAME><![CDATA[actions]]></COLUMNNAME>
+<!--C722D23258B64E50A9137C73598C418F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--C722D23258B64E50A9137C73598C418F-->  <FIELDLENGTH><![CDATA[30]]></FIELDLENGTH>
+<!--C722D23258B64E50A9137C73598C418F-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--C722D23258B64E50A9137C73598C418F-->  <AD_ELEMENT_ID><![CDATA[EF3508748A6A42C186F6709D68728306]]></AD_ELEMENT_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--C722D23258B64E50A9137C73598C418F-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--C722D23258B64E50A9137C73598C418F-->  <OBUIAPP_PROCESS_ID><![CDATA[86F0B1EBE2BC48E3ACF458768D14CC99]]></OBUIAPP_PROCESS_ID>
+<!--C722D23258B64E50A9137C73598C418F-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--C722D23258B64E50A9137C73598C418F-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--C722D23258B64E50A9137C73598C418F-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--C722D23258B64E50A9137C73598C418F--></OBUIAPP_PARAMETER>
+
 <!--D2F76322DF994A58B49D62E79944C219--><OBUIAPP_PARAMETER>
 <!--D2F76322DF994A58B49D62E79944C219-->  <OBUIAPP_PARAMETER_ID><![CDATA[D2F76322DF994A58B49D62E79944C219]]></OBUIAPP_PARAMETER_ID>
 <!--D2F76322DF994A58B49D62E79944C219-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementActionHandler.java	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementActionHandler.java	Wed Apr 29 17:33:40 2015 +0200
@@ -39,20 +39,22 @@
 
 public class MatchStatementActionHandler extends BaseProcessActionHandler {
   private static final Logger log = LoggerFactory.getLogger(MatchStatementActionHandler.class);
+  private static final String OK_ACTION = "OK";
 
   @Override
   protected JSONObject doExecute(Map<String, Object> parameters, String content) {
     JSONObject jsonResponse = new JSONObject();
-    String strReconciliationId = null;
     OBContext.setAdminMode(true);
     try {
       JSONObject jsonRequest = new JSONObject(content);
       final String strFinancialAccount = jsonRequest.getString("Fin_Financial_Account_ID");
+      final String action = jsonRequest.getString("_buttonValue");
+      if (OK_ACTION.equals(action))
+        return jsonResponse;
       final FIN_FinancialAccount finAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
           strFinancialAccount);
       final FIN_Reconciliation lastReconciliation = TransactionsDao.getLastReconciliation(
           finAccount, "N");
-      strReconciliationId = lastReconciliation.getId();
       if (APRM_MatchingUtility.updateReconciliation(lastReconciliation, finAccount, true)) {
         final VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
         final JSONObject msg = new JSONObject();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementOnLoadGetPreferenceActionHandler.java	Wed Apr 29 17:33:40 2015 +0200
@@ -0,0 +1,60 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBQuery;
+import org.openbravo.model.ad.domain.Preference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MatchStatementOnLoadGetPreferenceActionHandler extends BaseActionHandler {
+  private static final Logger log = LoggerFactory
+      .getLogger(MatchStatementOnLoadGetPreferenceActionHandler.class);
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String content) {
+    JSONObject jsonResponse = new JSONObject();
+    try {
+      OBContext.setAdminMode(true);
+      StringBuffer whereClause = new StringBuffer();
+      whereClause.append(" as p ");
+      whereClause.append(" where p.userContact.id = '")
+          .append(OBContext.getOBContext().getUser().getId()).append("' ");
+      whereClause.append("   and p.attribute = 'APRM_NoPersistInfoMessageInMatching' ");
+      OBQuery<Preference> query = OBDal.getInstance().createQuery(Preference.class,
+          whereClause.toString());
+      for (Preference preference : query.list()) {
+        jsonResponse.put("preference", preference.getSearchKey());
+        return jsonResponse;
+      }
+    } catch (JSONException e) {
+      log.error("Preference could not be loaded", e);
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return jsonResponse;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/MatchStatementOnLoadPreferenceActionHandler.java	Wed Apr 29 17:33:40 2015 +0200
@@ -0,0 +1,57 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.provider.OBProvider;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.ad.domain.Preference;
+import org.openbravo.model.common.enterprise.Organization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MatchStatementOnLoadPreferenceActionHandler extends BaseActionHandler {
+  private static final Logger log = LoggerFactory
+      .getLogger(MatchStatementOnLoadPreferenceActionHandler.class);
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String content) {
+    JSONObject jsonResponse = new JSONObject();
+    try {
+      OBContext.setAdminMode(true);
+      Preference userPreference = OBProvider.getInstance().get(Preference.class);
+      userPreference.setNewOBObject(true);
+      userPreference.setOrganization(OBDal.getInstance().get(Organization.class, "0"));
+      userPreference.setClient(OBContext.getOBContext().getCurrentClient());
+      userPreference.setUserContact(OBContext.getOBContext().getUser());
+      userPreference.setSearchKey("Y");
+      userPreference.setPropertyList(false);
+      userPreference.setAttribute("APRM_NoPersistInfoMessageInMatching");
+      OBDal.getInstance().save(userPreference);
+      OBDal.getInstance().flush();
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return jsonResponse;
+  }
+}
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/UnMatchTransactionActionHandler.java	Wed Apr 29 17:33:40 2015 +0200
@@ -70,7 +70,6 @@
         throw new OBStaleObjectException("@APRM_StaleDate@");
       }
       final FIN_FinaccTransaction transaction = bsline.getFinancialAccountTransaction();
-
       if (transaction != null) {
         APRM_MatchingUtility.unmatch(bsline);
       }
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-matchStatement.js	Wed Apr 29 17:33:40 2015 +0200
@@ -19,9 +19,16 @@
 
 OB.APRM.MatchStatement = {};
 
+OB.APRM.MatchStatement.addPreference = function (view) {
+  var onLoadCallback;
+  onLoadCallback = function (response, data, request) {};
+  OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.MatchStatementOnLoadPreferenceActionHandler', {}, {}, onLoadCallback);
+};
 
 OB.APRM.MatchStatement.onLoad = function (view) {
   var execute, grid = view.theForm.getItem('match_statement').canvas.viewGrid;
+  view.cancelButton.hide();
+  view.parentElement.parentElement.closeButton.hide();
 
   grid.dataSourceOrig = grid.dataSource;
   grid.dataSource = null;
@@ -40,10 +47,16 @@
       grid.filterByEditor();
     };
     OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.MatchStatementOnLoadActionHandler', {}, params, onLoadCallback);
-    if (grid && grid.parentElement && grid.parentElement.messageBar && grid.parentElement.messageBar.text && grid.parentElement.messageBar.text.contents) {
-      grid.parentElement.messageBar.text.setContents(grid.parentElement.messageBar.text.contents.replace(OB.I18N.getLabel('OBUIAPP_ClearFilters'), OB.I18N.getLabel('OBUIAPP_ClearFilters') + '<br/>' + OB.I18N.getLabel('APRM_GRID_PERSIST_MESSAGE')));
-    }
   };
+  if (grid && grid.parentElement && grid.parentElement.messageBar) {
+    var onLoadCallback;
+    onLoadCallback = function (response, data, request) {
+      if (!data.preference) {
+        grid.parentElement.messageBar.setMessage(isc.OBMessageBar.TYPE_INFO, '<div><div class="' + OB.Styles.MessageBar.leftMsgContainerStyle + '">' + OB.I18N.getLabel('APRM_GRID_PERSIST_MESSAGE') + '</div><div class="' + OB.Styles.MessageBar.rightMsgContainerStyle + '"><a href="#" class="' + OB.Styles.MessageBar.rightMsgTextStyle + '" onclick="' + 'window[\'' + grid.parentElement.messageBar.ID + '\'].hide(); OB.APRM.MatchStatement.addPreference();">' + OB.I18N.getLabel('OBUIAPP_NeverShowMessageAgain') + '</a></div></div>', ' ');
+      }
+    };
+    OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.MatchStatementOnLoadGetPreferenceActionHandler', {}, {}, onLoadCallback);
+  }
   isc.confirm(OB.I18N.getLabel('APRM_AlgorithmConfirm'), execute);
 };
 
@@ -57,16 +70,7 @@
 };
 
 OB.APRM.MatchStatement.onProcess = function (view, actionHandlerCall, clientSideValidationFail) {
-  var execute;
-  execute = function (ok) {
-    if (ok) {
-      actionHandlerCall();
-    } else {
-      view.parentElement.parentElement.closeClick();
-    }
-  };
-  isc.confirm(OB.I18N.getLabel('APRM_ProcessReconciliation'), execute);
-
+  actionHandlerCall();
 };
 
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Wed Apr 29 18:21:34 2015 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Wed Apr 29 17:33:40 2015 +0200
@@ -160,7 +160,7 @@
     }
 
     if (this.popup) {
-      cancelButton = isc.OBFormButton.create({
+      this.cancelButton = isc.OBFormButton.create({
         process: this,
         title: OB.I18N.getLabel('OBUISC_Dialog.CANCEL_BUTTON_TITLE'),
         realTitle: '',
@@ -172,11 +172,11 @@
           }
         }
       });
-      buttonLayout.push(cancelButton);
+      buttonLayout.push(this.cancelButton);
       buttonLayout.push(isc.LayoutSpacer.create({}));
-      OB.TestRegistry.register('org.openbravo.client.application.ParameterWindow_Cancel_Button_' + this.processId, cancelButton);
+      OB.TestRegistry.register('org.openbravo.client.application.ParameterWindow_Cancel_Button_' + this.processId, this.cancelButton);
       // TODO: check if this is used, and remove as it is already registered
-      OB.TestRegistry.register('org.openbravo.client.application.process.pickandexecute.button.cancel', cancelButton);
+      OB.TestRegistry.register('org.openbravo.client.application.process.pickandexecute.button.cancel', this.cancelButton);
     }
 
     if (!this.popup) {