Ejemplo n.º 1
0
 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = TRUE;
         $this->assign('totalSelectedContributions', 1);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have pending status
     $query = "\nSELECT count(*)\nFROM   civicrm_contribution\nWHERE  contribution_status_id != 1\nAND    {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query);
     if ($count != 0) {
         CRM_Core_Error::statusBounce("Please select only online contributions with Completed status.");
     }
     $this->assign('single', $this->_single);
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
     $breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this, FALSE);
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
 }
Ejemplo n.º 2
0
 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
     parent::preProcess();
     // we have all the participant ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
 }
Ejemplo n.º 3
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     // store case id if present
     $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, false);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
     if (!$cid && $this->_context != 'standalone') {
         parent::preProcess();
     }
     //early prevent, CRM-6209
     if (count($this->_contactIds) > CRM_Contact_Form_Task_EmailCommon::MAX_EMAILS_KILL_SWITCH) {
         CRM_Core_Error::statusBounce(ts('Please do not use this task to send a lot of emails (greater than %1). We recommend using CiviMail instead.', array(1 => CRM_Contact_Form_Task_EmailCommon::MAX_EMAILS_KILL_SWITCH)));
     }
     $this->assign('single', $this->_single);
     require_once 'CRM/Core/Permission.php';
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $this->assign('isAdmin', 1);
     }
 }
Ejemplo n.º 4
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     // store case id if present
     $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'String', $this, FALSE);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'String', $this, FALSE);
     // Allow request to specify email id rather than contact id
     $toEmailId = CRM_Utils_Request::retrieve('email_id', 'String', $this);
     if ($toEmailId) {
         $toEmail = civicrm_api('email', 'getsingle', array('version' => 3, 'id' => $toEmailId));
         if (!empty($toEmail['email']) && !empty($toEmail['contact_id'])) {
             $this->_toEmail = $toEmail;
         }
         if (!$cid) {
             $cid = $toEmail['contact_id'];
             $this->set('cid', $cid);
         }
     }
     if ($cid) {
         $cid = explode(',', $cid);
         $displayName = array();
         foreach ($cid as $val) {
             $displayName[] = CRM_Contact_BAO_Contact::displayName($val);
         }
         CRM_Utils_System::setTitle(implode(',', $displayName) . ' - ' . ts('Email'));
     } else {
         CRM_Utils_System::setTitle(ts('New Email'));
     }
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
     if (!$cid && $this->_context != 'standalone') {
         parent::preProcess();
     }
     //early prevent, CRM-6209
     if (count($this->_contactIds) > CRM_Contact_Form_Task_EmailCommon::MAX_EMAILS_KILL_SWITCH) {
         CRM_Core_Error::statusBounce(ts('Please do not use this task to send a lot of emails (greater than %1). We recommend using CiviMail instead.', array(1 => CRM_Contact_Form_Task_EmailCommon::MAX_EMAILS_KILL_SWITCH)));
     }
     $this->assign('single', $this->_single);
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $this->assign('isAdmin', 1);
     }
 }