# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1557990161 -19800
#      Thu May 16 12:32:41 2019 +0530
# Node ID 28fd9db6a14be949e317bd73fc4c52d4034d627c
# Parent  b0c3b12f7a26338a21dbafb1eb197e8a0b8f3e1f
Related to issue 40581: SynchronizedServerProcessCaller.thereIsDataInImportQueue is not using bind-parameters

diff -r b0c3b12f7a26 -r 28fd9db6a14b src/org/openbravo/mobile/core/servercontroller/SynchronizedServerProcessCaller.java
--- a/src/org/openbravo/mobile/core/servercontroller/SynchronizedServerProcessCaller.java	Thu May 16 12:31:59 2019 +0530
+++ b/src/org/openbravo/mobile/core/servercontroller/SynchronizedServerProcessCaller.java	Thu May 16 12:32:41 2019 +0530
@@ -171,18 +171,17 @@
     }
 
     private int countEntries(String importStatus, ImportEntry importEntry) {
-      final String whereClause = ImportEntry.PROPERTY_IMPORTSTATUS + "='" + importStatus + "' and "
-          + ImportEntry.PROPERTY_TYPEOFDATA + "='OBMOBC_SynchronizedData' and "
+      final String query = "select count(*) from " + ImportEntry.ENTITY_NAME + " where "
+          + ImportEntry.PROPERTY_IMPORTSTATUS + "=:importStatus and "
+          + ImportEntry.PROPERTY_TYPEOFDATA + "=:typeOfData and "
           + ImportEntry.PROPERTY_CREATIONDATE + "<:creationDate and "
           + ImportEntry.PROPERTY_ORGANIZATION + "=:org and id!=:id";
-      final Query<Number> qry = OBDal.getInstance()
-          .getSession()
-          .createQuery("select count(*) from " + ImportEntry.ENTITY_NAME + " where " + whereClause,
-              Number.class);
+      final Query<Number> qry = OBDal.getInstance().getSession().createQuery(query, Number.class);
       qry.setParameter("id", importEntry.getId());
       qry.setParameter("creationDate", importEntry.getCreationDate());
       qry.setParameter("org", importEntry.getOrganization());
-
+      qry.setParameter("importStatus", importStatus);
+      qry.setParameter("typeOfData", SYNCHRONIZED_DATA_TYPE);
       return qry.uniqueResult().intValue();
     }
   }
