Fixes issue 16132: Recent views in myob shows double entries and sometimes no icons
authorMartin Taal <martin.taal@openbravo.com>
Sat, 05 Mar 2011 14:44:53 +0100
changeset 11031 98b3b41b82c0
parent 11030 54035895d104
child 11032 c242649f3689
Fixes issue 16132: Recent views in myob shows double entries and sometimes no icons
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Fri Mar 04 18:36:17 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Sat Mar 05 14:44:53 2011 +0100
@@ -113,8 +113,9 @@
     var isClassicEnvironment = OB.Utilities.useClassicMode(item.windowId);
     var selectedView = null;
     if (item.tabId) {
-      selectedView = OB.Utilities.openView(item.windowId, item.tabId, item.title);
+      selectedView = OB.Utilities.openView(item.windowId, item.tabId, item.title, null, null, item.icon);
       selectedView.type = item.type;
+      selectedView.icon = item.icon;
       if (selectedView) {
         OB.RecentUtilities.addRecent('UINAVBA_MenuRecentList', selectedView);
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Fri Mar 04 18:36:17 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Sat Mar 05 14:44:53 2011 +0100
@@ -95,7 +95,11 @@
       var currentRecentValue = this.getRecentValue(propertyName);
       var currentIndex = -1;
       for (var i = 0; i < currentRecentValue.length; i++) {
-        if (currentRecentValue[i] &&
+        // if the title is the same then assume they are the same
+        if (currentRecentValue[i].tabTitle && 
+            choiceObject.tabTitle && choiceObject.tabTitle === currentRecentValue[i].tabTitle) {
+          currentIndex = i;
+        } else if (currentRecentValue[i] &&
         currentRecentValue[i].id === choiceObject.id) {
           // found it
           currentIndex = i;
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Fri Mar 04 18:36:17 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Sat Mar 05 14:44:53 2011 +0100
@@ -682,18 +682,24 @@
     this.Super('handleFilterEditorSubmit', arguments);
   },
   
-  getInitialCriteria: function(){
+  xgetInitialCriteria: function(){
     var criteria = this.Super('getInitialCriteria', arguments);
     
     return this.convertCriteria(criteria);
   },
   
-  getCriteria: function(){
+  xgetCriteria: function(){
     var criteria = this.Super('getCriteria', arguments) || {};
     criteria = this.convertCriteria(criteria);
     return criteria;
   },
   
+  // overridden to clean up the criteria before they are set
+  setFilterValues : function (criteria) {
+    delete criteria.criteria;
+    return this.Super('setFilterValues', arguments);
+  },
+    
   convertCriteria: function(criteria){
     var selectedValues, prop, fld, value;
     
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Fri Mar 04 18:36:17 2011 +0100
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Sat Mar 05 14:44:53 2011 +0100
@@ -364,6 +364,12 @@
             }
           }
 
+          // if the recent was added through quick create then repair this
+          // https://issues.openbravo.com/view.php?id=16132
+          if (recent.command === 'NEW') {
+            recent.command = 'DEFAULT';
+          }
+          
           lbl = isc.Label.create({
             contents: recent.tabTitle,
             recent: recent,