]> BookStack Code Mirror - bookstack/commitdiff
Fix issue BookStackApp#5542 Sorting by name 5550/head
authorBernardo Campos <redacted>
Sun, 23 Mar 2025 15:29:29 +0000 (12:29 -0300)
committerBernardo Campos <redacted>
Sun, 23 Mar 2025 15:29:29 +0000 (12:29 -0300)
app/Sorting/SortSetOperationComparisons.php
tests/Sorting/SortRuleTest.php

index e3465231573244b4784cd39fe7401943403f8cde..e506e9a139df5798ab578599c66cbfe74d241022 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace BookStack\Sorting;
 
+use voku\helper\ASCII;
 use BookStack\Entities\Models\Chapter;
 use BookStack\Entities\Models\Entity;
 
@@ -13,12 +14,12 @@ class SortSetOperationComparisons
 {
     public static function nameAsc(Entity $a, Entity $b): int
     {
-        return strtolower($a->name) <=> strtolower($b->name);
+        return strtolower(ASCII::to_transliterate($a->name)) <=>  strtolower(ASCII::to_transliterate($b->name));
     }
 
     public static function nameDesc(Entity $a, Entity $b): int
     {
-        return strtolower($b->name) <=> strtolower($a->name);
+        return strtolower(ASCII::to_transliterate($b->name)) <=>  strtolower(ASCII::to_transliterate($a->name));
     }
 
     public static function nameNumericAsc(Entity $a, Entity $b): int
index e956f49df4bde7f20d1b5fa18de9952364406b43..b0f20cba5aee9b13012de796eb549c45717df278 100644 (file)
@@ -198,6 +198,8 @@ class SortRuleTest extends TestCase
         $namesToAdd = [
             "Beans",
             "bread",
+            "Éclaire",
+            "egg",
             "Milk",
             "pizza",
             "Tomato",
Morty Proxy This is a proxified and sanitized view of the page, visit original site.