/** * Build all the data structures needed to build the form. * * @return void */ 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."); } // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $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_Utils_System::appendBreadCrumb($breadCrumb); CRM_Utils_System::setTitle(ts('Print Contribution Receipts')); }
/** * build all the data structures needed to build the form * * @return void * @access 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 != 2\nAND {$this->_componentClause}"; $count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray); if ($count != 0) { CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.')); } // ensure that all contributions are generated online by pay later $query = "\nSELECT DISTINCT( source ) as source\nFROM civicrm_contribution\nWHERE {$this->_componentClause}"; $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray); while ($dao->fetch()) { if (strpos($dao->source, ts('Online Contribution')) === false && strpos($dao->source, ts('Online Event Registration')) === false) { CRM_Core_Error::statusBounce("<strong>Update Pending Contribution Status</strong> can only be used for pending online contributions (made using the 'Pay Later' option). The Source for these contributions starts with 'Online ...'. Please de-select any offline contributions and try again."); } } // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this); parent::preProcess(); // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); if ($cid) { CRM_Contact_Form_Task_EmailCommon::preProcessSingle($this, $cid); } else { parent::preProcess(); // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); } $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access 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 != 2\nAND {$this->_componentClause}"; $count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray); if ($count != 0) { CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.')); } // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $this->assign('single', $this->_single); }
/** * Build all the data structures needed to build the form. * * @return void */ 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); // set the redirection after actions $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); $url = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=view&reset=1&id={$id}&cid={$contactId}&context=contribution&selectedChild=contribute"); CRM_Core_Session::singleton()->pushUserContext($url); } else { parent::preProcess(); } // check that all the contribution ids have status Completed, Pending, Refunded. $this->_contributionStatusId = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $status = array('Completed', 'Pending', 'Refunded'); $statusId = array(); foreach ($this->_contributionStatusId as $key => $value) { if (in_array($value, $status)) { $statusId[] = $key; } } $Id = implode(",", $statusId); $query = "SELECT count(*) FROM civicrm_contribution WHERE contribution_status_id NOT IN ({$Id}) AND {$this->_componentClause}"; $count = CRM_Core_DAO::singleValueQuery($query); if ($count != 0) { CRM_Core_Error::statusBounce(ts('Please select only contributions with Completed, Pending, Refunded status.')); } // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $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_Utils_System::appendBreadCrumb($breadCrumb); $this->_selectedOutput = CRM_Utils_Request::retrieve('select', 'String', $this); $this->assign('selectedOutput', $this->_selectedOutput); if ($this->_selectedOutput == 'email') { CRM_Utils_System::setTitle(ts('Email Invoice')); } else { CRM_Utils_System::setTitle(ts('Print Contribution Invoice')); } }