Related to issue 19778.Use DalUtil to compare dates on OBMessageUtils.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Wed, 29 Feb 2012 12:48:10 +0100
changeset 15662 1e06e813fdc0
parent 15661 edd121f3d210
child 15663 a253469978c4
Related to issue 19778.Use DalUtil to compare dates on OBMessageUtils.
src/org/openbravo/erpCommon/utility/OBMessageUtils.java
--- a/src/org/openbravo/erpCommon/utility/OBMessageUtils.java	Wed Feb 29 12:46:36 2012 +0100
+++ b/src/org/openbravo/erpCommon/utility/OBMessageUtils.java	Wed Feb 29 12:48:10 2012 +0100
@@ -26,6 +26,7 @@
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
@@ -52,7 +53,7 @@
    */
   public static String messageBD(String strCode) {
     String strMessage = "";
-    final String strLanguage = OBContext.getOBContext().getLanguage().getLanguage();
+    final String strLanguageId = OBContext.getOBContext().getLanguage().getId();
 
     // Search strCode in AD_Message table.
     try {
@@ -64,7 +65,7 @@
         Message msg = obcMessage.list().get(0);
         strMessage = msg.getMessageText();
         for (MessageTrl msgTrl : msg.getADMessageTrlList()) {
-          if (msgTrl.getLanguage().getLanguage().equals(strLanguage)) {
+          if (DalUtil.getId(msgTrl.getLanguage()).equals(strLanguageId)) {
             strMessage = msgTrl.getMessageText();
             break;
           }
@@ -86,7 +87,7 @@
           Element element = obcElement.list().get(0);
           strMessage = element.getName();
           for (ElementTrl elementTrl : element.getADElementTrlList()) {
-            if (elementTrl.getLanguage().getLanguage().equals(strLanguage)) {
+            if (DalUtil.getId(elementTrl.getLanguage()).equals(strLanguageId)) {
               strMessage = elementTrl.getName();
             }
           }