details:   https://code.openbravo.com/erp/devel/pi/rev/a3a20690578a
changeset: 13615:a3a20690578a
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Tue Aug 30 08:53:29 2011 +0200
summary:   Fixes int-gui-oracle - Build # 255. Related to issue 18297

diffstat:

 src/org/openbravo/erpCommon/security/Login.java |  19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diffs (48 lines):

diff -r 197035979c96 -r a3a20690578a 
src/org/openbravo/erpCommon/security/Login.java
--- a/src/org/openbravo/erpCommon/security/Login.java   Mon Aug 29 13:08:07 
2011 +0200
+++ b/src/org/openbravo/erpCommon/security/Login.java   Tue Aug 30 08:53:29 
2011 +0200
@@ -25,11 +25,10 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.hibernate.criterion.Restrictions;
+import org.hibernate.Query;
 import org.openbravo.base.HttpBaseServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.erpCommon.obps.ActivationKey;
@@ -37,7 +36,6 @@
 import org.openbravo.erpCommon.utility.OBVersion;
 import org.openbravo.erpCommon.utility.PropertyException;
 import org.openbravo.erpCommon.utility.Utility;
-import org.openbravo.model.ad.domain.Preference;
 import org.openbravo.model.ad.module.Module;
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.ad.system.SystemInformation;
@@ -249,18 +247,13 @@
     Module module = OBDal.getInstance().get(Module.class, 
GOOGLE_INTEGRATION_MODULE_ID);
 
     if (ActivationKey.getInstance().isActive()) {
-      Client systemClient = OBDal.getInstance().get(Client.class, "0");
-      OBCriteria<Preference> obc = 
OBDal.getInstance().createCriteria(Preference.class);
-      obc.setFilterOnReadableClients(false);
-      obc.setFilterOnReadableOrganization(false);
-
-      obc.add(Restrictions.eq(Preference.PROPERTY_PROPERTY, 
GOOGLE_PREFERENCE_PROPERTY));
-      obc.add(Restrictions.eq(Preference.PROPERTY_SEARCHKEY, "N"));
-      
obc.add(Restrictions.or(Restrictions.eq(Preference.PROPERTY_VISIBLEATCLIENT, 
systemClient),
-          Restrictions.isNull(Preference.PROPERTY_VISIBLEATCLIENT)));
+      String hql = "from ADPreference pref where searchKey = :value and 
property = :prop and (visibleAtClient is null or visibleAtClient.id = '0')";
+      Query q = OBDal.getInstance().getSession().createQuery(hql);
+      q.setParameter("value", "N");
+      q.setParameter("prop", GOOGLE_PREFERENCE_PROPERTY);
 
       // show by default - not show when there is a preference to disable it
-      showGoogleIcon = obc.count() == 0;
+      showGoogleIcon = q.list().size() == 0;
     } else {
       showGoogleIcon = (module != null && module.isEnabled());
     }

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to