/** * Process the uploaded file. * * @return void */ public function postProcess() { $params = $this->controller->exportValues($this->_name); $exportParams = $this->controller->exportValues('Select'); $currentPath = CRM_Utils_System::currentPath(); $urlParams = NULL; $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this); if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams = "&qfKey={$qfKey}"; } //get the button name $buttonName = $this->controller->getButtonName('done'); $buttonName1 = $this->controller->getButtonName('next'); if ($buttonName == '_qf_Map_done') { $this->set('exportColumnCount', NULL); $this->controller->resetPage($this->_name); return CRM_Utils_System::redirect(CRM_Utils_System::url($currentPath, 'force=1' . $urlParams)); } if ($this->controller->exportValue($this->_name, 'addMore')) { $this->set('exportColumnCount', $this->_exportColumnCount); return; } $mapperKeys = $params['mapper'][1]; $checkEmpty = 0; foreach ($mapperKeys as $value) { if ($value[0]) { $checkEmpty++; } } if (!$checkEmpty) { $this->set('mappingId', NULL); CRM_Utils_System::redirect(CRM_Utils_System::url($currentPath, '_qf_Map_display=true' . $urlParams)); } if ($buttonName1 == '_qf_Map_next') { if (!empty($params['updateMapping'])) { //save mapping fields CRM_Core_BAO_Mapping::saveMappingFields($params, $params['mappingId']); } if (!empty($params['saveMapping'])) { $mappingParams = array('name' => $params['saveMappingName'], 'description' => $params['saveMappingDesc'], 'mapping_type_id' => $this->get('mappingTypeId')); $saveMapping = CRM_Core_BAO_Mapping::add($mappingParams); //save mapping fields CRM_Core_BAO_Mapping::saveMappingFields($params, $saveMapping->id); } } //get the csv file CRM_Export_BAO_Export_Relationship::exportComponents($this->get('selectAll'), $this->get('componentIds'), $this->get('queryParams'), $this->get(CRM_Utils_Sort::SORT_ORDER), $mapperKeys, $this->get('returnProperties'), $this->get('exportMode'), $this->get('componentClause'), $this->get('componentTable'), $this->get('mergeSameAddress'), $this->get('mergeSameHousehold'), $exportParams); }
/** * Process the uploaded file. * * @return void */ public function postProcess() { $params = $this->controller->exportValues($this->_name); $exportOption = $params['exportOption']; $mergeSameAddress = CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_SAME_ADDRESS ? 1 : 0; $mergeSameHousehold = CRM_Utils_Array::value('mergeOption', $params) == self::EXPORT_MERGE_HOUSEHOLD ? 1 : 0; $this->set('mergeSameAddress', $mergeSameAddress); $this->set('mergeSameHousehold', $mergeSameHousehold); // instead of increasing the number of arguments to exportComponents function, we // will send $exportParams as another argument, which is an array and suppose to contain // all submitted options or any other argument $exportParams = $params; $mappingId = CRM_Utils_Array::value('mapping', $params); if ($mappingId) { $this->set('mappingId', $mappingId); } else { $this->set('mappingId', NULL); } if ($exportOption == self::EXPORT_ALL) { CRM_Export_BAO_Export_Relationship::exportComponents($this->_selectAll, $this->_componentIds, $this->get('queryParams'), $this->get(CRM_Utils_Sort::SORT_ORDER), NULL, $this->get('returnProperties'), $this->_exportMode, $this->_componentClause, $this->_componentTable, $mergeSameAddress, $mergeSameHousehold, $exportParams, $this->get('queryOperator')); } //reset map page $this->controller->resetPage('Map'); }