Merge with latest pi
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 07 Jan 2015 09:43:52 +0100
changeset 25730 b48a2cd4c1e0
parent 25729 3507d8ffcba3 (current diff)
parent 25723 c64817b82a3e (diff)
child 25731 63a5eca5e0ce
Merge with latest pi
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Mon Jan 05 17:48:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Wed Jan 07 09:43:52 2015 +0100
@@ -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) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -77,6 +77,11 @@
     }
 
     this.pickListProperties = {
+      // 'showOverAsSelected' and 'bodyKeyPress' defined here until issue 28475 be fixed.
+      // After the fix the following two lines must be removed, since it will be inherited from
+      // OBListFilterItem  as usual
+      showOverAsSelected: this.pickListProperties.showOverAsSelected,
+      bodyKeyPress: this.pickListProperties.bodyKeyPress,
 
       // make sure that we send the same parameters as the grid
       onFetchData: function (criteria, requestProperties) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js	Mon Jan 05 17:48:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-list-filter.js	Wed Jan 07 09:43:52 2015 +0100
@@ -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) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -74,5 +74,55 @@
       isc.Page.setEvent(isc.EH.IDLE, this.form.grid, isc.Page.FIRE_ONCE, 'performAction');
     }
     this.Super('change', arguments);
+  },
+
+  handleKeyPress: function () {
+    if (isc.EH.getKey() === 'Space') {
+      if (this.isPickListShown() && !this.pickList.bodyKeyPress('Space')) {
+        return false;
+      }
+    }
+    return this.Super('handleKeyPress', arguments);
+  }
+});
+
+isc.OBListFilterItem.changeDefaults('pickListProperties', {
+  showOverAsSelected: false,
+
+  bodyKeyPress: function (event, eventInfo) {
+    var focusedRecord = this.getRecord(this.getFocusRow()),
+        selectedRecords = this.getSelectedRecords(),
+        isSelectedRecord = false,
+        recordIdentifier = (this.fields && this.fields[1] && this.fields[1].name ? this.fields[1].name : ''),
+        i;
+    for (i = 0; i < selectedRecords.length; i++) {
+      if (focusedRecord[recordIdentifier] === selectedRecords[i][recordIdentifier]) {
+        isSelectedRecord = true;
+        break;
+      }
+    }
+    if (event === 'Space') {
+      // bodyKeyPress doesn't capture 'Space' key press, so used this workaround
+      // to obtain it from the 'handleKeyPress' of the parent item
+      if (focusedRecord) {
+        if (isSelectedRecord) {
+          this.deselectRecord(focusedRecord);
+        } else {
+          this.selectRecord(focusedRecord);
+        }
+        this.multiSelectChanged();
+        // Return false to avoid propagation in the parent item
+        return false;
+      } else {
+        // Return true to ensure propagation in the parent item
+        return true;
+      }
+    }
+    if (isc.EH.getKey() === 'Enter') {
+      if (!isSelectedRecord) {
+        this.selectRecord(focusedRecord);
+      }
+    }
+    return this.Super('bodyKeyPress', arguments);
   }
 });
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-text.js	Mon Jan 05 17:48:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-text.js	Wed Jan 07 09:43:52 2015 +0100
@@ -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) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Mon Jan 05 17:48:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Wed Jan 07 09:43:52 2015 +0100
@@ -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-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):   Sreedhar Sirigiri (TDS), Mallikarjun M (TDS)
  ************************************************************************
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Mon Jan 05 17:48:58 2015 +0100
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Wed Jan 07 09:43:52 2015 +0100
@@ -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) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -550,14 +550,9 @@
 
   _original_validate: isc.FormItem.getPrototype().validate,
   validate: function () {
-
-    // prevent validation when we are showing the editor and moving
-    // the focus around
-
     if (this.preventValidation) {
       return;
     }
-
     return this._original_validate();
   },