details:   https://code.openbravo.com/erp/devel/pi/rev/0760e5c19adb
changeset: 15318:0760e5c19adb
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 24 18:26:43 2012 +0100
summary:   fixed bug 19298: fixed Date Time reference UI

details:   https://code.openbravo.com/erp/devel/pi/rev/8260e95981da
changeset: 15319:8260e95981da
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue Jan 24 18:21:32 2012 +0100
summary:   fixed issue 19425: Allow multiple servlets with same classname in 
web.xml

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js
 |  90 +---------
 src-wad/src/org/openbravo/wad/Wad.java                                         
                                        |   6 +-
 src-wad/src/org/openbravo/wad/Wad_data.xsql                                    
                                        |  15 +-
 3 files changed, 20 insertions(+), 91 deletions(-)

diffs (212 lines):

diff -r f65ada418538 -r 8260e95981da 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js
    Thu Feb 02 10:12:55 2012 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js
    Tue Jan 24 18:21:32 2012 +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 Openbravo SLU
+ * All portions are Copyright (C) 2011-2012 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -124,86 +124,6 @@
     // if (i > 7 && (typeof (field.onchange)!='undefined'))
     // field.onchange();
     // }
-  },
-  
-  // ** {{{ getDateBlock }}} **
-  //
-  // Return the part of the date denoted by the block (which is a number).
-  // Parameters:
-  // * {{{str_date}}}: the complete date
-  // * {{{block}}}: number from 1 to 3, denotes the part of the date to
-  // return
-  getDateBlock: function(str_date, block){
-    var datePattern = 
'^(\\d+)[\\-|\\/|/|:|.|\\.](\\d+)[\\-|\\/|/|:|.|\\.](\\d+)$';
-    var dateRegExp = new RegExp(datePattern);
-    if (!dateRegExp.exec(str_date)) {
-      return null;
-    }
-    var dateBlock = [];
-    dateBlock[1] = RegExp.$1;
-    dateBlock[2] = RegExp.$2;
-    dateBlock[3] = RegExp.$3;
-    if (block === 1 || block === '1') {
-      return dateBlock[1];
-    } else if (block === 2 || block === '2') {
-      return dateBlock[2];
-    } else if (block === 3 || block === '3') {
-      return dateBlock[3];
-    } else {
-      return dateBlock;
-    }
-  },
-  
-  // ** {{{ expandDateYear }}} **
-  //
-  // Expands the year and day/month to 4 resp 2 digits.
-  // Parameters:
-  // * {{{dateFormat}}}: the date format in OB syntax
-  // * {{{value}}}: the date to expand
-  expandDateYear: function(dateFormat, value){
-    var str_date = value;
-    var str_dateFormat = dateFormat.replace('yyyy', 'YYYY');
-    if (str_date === null || str_dateFormat.indexOf('YYYY') === -1) {
-      return value;
-    }
-    var centuryReference = 50;
-    var dateBlock = [];
-    dateBlock[1] = this.getDateBlock(str_date, 1);
-    dateBlock[2] = this.getDateBlock(str_date, 2);
-    dateBlock[3] = this.getDateBlock(str_date, 3);
-    
-    if (!dateBlock[1] || !dateBlock[2] || !dateBlock[3]) {
-      return value;
-    }
-    
-    var yearBlock;
-    if (str_dateFormat.substr(1, 1) === 'Y') {
-      yearBlock = 1;
-    } else if (str_dateFormat.substr(7, 1) === 'Y') {
-      yearBlock = 3;
-    } else {
-      return value;
-    }
-    
-    if (dateBlock[yearBlock].length === 1) {
-      dateBlock[yearBlock] = '000' + dateBlock[yearBlock];
-    } else if (dateBlock[yearBlock].length === 2) {
-      if (dateBlock[yearBlock] < centuryReference) {
-        dateBlock[yearBlock] = '20' + dateBlock[yearBlock];
-      } else {
-        dateBlock[yearBlock] = '19' + dateBlock[yearBlock];
-      }
-    } else if (dateBlock[yearBlock].length === 3) {
-      dateBlock[yearBlock] = '0' + dateBlock[yearBlock];
-    } else if (dateBlock[yearBlock].length === 4) {
-      return value;
-    }
-    
-    var dateSeparator = str_dateFormat.toUpperCase().replace(/D/g, 
'').replace(/M/g, '').replace(/Y/g, '').substr(0, 1);
-    var normalizedDate = dateBlock[1] + dateSeparator + dateBlock[2] +
-    dateSeparator +
-    dateBlock[3];
-    return normalizedDate;
   }
 });
 
@@ -212,7 +132,13 @@
   showTime: true,
   
   blurValue: function() {
-    return isc.OBDateTimeItem.expandDateYear(this.dateFormat, this.getValue());
+    var value = OB.Utilities.Date.OBToJS(this.dateTextField.getElementValue(), 
OB.Format.dateTime);
+    this.setValue(value);
+    return value;
+  },
+
+  parseValue: function(){
+    return this.dateTextField.getElementValue();
   },
 
   // ** {{{ change }}} **
