details:   https://code.openbravo.com/erp/devel/pi/rev/ff40e616d7eb
changeset: 25563:ff40e616d7eb
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Dec 17 10:34:10 2014 +0100
summary:   related to bug 28431, related to bug 26386: revert previous changeset

  Removing previuos changeset to fix issue 26386 because it causes 28431

details:   https://code.openbravo.com/erp/devel/pi/rev/802c2c259fb8
changeset: 25564:802c2c259fb8
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Dec 17 11:15:15 2014 +0100
summary:   fixed bug 28431, fixed bug 26386: fixed button display logic

  It takes into account whether current view is grid or tree

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
 |  25 +++------
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
       |   3 +-
 2 files changed, 11 insertions(+), 17 deletions(-)

diffs (67 lines):

diff -r 83546adbc105 -r 802c2c259fb8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
      Wed Nov 26 23:32:57 2014 -0500
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
      Wed Dec 17 11:15:15 2014 +0100
@@ -245,22 +245,18 @@
   },
 
   updateState: function (record, hide, context, keepNonAutosave) {
-    var hideButton, currentValues = isc.shallowClone(record || 
this.contextView.getCurrentValues() || {});
+    var currentValues = isc.shallowClone(record || 
this.contextView.getCurrentValues() || {}),
+        grid;
     // do not hide non autosave buttons when hidding the rest if 
keepNonAutosave === true
-    if (this.contextView.isShowingTree) {
-      hideButton = hide && (!keepNonAutosave || this.autosave) && 
this.contextView.treeGrid.getSelectedRecords().length > 1;
-    } else {
-      hideButton = hide && (!keepNonAutosave || this.autosave) && 
this.contextView.viewGrid.getSelectedRecords().length > 1;
-    }
+    var hideButton = hide && (!keepNonAutosave || this.autosave);
+
     var multiSelect = false,
         readonly, i, selection;
 
+    grid = this.contextView.isShowingTree ? this.contextView.treeGrid : 
this.contextView.viewGrid;
+
     if (hideButton || !record) {
-      if (this.contextView.isShowingTree) {
-        multiSelect = this.multiRecord || 
this.contextView.treeGrid.getSelectedRecords().length > 1;
-      } else {
-        multiSelect = this.multiRecord || 
this.contextView.viewGrid.getSelectedRecords().length > 1;
-      }
+      multiSelect = this.multiRecord && grid.getSelectedRecords().length > 1;
       if (!multiSelect) {
         this.hide();
         return;
@@ -269,6 +265,7 @@
 
     context = context || this.contextView.getContextInfo(false, true, true);
 
+
     if (!multiSelect) {
       OB.Utilities.fixNull250(currentValues);
       OB.Utilities.fixNull250(context);
@@ -297,11 +294,7 @@
       // For multi selection processes:
       //   -Button is displayed in case it should be displayed in ALL selected 
records
       //   -Button is readonly in case it should be readonly in ALL sected 
records
-      if (this.contextView.isShowingTree) {
-        selection = this.contextView.treeGrid.getSelectedRecords();
-      } else {
-        selection = this.contextView.viewGrid.getSelectedRecords();
-      }
+      selection = grid.getSelectedRecords();
       readonly = false;
       this.visible = true;
       for (i = 0; i < selection.length; i++) {
diff -r 83546adbc105 -r 802c2c259fb8 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Wed Nov 26 23:32:57 2014 -0500
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Wed Dec 17 11:15:15 2014 +0100
@@ -1253,7 +1253,8 @@
       // This is needed to prevent JSLint complaining about "Don't make 
functions within a loop.
       callbackHandler = function (currentContext, me) {
         return function (response, data, request) {
-          var noneOrMultipleRecordsSelected = 
currentContext.viewGrid.getSelectedRecords().length !== 1;
+          var grid = currentContext.isShowingTree ? currentContext.treeGrid : 
currentContext.viewGrid,
+              noneOrMultipleRecordsSelected = grid.getSelectedRecords().length 
!== 1;
           var sessionAttributes = data.sessionAttributes,
               auxInputs = data.auxiliaryInputValues,
               attachmentExists = data.attachmentExists,

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to