From: Magnus Enger Date: Mon, 28 Mar 2011 15:42:57 +0000 (-0400) Subject: Bug 4265: Fix padding of short callnumbers and Bib-1 attribute for sorting X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=aef8358cf2ce8db9803d94c14f6728cdf9ebd0d4;p=koha.git Bug 4265: Fix padding of short callnumbers and Bib-1 attribute for sorting 1. The current C4::ClassSortRoutine::Dewey turns "306 Les" into "306_Les" for items.cn_sort and MARC-field 952$6, which results in "306.46 Les" being sorted before "306 Les" in the OPAC. With this patch, "306 Les" is turned into "306_000000000000000_Les". 2. Currently, call_number_asc and call_number_desc are set up to sort by 1=20, but this is mapped to Local-classification in ccl.properties, which is mapped to 952$o in record.abs. This patch changes these sorts to use 1=8007, which is mapped to cn-sort and 952$6. Signed-off-by: Jared Camins-Esakov Signed-off-by: Chris Cormack --- diff --git a/C4/ClassSortRoutine/Dewey.pm b/C4/ClassSortRoutine/Dewey.pm index b4ba92199e..62a68b91ce 100644 --- a/C4/ClassSortRoutine/Dewey.pm +++ b/C4/ClassSortRoutine/Dewey.pm @@ -76,6 +76,10 @@ sub get_class_sort_key { } } } + # Pad the first digit_group if there was only one + if (1 == $digit_group_count) { + $tokens[0] .= '_000000000000000' + } my $key = join("_", @tokens); $key =~ s/[^\p{IsAlnum}_]//g; diff --git a/C4/Search.pm b/C4/Search.pm index b698a93aab..21c61fba1d 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -364,10 +364,10 @@ sub getRecords { $sort_by .= "1=9003 >i "; } elsif ( $sort eq "call_number_asc" ) { - $sort_by .= "1=20