diff -r f65ada418538 -r 8260e95981da src-wad/src/org/openbravo/wad/Wad.java
--- a/src-wad/src/org/openbravo/wad/Wad.java    Thu Feb 02 10:12:55 2012 +0100
+++ b/src-wad/src/org/openbravo/wad/Wad.java    Tue Jan 24 18:21:32 2012 +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) 2001-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -646,7 +646,7 @@
       if (filters != null && filters.length > 0) {
         filterParams = new WadData[filters.length][];
         for (int i = 0; i < filters.length; i++) {
-          filterParams[i] = WadData.selectParams(pool, "F", 
filters[i].classname);
+          filterParams[i] = WadData.selectParams(pool, "F", 
filters[i].classname, filters[i].id);
         }
       } else
         filterParams = new WadData[0][0];
@@ -668,7 +668,7 @@
           if (servlets[i].loadonstartup != null && 
!servlets[i].loadonstartup.equals(""))
             servlets[i].loadonstartup = "<load-on-startup>" + 
servlets[i].loadonstartup
                 + "</load-on-startup>";
-          servletParams[i] = WadData.selectParams(pool, "S", 
servlets[i].classname);
+          servletParams[i] = WadData.selectParams(pool, "S", 
servlets[i].classname, servlets[i].id);
         }
       } else
         servletParams = new WadData[0][0];
diff -r f65ada418538 -r 8260e95981da src-wad/src/org/openbravo/wad/Wad_data.xsql
--- a/src-wad/src/org/openbravo/wad/Wad_data.xsql       Thu Feb 02 10:12:55 
2012 +0100
+++ b/src-wad/src/org/openbravo/wad/Wad_data.xsql       Tue Jan 24 18:21:32 
2012 +0100
@@ -12,7 +12,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) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,14 +25,13 @@
     <SqlMethodComment>Names of the columns of the fields of a 
tab</SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT MAX(COALESCE(ACTION, '') || AD_MODEL_OBJECT_ID) AS NAME, 
CLASSNAME, CLASSNAME AS DISPLAYNAME, 
-      MAX(LOADONSTARTUP) AS LOADONSTARTUP, '' AS VALUE, '' AS LINE, '' AS 
AUTH, '' as buildxml,
-      '' as ad_tab_id, '' as windowName, '' as tabName, '' as windowPackage, 
'' as windowmodule, '' as tabPackage, '' as tabmodule
+      SELECT AD_MODEL_OBJECT_ID as ID, (COALESCE(ACTION, '') || 
AD_MODEL_OBJECT_ID) AS NAME, CLASSNAME, CLASSNAME AS DISPLAYNAME, 
+      LOADONSTARTUP, '' AS VALUE, '' AS LINE, '' AS AUTH, '' as buildxml, 
+         '' as ad_tab_id, '' as windowName, '' as tabName, '' as 
windowPackage, '' as windowmodule, '' as tabPackage, '' as tabmodule
       FROM AD_MODEL_OBJECT o
       WHERE ISACTIVE = 'Y'
       AND OBJECT_TYPE = 'S'
       AND ACTION != 'W'
-      GROUP BY CLASSNAME
       ORDER BY NAME
       ]]>
     </Sql>
@@ -75,11 +74,12 @@
       ]]>
     </Sql>
   </SqlMethod>
+
   <SqlMethod name="selectFilter" type="preparedStatement" return="multiple">
     <SqlMethodComment>Names of the columns of the fields of a 
tab</SqlMethodComment>
     <Sql>
       <![CDATA[
-      SELECT MAX(COALESCE(ACTION, '') || AD_MODEL_OBJECT_ID) AS NAME, 
CLASSNAME, CLASSNAME AS DISPLAYNAME
+      SELECT MAX(COALESCE(ACTION, '') || AD_MODEL_OBJECT_ID) AS NAME, 
MAX(AD_MODEL_OBJECT_ID) as ID, CLASSNAME, CLASSNAME AS DISPLAYNAME
       FROM AD_MODEL_OBJECT 
       WHERE ISACTIVE = 'Y' 
       AND OBJECT_TYPE = 'F'
@@ -149,6 +149,7 @@
       ]]>
     </Sql>
   </SqlMethod>
+
   <SqlMethod name="selectParams" type="preparedStatement" return="multiple">
     <SqlMethodComment>Names of the columns of the fields of a 
tab</SqlMethodComment>
     <Sql>
@@ -158,6 +159,7 @@
       WHERE MO.ISACTIVE = 'Y'
       AND MO.OBJECT_TYPE = ? 
       AND MO.CLASSNAME = ?
+      and mo.ad_model_object_id = ?
       AND MO.AD_MODEL_OBJECT_ID = P.AD_MODEL_OBJECT_ID 
       AND P.ISACTIVE = 'Y'
       GROUP BY P.NAME 
@@ -166,6 +168,7 @@
     </Sql>
     <Parameter name="objectType"/>
     <Parameter name="classname"/>
+    <Parameter name="id"/>
   </SqlMethod>
   <SqlMethod name="selectListener" type="preparedStatement" return="multiple">
     <SqlMethodComment>Names of the columns of the fields of a 
tab</SqlMethodComment>

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to