details:   /erp/devel/pi/rev/b2d86692a080
changeset: 8550:b2d86692a080
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Fri Oct 15 17:49:36 2010 +0200
summary:   Fixed issue 14863. The translation import process will no longer 
attempt to insert a null value, if there is no translation value in the xml file

diffstat:

 src/org/openbravo/erpCommon/ad_forms/TranslationHandler.java |  18 +++++++++--
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 8939c9c81018 -r b2d86692a080 
src/org/openbravo/erpCommon/ad_forms/TranslationHandler.java
--- a/src/org/openbravo/erpCommon/ad_forms/TranslationHandler.java      Fri Oct 
15 15:49:08 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/TranslationHandler.java      Fri Oct 
15 17:49:36 2010 +0200
@@ -62,6 +62,8 @@
   private String m_curColumnName = null;
   /** Current Value */
   private StringBuffer m_curValue = null;
+  /** Original Value */
+  private String m_oriValue = null;
   /** SQL */
   private StringBuffer m_sql = null;
 
@@ -104,7 +106,7 @@
       m_sql = new StringBuffer();
     } else if (qName.equals(TranslationManager.XML_VALUE_TAG)) {
       m_curColumnName = 
attributes.getValue(TranslationManager.XML_VALUE_ATTRIBUTE_COLUMN);
-
+      m_oriValue = 
attributes.getValue(TranslationManager.XML_VALUE_ATTRIBUTE_ORIGINAL);
     } else if (qName.equals(TranslationManager.XML_CONTRIB)) {
       m_AD_Language = 
attributes.getValue(TranslationManager.XML_ATTRIBUTE_LANGUAGE);
     } else
@@ -185,9 +187,17 @@
       else
         log4j.error("Update Rows=" + no + " (Should be 1) - " + 
m_sql.toString());
     } else if (qName.equals(TranslationManager.XML_VALUE_TAG)) {
-      if (m_sql.length() > 0)
-        m_sql.append(",");
-      
m_sql.append(m_curColumnName).append("=").append(TO_STRING(m_curValue.toString()));
+      String value = "";
+      if (m_curValue != null && !m_curValue.toString().equals("")) {
+        value = TO_STRING(m_curValue.toString());
+      } else if (m_oriValue != null && !m_oriValue.toString().equals("")) {
+        value = TO_STRING(m_oriValue.toString());
+      }
+      if (!value.equals("")) {
+        if (m_sql.length() > 0)
+          m_sql.append(",");
+        m_sql.append(m_curColumnName).append("=").append(value);
+      }
     } else if (qName.equals(TranslationManager.XML_CONTRIB)) {
       if (log4j.isDebugEnabled())
         log4j.debug("Contibutors:" + TO_STRING(m_curValue.toString()));

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to