details:   /erp/devel/pi/rev/9eabf077358a
changeset: 9304:9eabf077358a
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Wed Dec 22 15:57:16 2010 +0100
summary:   Fixes issue 0015503: The vertical Menu when loading does not print 
the textinterfaces using utf-8 encoding

details:   /erp/devel/pi/rev/cf81518776db
changeset: 9305:cf81518776db
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Wed Dec 22 15:57:44 2010 +0100
summary:   merging

diffstat:

 
modules/org.openbravo.advpaymentmngt/src-test/org/openbravo/advpaymentmngt/test/draft/TestUtility.java
                |   4 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/Transactions.java
                      |   4 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
                     |   3 -
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
            |   2 +-
 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
                        |   1 -
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
 |  62 ++++++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/index.html
                              |   4 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
               |   8 +
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
                           |  18 ++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
                      |  19 ++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
                      |   2 +
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
                                  |   2 -
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java
                   |  26 +++-
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java
                       |  10 +-
 modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java 
                                       |  21 ++-
 
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/WidgetProvider.java
                                   |   1 -
 
modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java
                    |  22 ++-
 
modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListUtils.java
                         |  13 +-
 
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
                   |  35 +++--
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceJavaScriptCreator.java
        |   2 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceService.java
                  |   2 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
                  |  65 +++++++++-
 src/org/openbravo/base/model/Column.hbm.xml                                    
                                       |   1 +
 src/org/openbravo/base/model/Column.java                                       
                                       |   9 +
 src/org/openbravo/base/model/Property.java                                     
                                       |  10 +
 src/org/openbravo/dal/service/OBDal.java                                       
                                       |  18 ++
 src/org/openbravo/erpCommon/utility/PopupLoading.java                          
                                       |   1 +
 27 files changed, 296 insertions(+), 69 deletions(-)

diffs (truncated from 915 to 300 lines):

diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.advpaymentmngt/src-test/org/openbravo/advpaymentmngt/test/draft/TestUtility.java
--- 
a/modules/org.openbravo.advpaymentmngt/src-test/org/openbravo/advpaymentmngt/test/draft/TestUtility.java
    Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src-test/org/openbravo/advpaymentmngt/test/draft/TestUtility.java
    Wed Dec 22 15:57:44 2010 +0100
@@ -361,8 +361,8 @@
    * @param refundAmount
    *          . Refund Amount need to transfer to the customer.
    * @return. Created FIN_Payment object.
-   * @throws Exception. In
-   *           case of executing invalid data.
+   * @throws Exception
+   *           In case of executing invalid data.
    */
   public static FIN_Payment createRefundPayment(FIN_Payment payment, 
BigDecimal refundAmount)
       throws Exception {
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/Transactions.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/Transactions.java
  Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_forms/Transactions.java
  Wed Dec 22 15:57:44 2010 +0100
@@ -108,7 +108,7 @@
       OBContext.restorePreviousMode();
     }
 
