details:   https://code.openbravo.com/erp/devel/main/rev/413266c262eb
changeset: 21765:413266c262eb
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Jan 16 10:37:51 2014 +0100
summary:   Fixes issue 25481: Time fields are properly parsed

When a row was being opened in view form, an error in the log was shown if a 
time field that was not displayed in the grid is present in the view form. This 
happened because in the moment when its value was being parsed it also 
contained the date.

This has been fixed by making sure that when the time is parsed only the time 
part is used.

details:   https://code.openbravo.com/erp/devel/main/rev/cffcdda1fd8e
changeset: 21766:cffcdda1fd8e
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Jan 16 13:14:39 2014 +0100
summary:   Fixes issue 25484: It is possible to enter numbers in the product 
selector

When a number was entered in the product selector (Purchase Invoice window, 
Lines tab), it was being automatically deleted. This happened because it was 
being
detected as an UUID, and we try to avoid showing IDs whenever is possible.

To avoid this, the original value is restored in the redraw() function of 
ob-form-view in this case:
- The focused form item is a foreign key
- It has lost its displayed value
- The original displayed value was a number

This is not going to intefere with the rest of the cases where the UUID should 
actually be not shown. Those cases are handled in functions other than redraw()

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
 |  6 ++++++
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
   |  4 +++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 4bbed6ecf5a8 -r cffcdda1fd8e 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Wed Jan 15 10:53:52 2014 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Thu Jan 16 13:14:39 2014 +0100
@@ -1953,6 +1953,12 @@
     if (focusItemValue && this.getFocusItem() && 
this.getFocusItem().getValue() !== focusItemValue) {
       this.getFocusItem().setValue(focusItemValue);
     }
+
+    // Restore the focus item if it has been deleted because it was a number 
and was mistaken as an UUID
+    if (this.getFocusItem().targetEntity !== null && 
(/^\d+$/).test(focusItemValue) && !this.getFocusItem().getElementValue() && 
(!this.getFocusItem().valueMap || 
!this.getFocusItem().valueMap[focusItemValue])) {
+      this.getFocusItem().setElementValue(focusItemValue);
+    }
+
     if (this.selectOnFocusStored) {
       this.selectOnFocus = this.previousSelectOnFocus;
       delete this.previousSelectOnFocus;
diff -r 4bbed6ecf5a8 -r cffcdda1fd8e 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
       Wed Jan 15 10:53:52 2014 +0100
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java
       Thu Jan 16 13:14:39 2014 +0100
@@ -62,7 +62,9 @@
     if (value instanceof String) {
       return (String) value;
     }
-    return value.toString();
+    String timestamp = value.toString();
+    timestamp = timestamp.substring(timestamp.indexOf(" ") + 1);
+    return timestamp;
   }
 
   private SimpleDateFormat getClassicFormat() {

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to