Commit f2be151a authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with sorting and limit. #95.

parent 436f050a
......@@ -5,6 +5,7 @@
* Make the totals (calculations that add up) and percentages sortable.
* Fixed #91. Duplicate column name 'participant_payment_participant_id' when a Data Processor is configured to use two or more Pariticipant Sources by !85
* Fixed issue with Participant and Contribution Searches by !87
* Fixed issue with sorting and limit. #95.
# Version 1.36
......
......@@ -52,7 +52,7 @@ abstract class CRM_DataprocessorOutputExport_AbstractOutputExport implements Exp
* @return int
*/
protected function getMaxDirectDownload() {
return 1;
return 50;
}
/**
......@@ -62,7 +62,7 @@ abstract class CRM_DataprocessorOutputExport_AbstractOutputExport implements Exp
* @return int
*/
protected function getJobSize() {
return 1;
return 50;
}
/**
......@@ -262,6 +262,11 @@ abstract class CRM_DataprocessorOutputExport_AbstractOutputExport implements Exp
if ($sortFieldName) {
$dataProcessorClass->getDataFlow()->resetSort();
$dataProcessorClass->getDataFlow()->addSort($sortFieldName, $sortDirection);
if ($idField && $idField != $sortFieldName) {
$dataProcessorClass->getDataFlow()->addSort($idField, 'ASC');
}
} elseif ($idField) {
$dataProcessorClass->getDataFlow()->addSort($idField, 'ASC');
}
$dataProcessorClass->getDataFlow()->setOffset($offset);
$dataProcessorClass->getDataFlow()->setLimit($limit);
......
......@@ -130,7 +130,7 @@ class CRM_DataprocessorOutputExport_CSV extends CRM_DataprocessorOutputExport_Ab
}
protected function createHeader($filename, \Civi\DataProcessor\ProcessorType\AbstractProcessorType $dataProcessorClass, $configuration, $dataProcessor, $idField=null, $selectedIds=array()) {
$file = fopen($filename. '.'.$this->getExtension(), 'a');
$file = fopen($filename. '.'.$this->getExtension(), 'w');
fwrite($file, "\xEF\xBB\xBF"); // BOF this will make sure excel opens the file correctly.
$headerLine = array();
foreach($dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputHandler) {
......
......@@ -308,6 +308,11 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
}
$this->dataProcessorClass->getDataFlow()->resetSort();
$this->dataProcessorClass->getDataFlow()->addSort($sortField['name'], $sortDirection);
if ($id_field && $id_field != $sortField['name']) {
$this->dataProcessorClass->getDataFlow()->addSort($id_field, 'ASC');
}
} elseif ($id_field) {
$this->dataProcessorClass->getDataFlow()->addSort($id_field, 'ASC');
}
$this->alterDataProcessor($this->dataProcessorClass);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment