diff --git a/CHANGELOG.md b/CHANGELOG.md index 424c84af4574a52fb04ba5e2c198c15e6881f7d5..e11445da78efd4877a0ed76f8901a4fab88705e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ -# Version 1.24 (not yet released) +# Version 1.24 + +* Fixed issue with sorting the data processor and case insenstivity. # Version 1.23.8 -* Fixed regression bug in Checksum filter. +* Fixed regression bug in Checksum filter. # Version 1.23.7 diff --git a/Civi/DataProcessor/DataFlow/Sort/SortCompareFactory.php b/Civi/DataProcessor/DataFlow/Sort/SortCompareFactory.php index 993a99bb68d2b899254ecdbd67da405c1a81a43a..7109623f1bf47c175ed59501ddbc33636195a912 100644 --- a/Civi/DataProcessor/DataFlow/Sort/SortCompareFactory.php +++ b/Civi/DataProcessor/DataFlow/Sort/SortCompareFactory.php @@ -10,7 +10,9 @@ use Civi\DataProcessor\DataFlow\Sort\SortComparer; class SortCompareFactory { - private $compareres = array(); + private $compareres = array( + 'String' => '\Civi\DataProcessor\DataFlow\Sort\StringSortComparer' + ); private $genericComparer = '\Civi\DataProcessor\DataFlow\Sort\SortComparer'; @@ -34,4 +36,4 @@ class SortCompareFactory { $this->compareres[$type] = $className; } -} \ No newline at end of file +} diff --git a/Civi/DataProcessor/DataFlow/Sort/SortSpecification.php b/Civi/DataProcessor/DataFlow/Sort/SortSpecification.php index 6adece1b1f32a9e07b305ba5295748d79970ac6f..0da9add2fbf471e55d84fc6bad1411e338796492 100644 --- a/Civi/DataProcessor/DataFlow/Sort/SortSpecification.php +++ b/Civi/DataProcessor/DataFlow/Sort/SortSpecification.php @@ -116,7 +116,7 @@ class SortSpecification { */ public function compare($row_a, $row_b) { $comparer = $this->getComparer(); - $compareValue = $comparer->sort($row_a[$this->fieldName], $row_b[$this->fieldName]); + $compareValue = $comparer->sort($row_a[$this->fieldName]->rawValue, $row_b[$this->fieldName]->rawValue); if ($this->direction == self::DESC) { if ($compareValue < 0) { $compareValue = 1; @@ -128,4 +128,4 @@ class SortSpecification { } -} \ No newline at end of file +} diff --git a/Civi/DataProcessor/DataFlow/Sort/StringSortComparer.php b/Civi/DataProcessor/DataFlow/Sort/StringSortComparer.php new file mode 100644 index 0000000000000000000000000000000000000000..1105ce42cab09573b12a9547e59b428ac973f3dc --- /dev/null +++ b/Civi/DataProcessor/DataFlow/Sort/StringSortComparer.php @@ -0,0 +1,25 @@ +<?php +/** + * @author Jaap Jansma <jaap.jansma@civicoop.org> + * @license AGPL-3.0 + */ + +namespace Civi\DataProcessor\DataFlow\Sort; + +class StringSortComparer { + + /** + * Sort compare function + * Returns 0 when both values are equal + * Returns -1 when a is less than b + * Return 1 when b is less than a + * + * @param $value_a + * @param $value_b + * @return int + */ + public function sort($value_a, $value_b) { + return strcasecmp($value_a, $value_b); + } + +} diff --git a/info.xml b/info.xml index 3bc425516c22f08ba655aad8ffe87c4e46a197a0..48427613c2430b6d567883485f045bde22a28469 100644 --- a/info.xml +++ b/info.xml @@ -14,8 +14,8 @@ <url desc="Documentation">https://lab.civicrm.org/extensions/dataprocessor/blob/master/README.md</url> <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> </urls> - <releaseDate>2020-12-09</releaseDate> - <version>1.24-dev</version> + <releaseDate>2020-12-11</releaseDate> + <version>1.24</version> <develStage>stable</develStage> <compatibility> <ver>4.7</ver>