/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { parent::preProcess(); require_once 'CRM/Utils/Rule.php'; $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= '&qfKey=' . $qfKey; } $session = CRM_Core_Session::singleton(); $url = CRM_Utils_System::url('civicrm/contact/search/custom', $urlParams); $session->replaceUserContext($url); //get the survey id from user submitted values. $this->_surveyId = CRM_Utils_Array::value('survey_id', $this->get('formValues')); $isHeld = CRM_Utils_Array::value('status_id', $this->get('formValues')); if (!$this->_surveyId || !$isHeld) { CRM_Core_Error::statusBounce(ts("Please search with 'Is Held' and 'Survey Id' filters to apply this action.")); } $session = CRM_Core_Session::singleton(); if (empty($this->_contactIds) || !$session->get('userID')) { CRM_Core_Error::statusBounce(ts("Could not find contacts for release voters resevation Or Missing Interviewer contact.")); } $this->_interviewerId = $session->get('userID'); $surveyDetails = array(); $params = array('id' => $this->_surveyId); $this->_surveyDetails = CRM_Campaign_BAO_Survey::retrieve($params, $surveyDetails); $numVoters = CRM_Core_DAO::singleValueQuery("SELECT COUNT(*) FROM " . self::ACTIVITY_SURVEY_DETAIL_TABLE . " WHERE status_id = 'H' AND survey_id = %1 AND interviewer_id = %2", array(1 => array($this->_surveyId, 'Integer'), 2 => array($this->_interviewerId, 'Integer'))); if (!isset($numVoters) || $numVoters < 1) { CRM_Core_Error::statusBounce(ts("All voters held by you are already released for this survey.")); } $this->assign('surveyTitle', $surveyDetails['title']); }
function postProcess() { $values = $this->exportValues(); // find/determine household name if ($values['hh_option'] == 'new') { // extract the name: if ($values['household_name_pattern'] == 'custom') { $household_name = $values['household_name']; } else { $household_name = $values['household_name_pattern']; } $household = civicrm_api3('Contact', 'create', array('contact_type' => 'Household', 'household_name' => $household_name)); $household_id = $household['id']; } elseif ($values['hh_option'] == 'existing') { $household_id = (int) $values['existing_household']; } else { // has to be the selected_XXX preselected household change $household_id = (int) substr($values['hh_option'], 9); } // find contact_ids $contact_ids = $values['hh_contacts']; // ...and pass the ball to the merge view $mergeview_url = CRM_Utils_System::url('civicrm/household/mergeview', "hid={$household_id}&oids={$contact_ids}"); CRM_Utils_System::redirect($mergeview_url); parent::postProcess(); }
/** * 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) { // not sure why this is needed :( // also add the cid params to the Menu array CRM_Core_Menu::addParam('cid', $cid); // create menus .. $startWeight = CRM_Core_Menu::getMaxWeight('civicrm/contact/view'); $startWeight++; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight); $this->_contactIds = array($cid); $this->_single = true; $smsNumbers = CRM_Contact_BAO_Contact::allPhones($cid, 'Mobile'); $this->_emails = array(); $toName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'); foreach ($smsNumbers as $number => $item) { $this->_smsNumbers[$number] = '"' . $toName . '" <' . $number . '> ' . $item['locationType']; if ($item['is_primary']) { $this->_smsNumbers[$number] .= ' ' . ts('(preferred)'); } $this->_smsNumbers[$number] = htmlspecialchars($this->_emails[$email]); } } else { parent::preProcess(); } $this->assign('single', $this->_single); }
/** * Set variables up before form is built. * * @return void */ public function preProcess() { if (CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") { CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/"))); } $this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL); // when user come from search context. $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); if ($this->_searchBasedMailing) { $searchParams = $this->controller->exportValues(); // number of records that were selected - All or Few. $this->_resultSelectOption = $searchParams['radio_ts']; if (CRM_Utils_Array::value('task', $searchParams) == 20) { parent::preProcess(); } } $session = CRM_Core_Session::singleton(); if ($this->_searchBasedMailing) { $config = CRM_Core_Config::singleton(); $path = CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET); $qfKey = CRM_Utils_Array::value('qfKey', $_GET); if ($qfKey) { $session->pushUserContext(CRM_Utils_System::url($path, "qfKey={$qfKey}")); } else { $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1')); } } elseif (strpos($session->readUserContext(), 'civicrm/mailing') === FALSE) { // use previous context unless mailing is not schedule, CRM-4290 $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1')); } }
/** * Build all the data structures needed to build the form. * * @return void */ public function preProcess() { parent::preprocess(); // set print view, so that print templates are called $this->controller->setPrint(1); $this->assign('id', $this->get('id')); $this->assign('pageTitle', ts('CiviCRM Contact Listing')); $params = $this->get('queryParams'); if (!empty($this->_contactIds)) { //using _contactIds field for creating params for query so that multiple selections on multiple pages //can be printed. foreach ($this->_contactIds as $contactId) { $params[] = array(CRM_Core_Form::CB_PREFIX . $contactId, '=', 1, 0, 0); } } // create the selector, controller and run - store results in session $fv = $this->get('formValues'); $returnProperties = $this->get('returnProperties'); $sortID = NULL; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $includeContactIds = FALSE; if ($fv['radio_ts'] == 'ts_sel') { $includeContactIds = TRUE; } $selectorName = $this->controller->selectorName(); require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php'; $returnP = isset($returnPropeties) ? $returnPropeties : ""; $customSearchClass = $this->get('customSearchClass'); $selector = new $selectorName($customSearchClass, $fv, $params, $returnP, $this->_action, $includeContactIds); $controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN); $controller->setEmbedded(TRUE); $controller->run(); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { parent::preprocess(); // set print view, so that print templates are called $this->controller->setPrint(1); $this->assign('id', $this->get('id')); $this->assign('pageTitle', ts('CiviCRM Contact Listing')); // create the selector, controller and run - store results in session $fv = $this->get('formValues'); $params = $this->get('queryParams'); $returnProperties = $this->get('returnProperties'); $sortID = null; if ($this->get(CRM_Utils_Sort::SORT_ID)) { $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION)); } $includeContactIds = false; if ($fv['radio_ts'] == 'ts_sel') { $includeContactIds = true; } $selectorName = $this->controller->selectorName(); require_once str_replace('_', DIRECTORY_SEPARATOR, $selectorName) . '.php'; $returnP = isset($returnPropeties) ? $returnPropeties : ""; $customSearchClass = $this->get('customSearchClass'); eval('$selector = new ' . $selectorName . '( $customSearchClass, $fv, $params, $returnP, $this->_action, $includeContactIds );'); $controller = new CRM_Core_Selector_Controller($selector, null, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN); $controller->setEmbedded(true); $controller->run(); }
/** * Build all the data structures needed to build the form. * * @return void */ public function preProcess() { // initialize the task and row fields parent::preProcess(); $session = CRM_Core_Session::singleton(); // Step 1: if we can't get team ID, there's no point continuing. $this->_id = $this->get('amtgID'); if (!isset($this->_id)) { $this->_id = CRM_Utils_Request::retrieve('amtgID', 'Positive'); } if (!isset($this->_id)) { $this->_id = $session->get('amtgID'); } $session->set('amtgID', $this->_id); //@todo Exit more gracefully if id still isn't set if (!isset($this->_id)) { return; } $this->_teamValues = array(); $params = array('id' => $this->_id); $this->_team = CRM_Contact_BAO_Group::retrieve($params, $this->_teamValues); $this->_context = $this->get('context'); $this->findTeamPlayers(); $this->findEligiblePlayers(); $session = CRM_Core_Session::singleton(); //$urlParams = 'reset=1&force=1'; $session->replaceUserContext(CRM_Utils_System::url('civicrm/tournament/team')); //search', $urlParams)); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { //check for permission to edit contributions if (!CRM_Core_Permission::check('issue cdn tax receipts')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page', array('domain' => 'org.civicrm.cdntaxreceipts'))); } parent::preProcess(); $thisYear = date("Y"); $this->_years = array($thisYear, $thisYear - 1, $thisYear - 2); $receipts = array(); foreach ($this->_years as $year) { $receipts[$year] = array('email' => 0, 'print' => 0, 'total' => 0, 'contrib' => 0); } // count and categorize contributions foreach ($this->_contactIds as $id) { foreach ($this->_years as $year) { list($issuedOn, $receiptId) = cdntaxreceipts_annual_issued_on($id, $year); $eligible = count(cdntaxreceipts_contributions_not_receipted($id, $year)); if ($eligible > 0) { list($method, $email) = cdntaxreceipts_sendMethodForContact($id); $receipts[$year][$method]++; $receipts[$year]['total']++; $receipts[$year]['contrib'] += $eligible; } } } $this->_receipts = $receipts; }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { /* * initialize the task and row fields */ parent::preProcess(); }
/** * Build all the data structures needed to build the form. */ public function preProcess() { // initialize the task and row fields parent::preProcess(); $this->_context = $this->get('context'); $this->_id = $this->get('amtgID'); }
public function preProcess() { parent::preProcess(); list($groupId, $ssId) = $this->createHiddenGroup(); $mailing = civicrm_api3('Mailing', 'create', array('name' => "", 'campaign_id' => NULL, 'replyto_email' => "", 'subject' => "", 'body_html' => "", 'body_text' => "", 'groups' => array('include' => array($groupId), 'exclude' => array(), 'base' => array()), 'mailings' => array('include' => array(), 'exclude' => array()))); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mailing['id'])); }
/** * Build all the data structures needed to build the form * * @access public * * @return void */ function preProcess() { parent::preProcess(); // get rows $rows = $this->getContactRows(); // our array now contains all contacts who can be synced to WordPress $this->assign('rows', $rows); }
/** * Build all the data structures needed to build the form. */ public function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); $this->_searchKey = CRM_Utils_Request::retrieve('key', 'String', $this); // sort out whether it’s a delete-to-trash, delete-into-oblivion or restore (and let the template know) $values = $this->controller->exportValues(); $this->_skipUndelete = (CRM_Core_Permission::check('access deleted contacts') and (CRM_Utils_Request::retrieve('skip_undelete', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::DELETE_PERMANENTLY)); $this->_restore = (CRM_Utils_Request::retrieve('restore', 'Boolean', $this) or CRM_Utils_Array::value('task', $values) == CRM_Contact_Task::RESTORE); if ($this->_restore && !CRM_Core_Permission::check('access deleted contacts')) { CRM_Core_Error::fatal(ts('You do not have permission to access this contact.')); } elseif (!CRM_Core_Permission::check('delete contacts')) { CRM_Core_Error::fatal(ts('You do not have permission to delete this contact.')); } $this->assign('trash', Civi::settings()->get('contact_undelete') and !$this->_skipUndelete); $this->assign('restore', $this->_restore); if ($this->_restore) { CRM_Utils_System::setTitle(ts('Restore Contact')); } if ($cid) { if (!CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT)) { CRM_Core_Error::fatal(ts('You do not have permission to delete this contact. Note: you can delete contacts if you can edit them.')); } elseif (CRM_Contact_BAO_Contact::checkDomainContact($cid)) { CRM_Core_Error::fatal(ts('This contact is a special one for the contact information associated with the CiviCRM installation for this domain. No one is allowed to delete it because the information is used for special system purposes.')); } $this->_contactIds = array($cid); $this->_single = TRUE; $this->assign('totalSelectedContacts', 1); } else { parent::preProcess(); } $this->_sharedAddressMessage = $this->get('sharedAddressMessage'); if (!$this->_restore && !$this->_sharedAddressMessage) { // we check for each contact for shared contact address $sharedContactList = array(); $sharedAddressCount = 0; foreach ($this->_contactIds as $contactId) { // check if a contact that is being deleted has any shared addresses $sharedAddressMessage = CRM_Core_BAO_Address::setSharedAddressDeleteStatus(NULL, $contactId, TRUE); if ($sharedAddressMessage['count'] > 0) { $sharedAddressCount += $sharedAddressMessage['count']; $sharedContactList = array_merge($sharedContactList, $sharedAddressMessage['contactList']); } } $this->_sharedAddressMessage = array('count' => $sharedAddressCount, 'contactList' => $sharedContactList); if ($sharedAddressCount > 0) { if (count($this->_contactIds) > 1) { // more than one contact deleted $message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', array('plural' => 'One or more selected contacts have address records which are shared with %count other contacts.', 'count' => $sharedAddressCount)); } else { // only one contact deleted $message = ts('This contact has an address record which is shared with 1 other contact.', array('plural' => 'This contact has an address record which is shared with %count other contacts.', 'count' => $sharedAddressCount)); } CRM_Core_Session::setStatus($message . ' ' . ts('Shared addresses will not be removed or altered but will no longer be shared.'), ts('Shared Addesses Owner')); } // set in form controller so that queries are not fired again $this->set('sharedAddressMessage', $this->_sharedAddressMessage); } }
public function preProcess() { $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); CRM_Contact_Form_Task_SMSCommon::preProcessProvider($this); if (!$cid && $this->_context != 'standalone') { parent::preProcess(); } $this->assign('single', $this->_single); if (CRM_Core_Permission::check('administer CiviCRM')) { $this->assign('isAdmin', 1); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { parent::preProcess(); // display name and email of all contact ids $contactIDs = implode(',', $this->_contactIds); $query = "\nSELECT c.id as contact_id, c.display_name as name,\n c.contact_type as contact_type, e.email as email\nFROM civicrm_contact c, civicrm_email e\nWHERE e.contact_id = c.id\nAND e.is_primary = 1\nAND c.id IN ( {$contactIDs} )"; $rows = array(); $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $rows[] = array('id' => $dao->contact_id, 'name' => $dao->name, 'contact_type' => $dao->contact_type, 'email' => $dao->email); } $this->assign('rows', $rows); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', $this, false); $lid = CRM_Utils_Request::retrieve('lid', $this, false); if ($cid) { $this->_contactIds = array($cid); $this->_single = true; } else { parent::preProcess(); } $this->createLocation($this->_contactIds, $lid); $this->assign('single', $this->_single); }
public function preProcess() { parent::preProcess(); // TODO: These would probably not be needed if the logic in \CRM_Simplemail_BAO_SimpleMail::createSmartContactGroupForSearchContacts() is moved into this class' postProcess() method simplemail_civicrm_addToSessionScope('createdFromSearch', TRUE); simplemail_civicrm_addToSessionScope('contactCountFromSearch', count($this->_contactIds)); simplemail_civicrm_addToSessionScope('contactIds', $this->_contactIds); simplemail_civicrm_addToSessionScope('searchParams', $this->controller->exportValues()); simplemail_civicrm_addToSessionScope('formValues', $this->get('formValues')); simplemail_civicrm_addToSessionScope('customSearchId', $this->get('customSearchID')); simplemail_civicrm_addToSessionScope('context', $this->get('context')); CRM_Utils_System::redirect('/civicrm/simple-mail#/mailings/new'); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); // store case id if present $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, false); $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); if ($cid) { CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid); } else { parent::preProcess(); } $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { //check for delete if (!CRM_Core_Permission::check('delete contacts')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); if ($cid) { $this->_contactIds = array($cid); $this->_single = true; $this->assign('totalSelectedContacts', 1); } else { parent::preProcess(); } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { //when user come from search context. $context = $this->get('context'); if ($context == 'search') { $searchParams = $this->controller->exportValues(); if (CRM_Utils_Array::value('task', $searchParams) == 20) { parent::preProcess(); } } // use previous context unless mailing is not schedule, CRM-4290 $session =& CRM_Core_Session::singleton(); if (strpos($session->readUserContext(), 'civicrm/mailing') === false) { $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1')); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { parent::preProcess(); require_once 'CRM/Utils/Rule.php'; $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= '&qfKey=' . $qfKey; } $session = CRM_Core_Session::singleton(); $url = CRM_Utils_System::url('civicrm/contact/search/custom', $urlParams); $session->replaceUserContext($url); if (empty($this->_contactIds) || !$session->get('userID')) { CRM_Core_Error::statusBounce(ts("Could not find contacts for voter reservation Or Missing Interviewer contact.")); } $this->_interviewerId = $session->get('userID'); }
/** * 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); if ($cid || $this->_context == 'standalone') { CRM_Contact_Form_Task_EmailCommon::preProcessSingle($this, $cid); } else { parent::preProcess(); } $this->assign('single', $this->_single); require_once 'CRM/Core/Permission.php'; if (CRM_Core_Permission::check('administer CiviCRM')) { $this->assign('isAdmin', 1); } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { //when user come from search context. require_once 'CRM/Contact/Form/Search.php'; $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); if ($this->_searchBasedMailing) { $searchParams = $this->controller->exportValues(); if (CRM_Utils_Array::value('task', $searchParams) == 20) { parent::preProcess(); } } // use previous context unless mailing is not schedule, CRM-4290 $session = CRM_Core_Session::singleton(); if (strpos($session->readUserContext(), 'civicrm/mailing') === false) { $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1')); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $this->skipOnHold = $this->skipDeceased = FALSE; CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this); // store case id if present $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, FALSE); // retrieve contact ID if this is 'single' mode $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); if ($cid) { CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid); $this->_single = TRUE; $this->_cid = $cid; } else { parent::preProcess(); } $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', $this, false); if ($cid) { // not sure why this is needed :( // also add the cid params to the Menu array CRM_Utils_Menu::addParam('cid', $cid); // create menus .. $startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view'); $startWeight++; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight); $this->_contactIds = array($cid); $this->_single = true; $this->assign('totalSelectedContacts', 1); } else { parent::preProcess(); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { //check for delete if (!CRM_Core_Permission::check('delete contacts')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); if ($cid) { require_once 'CRM/Contact/BAO/Contact/Permission.php'; if (!CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT)) { CRM_Core_Error::fatal(ts('You do not have permission to delete this contact. Note: you can delete contacts if you can edit them.')); } $this->_contactIds = array($cid); $this->_single = true; $this->assign('totalSelectedContacts', 1); } else { parent::preProcess(); } }
/** * Build all the data structures needed to build the form. */ public function preProcess() { parent::preProcess(); $statusMsg = NULL; $contactIds = array(); if (is_array($this->_contactIds)) { $contactIds = array_unique($this->_contactIds); } if (count($contactIds) != 2) { $statusMsg = ts('Merge operation requires selecting two contacts.'); } // do check for same contact type. $contactTypes = array(); if (!$statusMsg) { $sql = "SELECT contact_type FROM civicrm_contact WHERE id IN (" . implode(',', $contactIds) . ")"; $contact = CRM_Core_DAO::executeQuery($sql); while ($contact->fetch()) { $contactTypes[$contact->contact_type] = TRUE; if (count($contactTypes) > 1) { break; } } if (count($contactTypes) > 1) { $statusMsg = ts('Selected records must all be the same contact type (i.e. all Individuals).'); } } if ($statusMsg) { CRM_Core_Error::statusBounce($statusMsg); } // redirect to merge form directly. $cid = $contactIds[0]; $oid = $contactIds[1]; //don't allow to delete logged in user. $session = CRM_Core_Session::singleton(); if ($oid == $session->get('userID')) { $oid = $cid; $cid = $session->get('userID'); } $url = CRM_Utils_System::url('civicrm/contact/merge', "reset=1&cid={$cid}&oid={$oid}"); // redirect to merge page. CRM_Utils_System::redirect($url); }
/** * 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); } }
/** * Build all the data structures needed to build the form. * * @return void */ public function preProcess() { // initialize the task and row fields parent::preProcess(); $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); $validate = FALSE; //validations if (count($this->_contactIds) > $this->_maxContacts) { CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch Update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(1 => $this->_maxContacts, 2 => count($this->_contactIds))), ts('Maximum Exceeded'), 'error'); $validate = TRUE; } if (CRM_Contact_BAO_Contact_Utils::checkContactType($this->_contactIds)) { CRM_Core_Session::setStatus(ts("Batch update requires that all selected contacts be the same basic type (e.g. all Individuals OR all Organizations...). Please modify your selection and try again."), ts('Contact Type Mismatch'), 'error'); $validate = TRUE; } // than redirect if ($validate) { CRM_Utils_System::redirect($this->_userContext); } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { if (CRM_Core_BAO_MailSettings::defaultDomain() == "FIXME.ORG") { CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'), 2 => "http://book.civicrm.org/user/initial-set-up/email-system-configuration"))); } //when user come from search context. $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context')); if ($this->_searchBasedMailing) { $searchParams = $this->controller->exportValues(); // number of records that were selected - All or Few. $this->_resultSelectOption = $searchParams['radio_ts']; if (CRM_Utils_Array::value('task', $searchParams) == 20) { parent::preProcess(); } } // use previous context unless mailing is not schedule, CRM-4290 $session = CRM_Core_Session::singleton(); if (strpos($session->readUserContext(), 'civicrm/mailing') === FALSE) { $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1')); } }