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

Fix issue with counting records when all records are selected

parent 4575ee80
No related branches found
No related tags found
No related merge requests found
......@@ -628,18 +628,14 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
*/
public function getSelectionCount(): int {
// We use ajax to handle selections only if the search results component_mode is set to "contacts"
if ($this->usePrevNextCache() && (!isset($this->_formValues['radio_ts']) || $this->_formValues['radio_ts'] != 'ts_all')) {
return count($this->getSelectedIds());
} else {
if (isset($this->_formValues['radio_ts']) && $this->_formValues['radio_ts'] == 'ts_sel') {
return count($this->getSelectedIds());
} elseif (!isset($this->_formValues['radio_ts']) || $this->_formValues['radio_ts'] == 'ts_all') {
try {
return $this->dataProcessorClass->getDataFlow()->recordCount();
} catch (InvalidFlowException $e) {
// Do nothing
}
if ($this->allRecordsSelected()) {
try {
return $this->dataProcessorClass->getDataFlow()->recordCount();
} catch (InvalidFlowException $e) {
// Do nothing
}
} else {
return count($this->getSelectedIds());
}
return 0;
}
......@@ -647,7 +643,7 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
public function allRecordsSelected(): bool {
if (isset($this->_formValues['radio_ts']) && $this->_formValues['radio_ts'] == 'ts_all') {
return true;
} elseif (!$this->usePrevNextCache() && !isset($this->_formValues['radio_ts'])) {
} elseif (!isset($this->_formValues['radio_ts'])) {
return true;
}
return false;
......
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