Fixes Issue 26838: Unpaged request in Financial Account Transaction
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Mon, 23 Jun 2014 15:59:11 +0530
changeset 23856 0043e948d053
parent 23855 ae57ca1f99dc
child 23857 bc7151f88085
Fixes Issue 26838: Unpaged request in Financial Account Transaction

Perform form refresh after completing button action only if current form is valid.
In the issue, we are deleting the record using the button, so the form present after the delete action is invalid
resulting in fetch with incorrect critieria to the server.
The problems happens only in form view, as refresh grid is done with proper criteria.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Fri Jun 20 15:52:00 2014 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Mon Jun 23 15:59:11 2014 +0530
@@ -1903,7 +1903,12 @@
       if (refreshCallback) {
         refreshCallback();
       }
-      me.viewForm.refresh();
+      // only perform refresh if the viewForm has a valid record.
+      // else a request is not done with incomplete criteria which results in non paginated request.
+      // Refer issue https://issues.openbravo.com/view.php?id=26838
+      if (me.viewForm.getValues()[OB.Constants.ID]) {
+        me.viewForm.refresh();
+      }
     };
 
     if (!newRecordsToBeIncluded) {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri Jun 20 15:52:00 2014 +0000
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Mon Jun 23 15:59:11 2014 +0530
@@ -44,6 +44,7 @@
 import org.openbravo.database.SessionInfo;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.service.json.JsonToDataConverter.JsonConversionError;
+import org.openbravo.userinterface.selector.SelectorConstants;
 
 /**
  * Implements generic data operations which have parameters and json as an input and return results
@@ -371,8 +372,8 @@
       log.warn("Fetching data without pagination, this can cause perfomance issues. Parameters: "
           + paramMsg);
 
-      if (parameters.containsKey(JsonConstants.TAB_PARAMETER)) {
-        // || parameters.containsKey(SelectorConstants.DS_REQUEST_SELECTOR_ID_PARAMETER)
+      if (parameters.containsKey(JsonConstants.TAB_PARAMETER)
+          || parameters.containsKey(SelectorConstants.DS_REQUEST_SELECTOR_ID_PARAMETER)) {
         // FIXME: Some selectors working in 2.50 windows are incorrectly unpaged (see issue #26734)
         // for now we are not preventing unpaged selector requests till this issue is properly fixed
         // after that they should be prevented again