Skip to content

Commit abe7467

Browse files
Fix issue #5542 Sorting by name
1 parent 0ec0913 commit abe7467

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/Sorting/SortSetOperationComparisons.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace BookStack\Sorting;
44

5+
use voku\helper\ASCII;
56
use BookStack\Entities\Models\Chapter;
67
use BookStack\Entities\Models\Entity;
78

@@ -13,12 +14,12 @@ class SortSetOperationComparisons
1314
{
1415
public static function nameAsc(Entity $a, Entity $b): int
1516
{
16-
return strtolower($a->name) <=> strtolower($b->name);
17+
return strtolower(ASCII::to_transliterate($a->name)) <=> strtolower(ASCII::to_transliterate($b->name));
1718
}
1819

1920
public static function nameDesc(Entity $a, Entity $b): int
2021
{
21-
return strtolower($b->name) <=> strtolower($a->name);
22+
return strtolower(ASCII::to_transliterate($b->name)) <=> strtolower(ASCII::to_transliterate($a->name));
2223
}
2324

2425
public static function nameNumericAsc(Entity $a, Entity $b): int

tests/Sorting/SortRuleTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public function test_name_alphabetical_ordering()
198198
$namesToAdd = [
199199
"Beans",
200200
"bread",
201+
"Éclaire",
202+
"egg",
201203
"Milk",
202204
"pizza",
203205
"Tomato",

0 commit comments

Comments
 (0)