[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. 3776b12f4add887e8fedc8f18e97cb2e9767d4da

Evergreen Git git at git.evergreen-ils.org
Fri Dec 16 14:14:11 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_0 has been updated
       via  3776b12f4add887e8fedc8f18e97cb2e9767d4da (commit)
       via  6e82aa5a4fd1899a411c5e3fd0b678d24abbf22c (commit)
      from  aec9efe6948a0ad8858ea421e15355cfdf4d4b6f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3776b12f4add887e8fedc8f18e97cb2e9767d4da
Author: Dan Scott <dscott at laurentian.ca>
Date:   Fri Dec 16 14:12:08 2011 -0500

    LP# 902667 - Wrap upgrade script for Dewey sorting
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 3ff4d76..7fb3b29 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0649'); -- dbwells/tsbere/miker
+INSERT INTO config.upgrade_log (version) VALUES ('0658'); -- jamesrf/dbs
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql b/Open-ILS/src/sql/Pg/upgrade/0658.schema.acn_dewey_sort_fix.sql
similarity index 95%
rename from Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql
rename to Open-ILS/src/sql/Pg/upgrade/0658.schema.acn_dewey_sort_fix.sql
index 310bb2f..65a3b0e 100644
--- a/Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0658.schema.acn_dewey_sort_fix.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-INSERT INTO config.upgrade_log (version) VALUES ('xxxx');
+INSERT INTO config.upgrade_log (version) VALUES ('0658');
 
 CREATE OR REPLACE FUNCTION asset.label_normalizer_dewey(TEXT) RETURNS TEXT AS $func$
     # Derived from the Koha C4::ClassSortRoutine::Dewey module

commit 6e82aa5a4fd1899a411c5e3fd0b678d24abbf22c
Author: James Fournie <jfournie at sitka.bclibraries.ca>
Date:   Sat Dec 10 16:49:01 2011 -0800

    Fix Dewey call number sorting
    
    Ported over Koha commit aef8358c - fix for Koha Bug 4265.
    Further documented in Evergreen LP # 902667
    Here's the description from the commit message by Magnus Enger:
    
    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".
    
    Signed-off-by: James Fournie <jfournie at sitka.bclibraries.ca>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index 2d17149..8ddd473 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -260,6 +260,10 @@ CREATE OR REPLACE FUNCTION asset.label_normalizer_dewey(TEXT) RETURNS TEXT AS $f
             }
         }
     }
+    # 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/Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql
new file mode 100644
index 0000000..310bb2f
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/xxxx.dewey-sort-fix.sql
@@ -0,0 +1,43 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('xxxx');
+
+CREATE OR REPLACE FUNCTION asset.label_normalizer_dewey(TEXT) RETURNS TEXT AS $func$
+    # Derived from the Koha C4::ClassSortRoutine::Dewey module
+    # Copyright (C) 2007 LibLime
+    # Licensed under the GPL v2 or later
+
+    use strict;
+    use warnings;
+
+    my $init = uc(shift);
+    $init =~ s/^\s+//;
+    $init =~ s/\s+$//;
+    $init =~ s!/!!g;
+    $init =~ s/^([\p{IsAlpha}]+)/$1 /;
+    my @tokens = split /\.|\s+/, $init;
+    my $digit_group_count = 0;
+    for (my $i = 0; $i <= $#tokens; $i++) {
+        if ($tokens[$i] =~ /^\d+$/) {
+            $digit_group_count++;
+            if (2 == $digit_group_count) {
+                $tokens[$i] = sprintf("%-15.15s", $tokens[$i]);
+                $tokens[$i] =~ tr/ /0/;
+            }
+        }
+    }
+    # 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;
+
+    return $key;
+
+$func$ LANGUAGE PLPERLU;
+
+-- regenerate sort keys for any dewey call numbers
+UPDATE asset.call_number SET id = id WHERE label_class = 2;
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/040.schema.asset.sql           |    4 ++
 .../Pg/upgrade/0658.schema.acn_dewey_sort_fix.sql  |   43 ++++++++++++++++++++
 3 files changed, 48 insertions(+), 1 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0658.schema.acn_dewey_sort_fix.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list