Exemplo n.º 1
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
 }
Exemplo n.º 2
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->skipOnHold = $this->skipDeceased = FALSE;
     parent::preProcess();
     $this->setContactIDs();
     CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
 }
Exemplo n.º 3
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviMember', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     parent::preProcess();
 }
Exemplo n.º 4
0
 /**
  * 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 membership ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
 }
Exemplo n.º 5
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     // initialize the task and row fields
     parent::preProcess();
     //get the contact read only fields to display.
     $readOnlyFields = array_merge(array('sort_name' => ts('Name')), CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options', TRUE, NULL, FALSE, 'name', TRUE));
     //get the read only field data.
     $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1);
     $contactDetails = CRM_Contact_BAO_Contact_Utils::contactDetails($this->_memberIds, 'CiviMember', $returnProperties);
     $this->assign('contactDetails', $contactDetails);
     $this->assign('readOnlyFields', $readOnlyFields);
 }
Exemplo n.º 6
0
 /**
  * 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()
 {
     parent::preProcess();
     $rows = array();
     // display name and membership details of all selected contacts
     $memberIDs = implode(',', $this->_memberIds);
     $query = "\n    SELECT mem.start_date  as start_date,\n           mem.end_date    as end_date,\n           mem.source      as source,  \n           ct.display_name as display_name    \nFROM       civicrm_membership mem\nINNER JOIN civicrm_contact ct ON ( mem.contact_id = ct.id )     \nWHERE      mem.id IN ( {$memberIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'start_date' => CRM_Utils_Date::customFormat($dao->start_date), 'end_date' => CRM_Utils_Date::customFormat($dao->end_date), 'source' => $dao->source);
     }
     $this->assign('rows', $rows);
 }
Exemplo n.º 8
0
 /**
  * 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);
     // get the formatted params
     $queryParams = $this->get('queryParams');
     $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));
     }
     $selector = new CRM_Member_Selector_Search($queryParams, $this->_action, $this->_componentClause);
     $controller = new CRM_Core_Selector_Controller($selector, NULL, $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SCREEN);
     $controller->setEmbedded(TRUE);
     $controller->run();
 }
Exemplo n.º 9
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
     //get the contact read only fields to display.
     require_once 'CRM/Core/BAO/Preferences.php';
     $readOnlyFields = array_merge(array('sort_name' => ts('Name')), CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options', true, null, false, 'name', true));
     //get the read only field data.
     $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1);
     require_once 'CRM/Contact/BAO/Contact/Utils.php';
     $contactDetails = CRM_Contact_BAO_Contact_Utils::contactDetails($this->_memberIds, 'CiviMember', $returnProperties);
     $this->assign('contactDetails', $contactDetails);
     $this->assign('readOnlyFields', $readOnlyFields);
 }
Exemplo n.º 10
0
 /**
  * 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();
     CRM_Utils_System::setTitle(ts('Batch Profile Update for Membership'));
     $validate = FALSE;
     //validations
     if (count($this->_memberIds) > $this->_maxMembers) {
         CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(1 => $this->_maxMembers, 2 => count($this->_memberIds))), ts('Batch Update Error'), 'error');
         $validate = TRUE;
     }
     // than redirect
     if ($validate) {
         CRM_Utils_System::redirect($this->_userContext);
     }
 }
Exemplo n.º 11
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
     $session =& CRM_Core_Session::singleton();
     $this->_userContext = $session->readUserContext();
     CRM_Utils_System::setTitle(ts('Batch Profile Update for Membership'));
     $validate = false;
     //validations
     if (count($this->_memberIds) > $this->_maxMembers) {
         CRM_Core_Session::setStatus("The maximum number of members you can select for Batch Update is {$this->_maxMembers}. You have selected " . count($this->_memberIds) . ". Please select fewer members from your search results and try again.");
         $validate = true;
     }
     if ($validate) {
         // than redirect
         CRM_Utils_System::redirect($this->_userContext);
     }
 }
Exemplo n.º 12
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     parent::preProcess();
     $this->setContactIDs();
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Member/Form/Task/Label.js');
 }
Exemplo n.º 13
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @param
  *
  * @return void
  */
 public function preProcess()
 {
     //special case for custom search, directly give option to download csv file
     $customSearchID = $this->get('customSearchID');
     if ($customSearchID) {
         CRM_Export_BAO_Export::exportCustom($this->get('customSearchClass'), $this->get('formValues'), $this->get(CRM_Utils_Sort::SORT_ORDER));
     }
     $this->_selectAll = FALSE;
     $this->_exportMode = self::CONTACT_EXPORT;
     $this->_componentIds = array();
     $this->_componentClause = NULL;
     // get the submitted values based on search
     if ($this->_action == CRM_Core_Action::ADVANCED) {
         $values = $this->controller->exportValues('Advanced');
     } elseif ($this->_action == CRM_Core_Action::PROFILE) {
         $values = $this->controller->exportValues('Builder');
     } elseif ($this->_action == CRM_Core_Action::COPY) {
         $values = $this->controller->exportValues('Custom');
     } else {
         // we need to determine component export
         $stateMachine = $this->controller->getStateMachine();
         $formName = CRM_Utils_System::getClassName($stateMachine);
         $componentName = explode('_', $formName);
         $components = array('Contribute', 'Member', 'Event', 'Pledge', 'Case', 'Grant', 'Activity');
         if (in_array($componentName[1], $components)) {
             switch ($componentName[1]) {
                 case 'Contribute':
                     $this->_exportMode = self::CONTRIBUTE_EXPORT;
                     break;
                 case 'Member':
                     $this->_exportMode = self::MEMBER_EXPORT;
                     break;
                 case 'Event':
                     $this->_exportMode = self::EVENT_EXPORT;
                     break;
                 case 'Pledge':
                     $this->_exportMode = self::PLEDGE_EXPORT;
                     break;
                 case 'Case':
                     $this->_exportMode = self::CASE_EXPORT;
                     break;
                 case 'Grant':
                     $this->_exportMode = self::GRANT_EXPORT;
                     break;
                 case 'Activity':
                     $this->_exportMode = self::ACTIVITY_EXPORT;
                     break;
             }
             $className = "CRM_{$componentName[1]}_Form_Task";
             $className::preProcessCommon($this, TRUE);
             $values = $this->controller->exportValues('Search');
         } else {
             $values = $this->controller->exportValues('Basic');
         }
     }
     $count = 0;
     $this->_matchingContacts = FALSE;
     if (CRM_Utils_Array::value('radio_ts', $values) == 'ts_sel') {
         foreach ($values as $key => $value) {
             if (strstr($key, 'mark_x')) {
                 $count++;
             }
             if ($count > 2) {
                 $this->_matchingContacts = TRUE;
                 break;
             }
         }
     }
     $componentMode = $this->get('component_mode');
     switch ($componentMode) {
         case 2:
             CRM_Contribute_Form_Task::preProcessCommon($this, TRUE);
             $this->_exportMode = self::CONTRIBUTE_EXPORT;
             $componentName = array('', 'Contribute');
             break;
         case 3:
             CRM_Event_Form_Task::preProcessCommon($this, TRUE);
             $this->_exportMode = self::EVENT_EXPORT;
             $componentName = array('', 'Event');
             break;
         case 4:
             CRM_Activity_Form_Task::preProcessCommon($this, TRUE);
             $this->_exportMode = self::ACTIVITY_EXPORT;
             $componentName = array('', 'Activity');
             break;
         case 5:
             CRM_Member_Form_Task::preProcessCommon($this, TRUE);
             $this->_exportMode = self::MEMBER_EXPORT;
             $componentName = array('', 'Member');
             break;
         case 6:
             CRM_Case_Form_Task::preProcessCommon($this, TRUE);
             $this->_exportMode = self::CASE_EXPORT;
             $componentName = array('', 'Case');
             break;
     }
     $this->_task = $values['task'];
     if ($this->_exportMode == self::CONTACT_EXPORT) {
         $contactTasks = CRM_Contact_Task::taskTitles();
         $taskName = $contactTasks[$this->_task];
         $component = FALSE;
         CRM_Contact_Form_Task::preProcessCommon($this, TRUE);
     } else {
         $this->assign('taskName', "Export {$componentName['1']}");
         $className = "CRM_{$componentName[1]}_Task";
         $componentTasks = $className::tasks();
         $taskName = $componentTasks[$this->_task];
         $component = TRUE;
     }
     if ($this->_componentTable) {
         $query = "\nSELECT count(*)\nFROM   {$this->_componentTable}\n";
         $totalSelectedRecords = CRM_Core_DAO::singleValueQuery($query);
     } else {
         $totalSelectedRecords = count($this->_componentIds);
     }
     $this->assign('totalSelectedRecords', $totalSelectedRecords);
     $this->assign('taskName', $taskName);
     $this->assign('component', $component);
     // all records actions = save a search
     if ($values['radio_ts'] == 'ts_all' || $this->_task == CRM_Contact_Task::SAVE_SEARCH) {
         $this->_selectAll = TRUE;
         $rowCount = $this->get('rowCount');
         if ($rowCount > 2) {
             $this->_matchingContacts = TRUE;
         }
         $this->assign('totalSelectedRecords', $rowCount);
     }
     $this->assign('matchingContacts', $this->_matchingContacts);
     $this->set('componentIds', $this->_componentIds);
     $this->set('selectAll', $this->_selectAll);
     $this->set('exportMode', $this->_exportMode);
     $this->set('componentClause', $this->_componentClause);
     $this->set('componentTable', $this->_componentTable);
 }