CRM-14784 fix - The update greetings job times out without saving to the database
authormonishdeb <monish.deb@webaccessglobal.com>
Tue, 9 Sep 2014 07:16:57 +0000 (12:46 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Tue, 9 Sep 2014 07:16:57 +0000 (12:46 +0530)
https://issues.civicrm.org/jira/browse/CRM-14784

CRM/Contact/BAO/Contact/Utils.php

index 67a0e1f9031844faed73443ab0b75a310c494292..5da54baa545bdc7487613065a0ff8f66a1489d3a 100644 (file)
@@ -933,6 +933,8 @@ Group By  componentId";
     }
 
     if ($idFldName) {
+      $queryParams = array(1 => array($contactType, 'String'));
+
       // if $force == 1 then update all contacts else only
       // those with NULL greeting or addressee value CRM-9476
       if ($processAll) {
@@ -948,10 +950,11 @@ Group By  componentId";
       }
 
       if ($limit) {
-        $sql .= " LIMIT $limit";
+        $sql .= " LIMIT 0, %2";
+        $queryParams += array(2 => array($limit, 'Integer'));
       }
 
-      $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contactType, 'String')));
+      $dao = CRM_Core_DAO::executeQuery($sql, $queryParams);
       while ($dao->fetch()) {
         $filterContactFldIds[$dao->id] = $dao->$idFldName;