details:   https://code.openbravo.com/erp/devel/pi/rev/98421b245460
changeset: 19652:98421b245460
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Feb 12 12:38:29 2013 +0100
summary:   Fixes issue 22821: Triggers executed after entering full identifier 
in selector

The problem was that if the full identifier of the selector option was entered 
and then another field was clicked, the pickValue() method of the selector was 
not called and the triggers were not executed. This has been fixed by detecting 
the case where the whole identifier has been entered and if the user blurs out 
of that field, the setValueFromRecord is executed and the callouts were 
executed accordingly.

diffstat:

 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |  23 +++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r 5af2bfc6efea -r 98421b245460 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Tue Feb 12 10:42:30 2013 +0100
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Tue Feb 12 12:38:29 2013 +0100
@@ -517,6 +517,15 @@
     } else {
       identifier = newValue;
     }
+
+    // check if the whole item identifier has been entered
+    // see issue https://issues.openbravo.com/view.php?id=22821
+    if (OB.Utilities.isUUID(this.mapDisplayToValue(identifier))) {
+      this.fullIdentifierEntered = true;
+    } else {
+      delete this.fullIdentifierEntered;
+    }
+
     //Setting the element value again to align the cursor position correctly.
     this.setElementValue(identifier);
   },
@@ -630,7 +639,18 @@
   },
 
   // override blur to not do any change handling
-  blur: function (form, item) {},
+  blur: function (form, item) {
+    var selectedRecord;
+    // Handles the case where the user has entered the whole item identifier 
and has moved out of the 
+    // selector field by clicking on another field, instead of pressing the 
tab key. in that case the change
+    // was not being detected and if the selector had some callouts associated 
they were not being executed
+    // See issue https://issues.openbravo.com/view.php?id=22821
+    if (this.fullIdentifierEntered) {
+      selectedRecord = this.pickList.getSelectedRecord();
+      this.setValueFromRecord(selectedRecord);
+      delete this.fullIdentifierEntered;
+    }
+  },
 
   handleOutFields: function (record) {
     var i, j, outFields = this.outFields,
@@ -712,6 +732,7 @@
     var selectedRecord = this.pickList.getSelectedRecord(),
         ret = this.Super('pickValue', arguments);
     this.setValueFromRecord(selectedRecord);
+    delete this.fullIdentifierEntered;
     return ret;
   },
 

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to