Skip to content

Commit a61c3a7

Browse files
simithtomascohen
authored andcommitted
Bug 8837: Dewey cn_sort inaccurate
This patch fix the cn_sort sorting accurace described by Joy Nelson. Testing: I) Appy the bug 12424 patch Before applying this patch: 0) Select 3 items. 1) Edit the items selected 2) Change "Full call number" option to 971/P23w/v.1-2/pt.8, 971.01/P23w/v.1-2/pt.6-7 and 971.01/P23w/v.1-2/pt.7 3) Save changes 4) Valide 971P23WV_12PT_8_000000000000000, 971_000000000000000_01P23WV_12PT_67 and 971_01P23WV_12PT_700000000000000 (table items - cn_sort column). After applying this patch: 5) Edit again the item selected in 0 3) Save changes 4) Valide 971_000000000000000_P23W_V_12_PT_8, 971_010000000000000_P23W_V_12_PT_67, 971_010000000000000_P23W_V_12_PT_7 (table items - cn_sort column). Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
1 parent 7690127 commit a61c3a7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

C4/ClassSortRoutine/Dewey.pm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ sub get_class_sort_key {
6363
my $init = uc "$cn_class $cn_item";
6464
$init =~ s/^\s+//;
6565
$init =~ s/\s+$//;
66+
$init =~ s/\// /g;
6667
$init =~ s!/!!g;
6768
$init =~ s/^([\p{IsAlpha}]+)/$1 /;
6869
my @tokens = split /\.|\s+/, $init;
@@ -75,8 +76,12 @@ sub get_class_sort_key {
7576
$first_digit_group_idx = $i;
7677
}
7778
if (2 == $digit_group_count) {
78-
$tokens[$i] = sprintf("%-15.15s", $tokens[$i]);
79-
$tokens[$i] =~ tr/ /0/;
79+
if ($i - $first_digit_group_idx == 1) {
80+
$tokens[$i] = sprintf("%-15.15s", $tokens[$i]);
81+
$tokens[$i] =~ tr/ /0/;
82+
} else {
83+
$tokens[$first_digit_group_idx] .= '_000000000000000'
84+
}
8085
}
8186
}
8287
}

0 commit comments

Comments
 (0)