4 * Class CRM_Contact_Form_Task_Unhold
6 class CRM_Contact_Form_Task_Unhold
extends CRM_Contact_Form_Task
{
9 * Set variables up before form is built.
13 public function preProcess() {
17 public function buildQuickForm() {
18 $this->addDefaultButtons(ts('Unhold Email'), 'done');
21 public function postProcess() {
22 // Query to unhold emails of selected contacts
23 $num = count($this->_contactIds
);
26 UPDATE civicrm_email SET on_hold = 0, hold_date = null
27 WHERE on_hold = 1 AND hold_date is not null AND contact_id in (" . implode(",", $this->_contactIds
) . ")";
28 CRM_Core_DAO
::executeQuery($queryString);
29 $sql = "SELECT ROW_COUNT( )";
30 $result = CRM_Core_DAO
::singleValueQuery($sql);
32 CRM_Core_Session
::setStatus(ts('%count email was found on hold and updated.', array(
34 'plural' => '%count emails were found on hold and updated.',
35 )), ts('Emails Restored'), 'success');
38 CRM_Core_Session
::setStatus(ts('The selected contact does not have an email on hold.', array(
40 'plural' => 'None of the selected contacts have an email on hold.',
41 )), ts('No Emails to Restore'), 'info');
45 CRM_Core_Session
::setStatus(ts('Please select one or more contact for this action'), ts('No Contacts Selected'), 'error');