-    if (vars.commandIn("DEFAULT")) {
+    if (vars.commandIn("DEFAULT") || vars.commandIn("EDIT")) {
 
       String strFinFinancialAccountId = 
vars.getGlobalVariable("inpfinFinancialAccountId", windowId
           + "|Fin_Financial_Account_ID", "");
@@ -636,7 +636,7 @@
    *          ConnectionProvider with the connection being used.
    * @param strAction
    *          String with the action of the process. {P, D, R}
-   * @param Transaction
+   * @param transaction
    *          FIN_Payment that needs to be processed.
    * @return a OBError with the result message of the process.
    * @throws Exception
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
 Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java
 Wed Dec 22 15:57:44 2010 +0100
@@ -460,7 +460,6 @@
    * Payment Proposal.
    * 
    * @param paymentProposal
-   * @return
    */
   public static List<FIN_PaymentScheduleDetail> 
getSelectedPendingPaymentsFromProposal(
       FIN_PaymentProposal paymentProposal) {
@@ -695,8 +694,6 @@
    *          ConnectionProvider with the connection being used.
    * @param strProcessProposalAction
    *          String with the action of the process. {GSP, RE}
-   * @param strSendBankReq
-   *          not implemented parameter.
    * @param strFinPaymentProposalId
    *          String with FIN_PaymentProposal Id to be processed.
    * @return a OBError with the result message of the process.
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
        Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_BankStatementImport.java
        Wed Dec 22 15:57:44 2010 +0100
@@ -70,7 +70,7 @@
   }
 
   /**
-   * @param myError
+   * @param error
    *          the myError to set
    */
   public void setMyError(OBError error) {
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- 
a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
    Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
    Wed Dec 22 15:57:44 2010 +0100
@@ -175,7 +175,6 @@
    *          List of FIN_PaymentSchedule that need to be selected by default
    * @param filteredScheduledPayments
    *          List of FIN_PaymentSchedule that need to unselected by default
-   * @return
    */
   public static FieldProvider[] getShownScheduledPayments(VariablesSecureApp 
vars,
       List<FIN_PaymentSchedule> selectedScheduledPayments,
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
     Wed Dec 22 15:57:44 2010 +0100
@@ -23,7 +23,10 @@
 import java.lang.reflect.Method;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -140,7 +143,14 @@
               + 
Sqlc.TransformaNombreColumna(field.getColumn().getDBColumnName());
           try {
             if (jsContent.has(inpColName)) {
-              RequestContext.get().setRequestParameter(inpColName, 
jsContent.getString(inpColName));
+              String value;
+              if (jsContent.get(inpColName) == null
+                  || jsContent.get(inpColName).toString().equals("null")) {
+                value = null;
+              } else {
+                value = jsContent.get(inpColName).toString();
+              }
+              RequestContext.get().setRequestParameter(inpColName, value);
             }
           } catch (Exception e) {
             log.error("Couldn't read column value from the request for column 
" + inpColName, e);
@@ -419,12 +429,29 @@
     }
   }
 
+  private Object parseDateFromDAL(Object value) {
+    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    format.setLenient(true);
+    Date date;
+    try {
+      date = format.parse(value.toString());
+    } catch (ParseException e) {
+      throw new OBException("Error while parsing date: " + value, e);
+    }
+    SimpleDateFormat outFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+    outFormat.setLenient(true);
+    return outFormat.format(date);
+  }
+
   private void setValueOfColumnInRequest(BaseOBObject obj, String columnName) {
     Entity entity = obj.getEntity();
     Property prop = entity.getPropertyByColumnName(columnName);
     Object currentValue = obj.get(prop.getName());
+
     if (currentValue != null) {
-      if (currentValue instanceof BaseOBObject) {
+      if (prop.isDate()) {
+        currentValue = parseDateFromDAL(currentValue);
+      } else if (currentValue instanceof BaseOBObject) {
         if (prop.getReferencedProperty() != null) {
           currentValue = ((BaseOBObject) 
currentValue).get(prop.getReferencedProperty().getName());
         } else {
@@ -442,7 +469,9 @@
         Property prop = 
object.getEntity().getPropertyByColumnName(col.getDBColumnName());
         Object value = object.get(prop.getName());
         if (value != null) {
-          if (value instanceof BaseOBObject) {
+          if (prop.isDate()) {
+            value = parseDateFromDAL(value);
+          } else if (value instanceof BaseOBObject) {
             value = ((BaseOBObject) value).getId();
           } else {
             value = 
UIDefinitionController.getInstance().getUIDefinition(col.getId())
@@ -540,11 +569,11 @@
           log.error("Couldn't find method doPost in Callout " + 
calloutClassName);
         } else {
           RequestContext rq = RequestContext.get();
-          HashMap<String, JSONObject> formattedColumnValues = new 
HashMap<String, JSONObject>(
-              columnValues);
-          formatColumnValues(formattedColumnValues, fields);
-          setRequestContextParameters(fields, columnValues);
+          // We first prepare the data so that it's usable by the callout
+          formatColumnValues(columnValues, fields);
           RequestContext.get().setRequestParameter("inpLastFieldChanged", 
lastFieldChanged);
+
+          // We then execute the callout
           CalloutServletConfig config = new 
CalloutServletConfig(calloutClassName, RequestContext
               .getServletContext());
           Object[] initArgs = { config };
@@ -555,6 +584,11 @@
           method.invoke(calloutInstance, arguments);
           String calloutResponse = fakeResponse.getOutputFromWriter();
 
+          // Now we restore the request data so that it's compatible with the 
UIDefinition
+          // computation
+          setRequestContextParameters(fields, columnValues);
+          // Now we parse the callout response and modify the stored values of 
the columns modified
+          // by the callout
           ArrayList<NativeArray> returnedArray = new ArrayList<NativeArray>();
           String calloutNameJS = parseCalloutResponse(calloutResponse, 
returnedArray);
           if (calloutNameJS != null && calloutNameJS != "") {
@@ -655,7 +689,8 @@
           String oldValue = obj.has("value") ? obj.getString("value") : null;
           String value = oldValue == null || oldValue.equals("") ? oldValue : 
uiDef
               .formatValueToSQL(oldValue.toString());
-          obj.put("value", value);
+          RequestContext.get().setRequestParameter(
+              "inp" + 
Sqlc.TransformaNombreColumna(field.getColumn().getDBColumnName()), value);
         }
       } catch (Exception e) {
         log.error("Error while formatting column " + 
field.getColumn().getDBColumnName(), e);
@@ -701,7 +736,7 @@
       }
       boolean allColsSorted = true;
       for (String depCol : columnsInValidation.get(col)) {
-        if (!sortedColumns.contains(depCol))
+        if (!containsIgnoreCase(sortedColumns, depCol))
           allColsSorted = false;
       }
       if (allColsSorted)
@@ -711,6 +746,15 @@
     return null;
   }
 
+  private boolean containsIgnoreCase(List<String> list, String element) {
+    for (String e : list) {
+      if (e.equalsIgnoreCase(element)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private String getValidation(Field field) {
     Column c = field.getColumn();
     String val = c.getValidation().getValidationCode();
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.client.application/web/org.openbravo.client.application/index.html
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/index.html
  Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/index.html
  Wed Dec 22 15:57:44 2010 +0100
@@ -26,6 +26,7 @@
   OB.Layout.draw();
   OB.Layout.ViewManager.createAddStartTab();
   isc.clearPrompt();
+  OB.globalHiddenForm = document.forms.globalHiddenForm;
 }
 
 </script>
@@ -45,5 +46,8 @@
 
 <script type="text/javascript" 
src="../../org.openbravo.client.kernel/OBCLKER_Kernel/StaticResources?_skinVersion=3.00"></script>
 
+<form name="globalHiddenForm" method="post" action="blank.html"></form>
+
+
 </body>
 </html>
\ No newline at end of file
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Wed Dec 22 15:57:44 2010 +0100
@@ -27,6 +27,14 @@
 // * OBFKComboBoxItem: combo box for foreign key references
 // * OBListComboBoxItem: combo box for list references
 
+// == OBEncryptedItem ==
+// The type used for encrypted items.
+isc.ClassFactory.defineClass('OBEncryptedItem', isc.PasswordItem);
+
+// add specific properties here
+isc.OBEncryptedItem.addProperties({
+});
+
 // == OBFormButton ==
 // The default form button.
 isc.ClassFactory.defineClass('OBFormButton', Button);
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
       Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js
       Wed Dec 22 15:57:44 2010 +0100
@@ -19,4 +19,22 @@
 
 isc.ClassFactory.defineClass('OBGrid', isc.ListGrid);
 
+isc.OBGrid.addProperties({
+  exportData: function(requestProperties, additionalProperties) {
+    // var criteria = this.getCriteria();
+    var dsURL = this.dataSource.dataURL;
+    var data = {
+        _dataSource: this.dataSource.ID,
+        _operationType: 'fetch',
+        exportFormat: 'csv',
+        exportToFile: (requestProperties
+                       && requestProperties.params
+                       && requestProperties.params.exportToFile)
+    };
+    isc.addProperties(data, additionalProperties);
+    
+    OB.Utilities.postThroughHiddenFrame(dsURL, data);
+  }
+});
+
 isc.ClassFactory.defineClass('OBGridHeaderImgButton', isc.ImgButton);
\ No newline at end of file
diff -r cc25fcd18717 -r cf81518776db 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Tue Dec 21 16:08:28 2010 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
  Wed Dec 22 15:57:44 2010 +0100
@@ -854,4 +854,23 @@
   //button.parentElement.parentElement.view.getContextInfo()
 };
 
+OB.Utilities.postThroughHiddenFrame = function(url, data) {
+  OB.globalHiddenForm.setAttribute('action', url);
+  
+//  for (var child in OB.globalHiddenForm.children) {
+//    OB.globalHiddenForm.removeChild(child);
+//  }
+  
+  for (var key in data) {
+    var field = document.createElement('input');
+    field.setAttribute('type', 'hidden');
+    field.setAttribute('name', key);
+    field.setAttribute('value', data[key]);
+    
+    OB.globalHiddenForm.appendChild(field);

------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to