3 INSERT INTO config.upgrade_log (version) VALUES ('0499'); -- miker for Steve Callendar
5 CREATE OR REPLACE FUNCTION asset.label_normalizer_generic(TEXT) RETURNS TEXT AS $func$
6 # Created after looking at the Koha C4::ClassSortRoutine::Generic module,
7 # thus could probably be considered a derived work, although nothing was
8 # directly copied - but to err on the safe side of providing attribution:
9 # Copyright (C) 2007 LibLime
10 # Copyright (C) 2011 Equinox Software, Inc (Steve Callendar)
11 # Licensed under the GPL v2 or later
16 # Converts the callnumber to uppercase
17 # Strips spaces from start and end of the call number
18 # Converts anything other than letters, digits, and periods into spaces
19 # Collapses multiple spaces into a single underscore
20 my $callnum = uc(shift);
23 # NOTE: this previously used underscores, but this caused sorting issues
24 # for the "before" half of page 0 on CN browse, sorting CNs containing a
25 # decimal before "whole number" CNs
26 $callnum =~ s/[^A-Z0-9_.]/ /g;
27 $callnum =~ s/ {2,}/ /g;
30 $func$ LANGUAGE PLPERLU;
32 UPDATE asset.call_number SET id = id;