1 --Upgrade Script for 2.3.9 to 2.3.10
2 \set eg_version '''2.3.10'''
4 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.3.10', :eg_version);
6 SELECT evergreen.upgrade_deps_block_check('0818', :eg_version);
8 INSERT INTO config.org_unit_setting_type ( name, grp, label, description, datatype ) VALUES (
9 'circ.patron_edit.duplicate_patron_check_depth', 'circ',
11 'circ.patron_edit.duplicate_patron_check_depth',
12 'Specify search depth for the duplicate patron check in the patron editor',
16 'circ.patron_edit.duplicate_patron_check_depth',
17 'When using the patron registration page, the duplicate patron check will use the configured depth to scope the search for duplicate patrons.',
25 -- Evergreen DB patch 0819.schema.acn_dewey_normalizer.sql
27 -- Fixes Dewey call number sorting (per LP# 1150939)
30 -- check whether patch can be applied
31 SELECT evergreen.upgrade_deps_block_check('0819', :eg_version);
33 CREATE OR REPLACE FUNCTION asset.label_normalizer_dewey(TEXT) RETURNS TEXT AS $func$
34 # Derived from the Koha C4::ClassSortRoutine::Dewey module
35 # Copyright (C) 2007 LibLime
36 # Licensed under the GPL v2 or later
45 $init =~ s/^([\p{IsAlpha}]+)/$1 /;
46 my @tokens = split /\.|\s+/, $init;
47 my $digit_group_count = 0;
48 my $first_digit_group_idx;
49 for (my $i = 0; $i <= $#tokens; $i++) {
50 if ($tokens[$i] =~ /^\d+$/) {
52 if ($digit_group_count == 1) {
53 $first_digit_group_idx = $i;
55 if (2 == $digit_group_count) {
56 $tokens[$i] = sprintf("%-15.15s", $tokens[$i]);
57 $tokens[$i] =~ tr/ /0/;
61 # Pad the first digit_group if there was only one
62 if (1 == $digit_group_count) {
63 $tokens[$first_digit_group_idx] .= '_000000000000000'
65 my $key = join("_", @tokens);
66 $key =~ s/[^\p{IsAlnum}_]//g;
70 $func$ LANGUAGE PLPERLU;
72 -- regenerate sort keys for any dewey call numbers
73 UPDATE asset.call_number SET id = id WHERE label_class = 2;