function preProcess() { // Make sure case types have been configured for the component require_once 'CRM/Core/OptionGroup.php'; $caseType = CRM_Core_OptionGroup::values('case_type'); if (empty($caseType)) { $this->assign('notConfigured', 1); return; } $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); if ($this->_contactId) { $this->assign('contactId', $this->_contactId); // check logged in url permission require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } else { if ($this->_action & CRM_Core_Action::VIEW) { CRM_Core_Error::fatal('Contact Id is required for view action.'); } } $activityTypes = CRM_Case_PseudoConstant::activityType(); $this->assign('openCaseId', $activityTypes['Open Case']['id']); $this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']); $this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']); $this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']); }
/** * This function is the main function that is called when the page loads, it decides the which action has to be taken for the page. * * return null * @access public */ function run() { $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->assign('action', $this->_action); $this->assign('context', $this->_context); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); CRM_Pledge_Page_Tab::setContext(); if ($this->_action & CRM_Core_Action::UPDATE) { $this->edit(); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } else { $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this); $paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId); $this->assign('rows', $paymentDetails); $this->assign('pledgeId', $pledgeId); $this->assign('contactId', $this->_contactId); // check if we can process credit card contribs $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )"); if (count($processors) > 0) { $this->assign('newCredit', TRUE); } else { $this->assign('newCredit', FALSE); } // check is the user has view/edit signer permission $permission = 'view'; if (CRM_Core_Permission::check('edit pledges')) { $permission = 'edit'; } $this->assign('permission', $permission); } return parent::run(); }
function preProcess() { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); $contact = new CRM_Contact_BAO_Contact(); $contact->get('id', $this->_contactId); $this->_apiKey = $contact->api_key; $this->assign('apiKey', $this->_apiKey); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->assign('action', $this->_action); $isAdmin = CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Permission::check('edit all contacts'); $session = CRM_Core_Session::singleton(); $isMyself = $this->_contactId && $this->_contactId == $session->get('userID'); $this->assign('isAdmin', $isAdmin); $this->assign('isMyself', $isMyself); $urlParam = 'reset=1&action=add&cid=' . $this->_contactId; if ($this->_apiKey) { $urlParam = 'reset=1&action=edit&cid=' . $this->_contactId; } $this->assign('addApiKeyUrl', CRM_Utils_System::url('civicrm/contact/apikey', $urlParam)); }
/** * This function is the main function that is called when the page loads, it decides the which action has to be taken for the page. * * return null * @access public */ function run() { $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->assign('action', $this->_action); $this->assign('context', $this->_context); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); CRM_Pledge_Page_Tab::setContext(); if ($this->_action & CRM_Core_Action::UPDATE) { $this->edit(); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } else { $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this); $paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId); $this->assign('rows', $paymentDetails); $this->assign('pledgeId', $pledgeId); $this->assign('contactId', $this->_contactId); // check if we can process credit card contribs CRM_Core_Payment::allowBackofficeCreditCard($this); // check is the user has view/edit signer permission $permission = 'view'; if (CRM_Core_Permission::check('edit pledges')) { $permission = 'edit'; } $this->assign('permission', $permission); } return parent::run(); }
static function preProcessSingle(&$form, $cid) { $form->_contactIds = array($cid); // put contact display name in title for single contact mode require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::setTitle($cid); }
/** * Run the page. * * This method is called after the page is created. * * @return void */ public function run() { // get the emails for this contact $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $isDeleted = (bool) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'is_deleted'); $this->assign('contactId', $contactId); $title = CRM_Contact_Page_View::setTitle($contactId, $isDeleted); $this->assign('title', $title); // Check if this is default domain contact CRM-10482 $this->assign('domainContact', CRM_Contact_BAO_Contact::checkDomainContact($contactId)); // check logged in user permission CRM_Contact_Page_View::checkUserPermission($this, $contactId); // finally call parent parent::run(); }
function preProcess() { $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); if ($cid) { CRM_Contact_Page_View::setTitle($cid); } 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); } }
function preProcess() { $context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'view'); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->assign('action', $this->_action); if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit contributions')) { // demote to view since user does not have edit contrib rights $this->_permission = CRM_Core_Permission::VIEW; $this->assign('permission', 'view'); } }
function preProcess() { $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); //validate case configuration. require_once 'CRM/Case/BAO/Case.php'; $configured = CRM_Case_BAO_Case::isCaseConfigured($this->_contactId); $this->assign('notConfigured', !$configured['configured']); $this->assign('allowToAddNewCase', $configured['allowToAddNewCase']); $this->assign('redirectToCaseAdmin', $configured['redirectToCaseAdmin']); if (!$configured['configured'] || $configured['redirectToCaseAdmin']) { return; } $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if ($this->_contactId) { $this->assign('contactId', $this->_contactId); // check logged in user permission require_once 'CRM/Contact/Page/View.php'; if ($this->_id && $this->_action & CRM_Core_Action::VIEW) { //user might have special permissions to view this case, CRM-5666 if (!CRM_Core_Permission::check('access all cases and activities')) { $session = CRM_Core_Session::singleton(); $userCases = CRM_Case_BAO_Case::getCases(false, $session->get('userID')); if (!array_key_exists($this->_id, $userCases)) { CRM_Core_Error::fatal(ts('You are not authorized to access this page.')); } } } else { CRM_Contact_Page_View::checkUserPermission($this); } // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } else { if ($this->_action & CRM_Core_Action::VIEW) { CRM_Core_Error::fatal('Contact Id is required for view action.'); } } $activityTypes = CRM_Case_PseudoConstant::activityType(); $this->assign('openCaseId', $activityTypes['Open Case']['id']); $this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']); $this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']); $this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']); }
/** * 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) { CRM_Contact_Page_View::setTitle($cid); } 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); } }
function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if ($this->_id && CRM_Core_BAO_Note::getNotePrivacyHidden($this->_id)) { CRM_Core_Error::statusBounce(ts('You do not have access to this note.')); } $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); CRM_Utils_System::setTitle(ts('Notes for') . ' ' . $displayName); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->assign('action', $this->_action); }
/** * Function to build the form * * @return None * @access public */ function preProcess() { $this->_cdType = CRM_Utils_Array::value('type', $_GET); $this->assign('cdType', FALSE); if ($this->_cdType) { $this->assign('cdType', TRUE); return CRM_Custom_Form_CustomData::preProcess($this); } $this->_atypefile = CRM_Utils_Array::value('atypefile', $_GET); $this->assign('atypefile', FALSE); if ($this->_atypefile) { $this->assign('atypefile', TRUE); } $session = CRM_Core_Session::singleton(); $this->_currentUserId = $session->get('userID'); $this->_currentlyViewedContactId = $this->get('contactId'); if (!$this->_currentlyViewedContactId) { $this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); } $this->assign('contactId', $this->_currentlyViewedContactId); if ($this->_currentlyViewedContactId) { CRM_Contact_Page_View::setTitle($this->_currentlyViewedContactId); } //give the context. if (!isset($this->_context)) { $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if (CRM_Contact_Form_Search::isSearchContext($this->_context)) { $this->_context = 'search'; } elseif (!in_array($this->_context, array('dashlet', 'dashletFullscreen')) && $this->_currentlyViewedContactId) { $this->_context = 'activity'; } $this->_compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this); } $this->assign('context', $this->_context); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this); if ($this->_action & CRM_Core_Action::DELETE) { if (!CRM_Core_Permission::check('delete activities')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } } //CRM-6957 //when we come from contact search, activity id never comes. //so don't try to get from object, it might gives you wrong one. // if we're not adding new one, there must be an id to // an activity we're trying to work on. if ($this->_action != CRM_Core_Action::ADD && get_class($this->controller) != 'CRM_Contact_Controller_Search') { $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this); } $this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this); $this->assign('atype', $this->_activityTypeId); //check for required permissions, CRM-6264 if ($this->_activityId && in_array($this->_action, array(CRM_Core_Action::UPDATE, CRM_Core_Action::VIEW)) && !CRM_Activity_BAO_Activity::checkPermission($this->_activityId, $this->_action)) { CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); } if ($this->_action & CRM_Core_Action::VIEW && CRM_Activity_BAO_Activity::checkPermission($this->_activityId, CRM_Core_Action::UPDATE)) { $this->assign('permission', 'edit'); } if (!$this->_activityTypeId && $this->_activityId) { $this->_activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_type_id'); } //Assigning Activity type name if ($this->_activityTypeId) { $activityTName = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'name'); if ($activityTName[$this->_activityTypeId]) { $this->_activityTypeName = $activityTName[$this->_activityTypeId]; $this->assign('activityTName', $activityTName[$this->_activityTypeId]); } } // Assign pageTitle to be "Activity - "+ activity name if (isset($activityTName)) { $pageTitle = 'Activity - ' . CRM_Utils_Array::value($this->_activityTypeId, $activityTName); $this->assign('pageTitle', $pageTitle); } //check the mode when this form is called either single or as //search task action if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId) { $this->_single = TRUE; $this->assign('urlPath', 'civicrm/activity'); } else { //set the appropriate action $url = CRM_Utils_System::currentPath(); $urlArray = explode('/', $url); $searchPath = array_pop($urlArray); $searchType = 'basic'; $this->_action = CRM_Core_Action::BASIC; switch ($searchPath) { case 'basic': $searchType = $searchPath; $this->_action = CRM_Core_Action::BASIC; break; case 'advanced': $searchType = $searchPath; $this->_action = CRM_Core_Action::ADVANCED; break; case 'builder': $searchType = $searchPath; $this->_action = CRM_Core_Action::PROFILE; break; case 'custom': $this->_action = CRM_Core_Action::COPY; $searchType = $searchPath; break; } parent::preProcess(); $this->_single = FALSE; $this->assign('urlPath', "civicrm/contact/search/{$searchType}"); $this->assign('urlPathVar', "_qf_Activity_display=true&qfKey={$this->controller->_key}"); } $this->assign('single', $this->_single); $this->assign('action', $this->_action); if ($this->_action & CRM_Core_Action::VIEW) { // get the tree of custom fields $this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Activity', $this, $this->_activityId, 0, $this->_activityTypeId); } if ($this->_activityTypeId) { //set activity type name and description to template list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId); $this->assign('activityTypeName', $this->_activityTypeName); $this->assign('activityTypeDescription', $activityTypeDescription); } // set user context $urlParams = $urlString = NULL; $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this); if (!$qfKey) { $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); } //validate the qfKey if (!CRM_Utils_Rule::qfKey($qfKey)) { $qfKey = NULL; } if ($this->_context == 'fulltext') { $keyName = '&qfKey'; $urlParams = 'force=1'; $urlString = 'civicrm/contact/search/custom'; if ($this->_action == CRM_Core_Action::UPDATE) { $keyName = '&key'; $urlParams .= '&context=fulltext&action=view'; $urlString = 'civicrm/contact/view/activity'; } if ($qfKey) { $urlParams .= "{$keyName}={$qfKey}"; } $this->assign('searchKey', $qfKey); } elseif (in_array($this->_context, array('standalone', 'home', 'dashlet', 'dashletFullscreen'))) { $urlParams = 'reset=1'; $urlString = 'civicrm/dashboard'; } elseif ($this->_context == 'search') { $urlParams = 'force=1'; if ($qfKey) { $urlParams .= "&qfKey={$qfKey}"; } $path = CRM_Utils_System::currentPath(); if ($this->_compContext == 'advanced') { $urlString = 'civicrm/contact/search/advanced'; } elseif ($path == 'civicrm/contact/search' || $path == 'civicrm/contact/search/advanced' || $path == 'civicrm/contact/search/custom') { $urlString = $path; } else { $urlString = 'civicrm/activity/search'; } $this->assign('searchKey', $qfKey); } elseif ($this->_context != 'caseActivity') { $urlParams = "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity"; $urlString = 'civicrm/contact/view'; } if ($urlString) { $session->pushUserContext(CRM_Utils_System::url($urlString, $urlParams)); } // hack to retrieve activity type id from post variables if (!$this->_activityTypeId) { $this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST); } // when custom data is included in this page if (CRM_Utils_Array::value('hidden_custom', $_POST)) { // we need to set it in the session for the below code to work // CRM-3014 //need to assign custom data subtype to the template $this->set('type', 'Activity'); $this->set('subType', $this->_activityTypeId); $this->set('entityId', $this->_activityId); CRM_Custom_Form_CustomData::preProcess($this); CRM_Custom_Form_CustomData::buildQuickForm($this); CRM_Custom_Form_CustomData::setDefaultValues($this); } // add attachments part CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId, NULL, TRUE); // figure out the file name for activity type, if any if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) { $this->assign('activityTypeFile', $this->_activityTypeFile); $this->assign('crmDir', $this->_crmDir); } $this->setFields(); if ($this->_activityTypeFile) { $className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}"; $className::preProcess($this); } $this->_values = $this->get('values'); if (!is_array($this->_values)) { $this->_values = array(); if (isset($this->_activityId) && $this->_activityId) { $params = array('id' => $this->_activityId); CRM_Activity_BAO_Activity::retrieve($params, $this->_values); } $this->set('values', $this->_values); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if ($context == 'standalone') { $this->_action = CRM_Core_Action::ADD; } else { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true); require_once 'CRM/Contact/BAO/Contact.php'; $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); $this->assign('contactId', $this->_contactId); $this->assign('displayName', $displayName); // check logged in url permission require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } $this->assign('action', $this->_action); if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit grants')) { $this->_permission = CRM_Core_Permission::VIEW; // demote to view since user does not have edit grant rights $this->assign('permission', 'view'); } }
static function preProcessSingle(&$form, $cid) { $form->_contactIds = array($cid); // put contact display name in title for single contact mode CRM_Contact_Page_View::setTitle($cid); }
/** * Function to build the form * * @return None * @access public */ function preProcess() { $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this); if (!$this->_context) { $this->_context = 'caseActivity'; } $this->_crmDir = 'Case'; $this->assign('context', $this->_context); $result = parent::preProcess(); $scheduleStatusId = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'); $this->assign('scheduleStatusId', $scheduleStatusId); if ($this->_cdType || $this->_addAssigneeContact || $this->_addTargetContact) { return $result; } if (!$this->_caseId && $this->_activityId) { $this->_caseId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $this->_activityId, 'case_id', 'activity_id'); } if ($this->_caseId) { $this->assign('caseId', $this->_caseId); } if (!$this->_caseId || !$this->_activityId && !$this->_activityTypeId) { CRM_Core_Error::fatal('required params missing.'); } //check for case activity access. if (!CRM_Case_BAO_Case::accessCiviCase()) { CRM_Core_Error::fatal(ts('You are not authorized to access this page.')); } //validate case id. if ($this->_caseId && !CRM_Core_Permission::check('access all cases and activities')) { $session = CRM_Core_Session::singleton(); $allCases = CRM_Case_BAO_Case::getCases(TRUE, $session->get('userID')); if (!array_key_exists($this->_caseId, $allCases)) { CRM_Core_Error::fatal(ts('You are not authorized to access this page.')); } } //validate case activity id. if ($this->_activityId && $this->_action & CRM_Core_Action::UPDATE) { $valid = CRM_Case_BAO_Case::checkPermission($this->_activityId, 'edit', $this->_activityTypeId); if (!$valid) { CRM_Core_Error::fatal(ts('You are not authorized to access this page.')); } } $this->_caseType = CRM_Case_BAO_Case::getCaseType($this->_caseId, 'name'); $this->assign('caseType', $this->_caseType); $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process(); $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients(); $this->assign('multiClient', $isMultiClient); if ($isMultiClient) { $clients = CRM_Case_BAO_Case::getContactNames($this->_caseId); $this->assign('client_names', $clients); } else { $clientName = $this->_getDisplayNameById($this->_currentlyViewedContactId); $this->assign('client_name', $clientName); } // set context for pushUserContext and for statusBounce if ($this->_context == 'fulltext') { if ($this->_action == CRM_Core_Action::UPDATE || $this->_action == CRM_Core_Action::DELETE) { $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1&context={$this->_context}"); } else { $url = CRM_Utils_System::url('civicrm/contact/search/custom', 'force=1'); } } else { $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1"); } if (!$this->_activityId) { $caseTypes = CRM_Case_PseudoConstant::caseType(); if (empty($caseTypes) && $this->_activityTypeName == 'Change Case Type' && !$this->_caseId) { $url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1"); $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); CRM_Core_Error::statusBounce(ts("You do not have any active Case Types")); } // check if activity count is within the limit $xmlProcessor = new CRM_Case_XMLProcessor_Process(); $activityInst = $xmlProcessor->getMaxInstance($this->_caseType); // If not bounce back and also provide activity edit link if (isset($activityInst[$this->_activityTypeName])) { $activityCount = CRM_Case_BAO_Case::getCaseActivityCount($this->_caseId, $this->_activityTypeId); if ($activityCount >= $activityInst[$this->_activityTypeName]) { if ($activityInst[$this->_activityTypeName] == 1) { $atArray = array('activity_type_id' => $this->_activityTypeId); $activities = CRM_Case_BAO_Case::getCaseActivity($this->_caseId, $atArray, $this->_currentUserId); $activities = array_keys($activities); $activities = $activities[0]; $editUrl = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$this->_caseId}&action=update&id={$activities}"); } CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", array(1 => $this->_activityTypeName, 2 => "Do you want to <a href='{$editUrl}'>edit the existing activity</a> ?")), $url); } } } if ($this->_currentlyViewedContactId) { CRM_Contact_Page_View::setTitle($this->_currentlyViewedContactId); } // CRM_Utils_System::setTitle( $this->_activityTypeName ); $session = CRM_Core_Session::singleton(); $session->pushUserContext($url); }
function preProcess() { $context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); if ($context == 'standalone') { $this->_action = CRM_Core_Action::ADD; } else { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, empty($this->_id)); if (empty($this->_contactId)) { $this->_contactId = civicrm_api3('contribution', 'getvalue', array('id' => $this->_id, 'return' => 'contact_id')); } $this->assign('contactId', $this->_contactId); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); } $this->assign('action', $this->_action); if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit contributions')) { // demote to view since user does not have edit contrib rights $this->_permission = CRM_Core_Permission::VIEW; $this->assign('permission', 'view'); } }
function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); require_once 'CRM/Core/BAO/Note.php'; if ($this->_id && CRM_Core_BAO_Note::getNotePrivacyHidden($this->_id)) { CRM_Core_Error::statusBounce(ts('You do not have access to this note.')); } $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true); $this->assign('contactId', $this->_contactId); // check logged in url permission require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); $this->assign('action', $this->_action); }
function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->assign('action', $this->_action); }
/** * Heart of the viewing process. The runner gets all the meta data for * the contact and calls the appropriate type of page to view. * * @return void * @access public * */ function preProcess() { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true); $this->assign('contactId', $this->_contactId); // check logged in url permission require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); $this->assign('action', $this->_action); // also create the form element for the activity links box $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityLinks', ts('Activity Links'), null); $controller->setEmbedded(true); $controller->run(); }
/** * Heart of the viewing process. The runner gets all the meta data for * the contact and calls the appropriate type of page to view. * * @return void * @access public * */ function preProcess() { $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); $this->assign('contactId', $this->_contactId); //FIX ME: need to fix this conflict $this->assign('contactID', $this->_contactId); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->assign('action', $this->_action); // also create the form element for the activity links box $controller = new CRM_Core_Controller_Simple('CRM_Activity_Form_ActivityLinks', ts('Activity Links'), NULL, FALSE, FALSE, TRUE); $controller->setEmbedded(TRUE); $controller->run(); }
function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true); $this->assign('contactId', $this->_contactId); // check logged in url permission require_once 'CRM/Contact/Page/View.php'; CRM_Contact_Page_View::checkUserPermission($this); // set page title CRM_Contact_Page_View::setTitle($this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); $this->assign('action', $this->_action); }