Skip to content
Snippets Groups Projects
Commit 0931de86 authored by jaapjansma's avatar jaapjansma
Browse files

update

parent 55358166
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
* Add support for filter defaults to be set using the URL.
* Added Filter for World Region
* Added Output for World Region
* Fixed integration with search action designer extension for the Search/Report output.
# Version 1.11.0
......
......@@ -78,6 +78,30 @@ class CRM_DataprocessorSearch_Form_Search extends CRM_DataprocessorSearch_Form_A
return false;
}
/**
* Return altered rows
*
* Save the ids into the queryParams value. So that when an action is done on the selected record
* or on all records, the queryParams will hold all the case ids so that in the next step only the selected record, or the first
* all records are populated.
*/
protected function retrieveEntityIds() {
$this->dataProcessorClass->getDataFlow()->setLimit(false);
$this->dataProcessorClass->getDataFlow()->setOffset(0);
$this->entityIDs = [];
$id_field = $this->getIdFieldName();
try {
while($record = $this->dataProcessorClass->getDataFlow()->nextRecord()) {
if ($id_field && isset($record[$id_field])) {
$this->entityIDs[] = $record[$id_field]->rawValue;
}
}
} catch (\Civi\DataProcessor\DataFlow\EndOfFlowException $e) {
// Do nothing
}
$this->controller->set('entityIds', $this->entityIDs);
}
/**
* Builds the list of tasks or actions that a searcher can perform on a result set.
*
......
......@@ -4,11 +4,47 @@
* @license AGPL-3.0
*/
use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_DataprocessorSearch_Form_Task_SearchActionDesigner extends CRM_Searchactiondesigner_Form_Task_Task {
protected function setEntityShortName() {
self::$entityShortname = 'DataprocessorSearch';
}
public function preProcess() {
$this->setEntityShortName();
$session = CRM_Core_Session::singleton();
$url = $session->readUserContext();
$session->replaceUserContext($url);
$searchFormValues = $this->controller->exportValues($this->get('searchFormName'));
$this->_task = $searchFormValues['task'];
$className = 'CRM_' . ucfirst(self::$entityShortname) . '_Task';
$entityTasks = $className::tasks();
$this->assign('taskName', $entityTasks[$this->_task]);
$entityIds = [];
if ($searchFormValues['radio_ts'] == 'ts_sel') {
foreach ($searchFormValues as $name => $value) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
$entityIds[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
}
}
} else {
$entityIds = $this->get('entityIds');
}
$this->_entityIds = $this->_componentIds = $entityIds;
if (strpos($this->_task,'searchactiondesigner_') !== 0) {
throw new \Exception(E::ts('Invalid search task'));
}
$this->searchTaskId = substr($this->_task, 21);
$this->searchTask = civicrm_api3('SearchTask', 'getsingle', array('id' => $this->searchTaskId));
$this->assign('searchTask', $this->searchTask);
$this->assign('status', E::ts("Number of selected records: %1", array(1=>count($this->_entityIds))));
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment