From 24f776402bba28f1c3dfaaf011bf8d7e2cd9525f Mon Sep 17 00:00:00 2001 From: monishdeb Date: Thu, 19 Jun 2014 14:05:10 +0530 Subject: [PATCH] CRM-14784 fix - The update greetings job times out without saving to the database https://issues.civicrm.org/jira/browse/CRM-14784 --- CRM/Contact/BAO/Contact/Utils.php | 6 +++++- xml/templates/civicrm_data.tpl | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index fa288fce41..e59da7a1bc 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -898,6 +898,7 @@ Group By componentId"; $greeting = $params['gt']; $valueID = $id = CRM_Utils_Array::value('id', $params); $force = CRM_Utils_Array::value('force', $params); + $limit = CRM_Utils_Array::value('limit', $params); // if valueID is not passed use default value if (!$valueID) { @@ -955,6 +956,10 @@ Group By componentId"; OR ( {$idFldName} IS NOT NULL AND ({$displayFldName} IS NULL OR {$displayFldName} = '')) )"; } + if ($limit) { + $sql .= " LIMIT $limit"; + } + $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contactType, 'String'))); while ($dao->fetch()) { $filterContactFldIds[$dao->id] = $dao->$idFldName; @@ -1085,4 +1090,3 @@ WHERE id IN (" . implode(',', $contactIds) . ")"; $templateString = $smarty->fetch("string:$templateString"); } } - diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index bff104d942..66023c282d 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1512,7 +1512,8 @@ end=[contact ID] optional-process contacts with IDs less than this throttle=[1 or 0] optional-1 adds five second sleep{/ts}', 0), ( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Update Greetings and Addressees{/ts}','{ts escape="sql" skip="true"}Goes through contact records and updates email and postal greetings, or addressee value{/ts}', 'job', 'update_greeting','{ts escape="sql" skip="true"}ct=[Individual or Household or Organization] required gt=[email_greeting or postal_greeting or addressee] required -force=[0 or 1] optional-0 update contacts with null value, 1 update all{/ts}', 0), +force=[0 or 1] optional-0 update contacts with null value, 1 update all +limit=Number optional-Limit the number of contacts to update{/ts}', 0), ( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Mail Reports{/ts}', '{ts escape="sql" skip="true"}Generates and sends out reports via email{/ts}', 'job', 'mail_report','{ts escape="sql" skip="true"}instanceId=[ID of report instance] required format=[csv or print] optional-output CSV or print-friendly HTML, else PDF{/ts}', 0), ( @domainID, 'Daily' , NULL, '{ts escape="sql" skip="true"}Send Scheduled Reminders{/ts}', '{ts escape="sql" skip="true"}Sends out scheduled reminders via email{/ts}', 'job', 'send_reminder', NULL, 0), -- 2.25.1