[open-ils-commits] [GIT] Evergreen ILS branch master updated. eadd9458856920bf4e2a6972e5b572a7fae69b57

Evergreen Git git at git.evergreen-ils.org
Tue Mar 22 22:35:55 EDT 2016


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, master has been updated
       via  eadd9458856920bf4e2a6972e5b572a7fae69b57 (commit)
       via  2b38160a67b90f15855cd5e94b49c7a32d738359 (commit)
       via  d5e5f6b8684bea8eac79abc11b5c7414311a4d63 (commit)
      from  0d2b61d8669a9a540cf1b80ba64a1a67c3b4095d (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 eadd9458856920bf4e2a6972e5b572a7fae69b57
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Tue Mar 22 22:27:04 2016 -0400

    update upgrade instructions for 2.10.1
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/docs/installation/server_upgrade.txt b/docs/installation/server_upgrade.txt
index 0a30406..0395894 100644
--- a/docs/installation/server_upgrade.txt
+++ b/docs/installation/server_upgrade.txt
@@ -8,7 +8,7 @@ Software Prerequisites
 
  * **PostgreSQL**: Version 9.3 is recommended. The minimum supported version
     is 9.1.
-  * **Linux**: Evergreen 2.10.0 has been tested on Debian Jessie (8.0),
+  * **Linux**: Evergreen 2.10.1 has been tested on Debian Jessie (8.0),
     Debian Wheezy (7.0), Debian Squeeze(6.0), Ubuntu Trusty Tahr (14.04),
     Ubuntu Precise Pangolin (12.04), and Fedora.
     If you are running an older version of these distributions, you may want
@@ -44,12 +44,12 @@ osrf_control --localhost --stop-all
  .. Back up the /openils directory.
 . Upgrade OpenSRF. Download and install the latest version of OpenSRF from
 the https://evergreen-ils.org/opensrf-downloads/[OpenSRF download page].
-. As the *opensrf* user, download and extract Evergreen 2.10.0:
+. As the *opensrf* user, download and extract Evergreen 2.10.1:
 +
 [source, bash]
 -----------------------------------------------
-wget https://evergreen-ils.org/downloads/Evergreen-ILS-2.10.0.tar.gz
-tar xzf Evergreen-ILS-2.10.0.tar.gz
+wget https://evergreen-ils.org/downloads/Evergreen-ILS-2.10.1.tar.gz
+tar xzf Evergreen-ILS-2.10.1.tar.gz
 -----------------------------------------------
 +
 [NOTE]
@@ -59,7 +59,7 @@ For the latest edition of Evergreen, check the https://evergreen-ils.org/egdownl
 +
 [source, bash]
 ---------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.0
+cd /home/opensrf/Evergreen-ILS-2.10.1
 ---------------------------------------------
 +
 On the next command, replace `[distribution]` with one of these values for your
@@ -85,7 +85,7 @@ make -f Open-ILS/src/extras/Makefile.install [distribution]
 +
 [source, bash]
 ------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.0
+cd /home/opensrf/Evergreen-ILS-2.10.1
 PATH=/openils/bin:$PATH ./configure --prefix=/openils --sysconfdir=/openils/conf
 make
 ------------------------------------------------------------
@@ -96,8 +96,8 @@ These instructions assume that you have also installed OpenSRF under /openils/.
 +
 [source, bash]
 ------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.0
-make STAFF_CLIENT_STAMP_ID=rel_2_10_0 install
+cd /home/opensrf/Evergreen-ILS-2.10.1
+make STAFF_CLIENT_STAMP_ID=rel_2_10_1 install
 ------------------------------------------------------------
 +
 . As the *root* user, change all files to be owned by the opensrf user and group:
@@ -113,7 +113,7 @@ chown -R opensrf:opensrf /openils
 -----------------------------------------------------------
 cd /openils/var/web/xul/
 rm server
-ln -sf rel_2_10_0/server server
+ln -sf rel_2_10_1/server server
 ----------------------------------------------------------
 +
 . As the *opensrf* user, update opensrf_core.xml and opensrf.xml by copying the
@@ -133,7 +133,7 @@ Copying these configuration files will remove any customizations you have made t
 +
 [source, bash]
 -------------------------------------------------------------------------
-cd /home/opensrf/Evergreen-ILS-2.10.0
+cd /home/opensrf/Evergreen-ILS-2.10.1
 perl Open-ILS/src/support-scripts/eg_db_config --update-config --service all \
 --create-offline --database evergreen --host localhost --user evergreen --password evergreen
 -------------------------------------------------------------------------
@@ -157,21 +157,21 @@ The diff command can be used to show the differences between the distribution ve
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.0/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup
+cp /home/opensrf/Evergreen-ILS-2.10.1/Open-ILS/examples/apache/eg_startup /etc/apache2/eg_startup
 ----------------------------------------------------------
 +
 .. Update /etc/apache2/eg_vhost.conf by copying the example from Open-ILS/examples/apache/eg_vhost.conf.
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.0/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf
+cp /home/opensrf/Evergreen-ILS-2.10.1/Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/eg_vhost.conf
 ----------------------------------------------------------
 +
 .. Update /etc/apache2/sites-available/eg.conf by copying the example from Open-ILS/examples/apache/eg.conf.
 +
 [source, bash]
 ----------------------------------------------------------
-cp /home/opensrf/Evergreen-ILS-2.10.0/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf
+cp /home/opensrf/Evergreen-ILS-2.10.1/Open-ILS/examples/apache/eg.conf /etc/apache2/sites-available/eg.conf
 ----------------------------------------------------------
 
 Upgrade the Evergreen database schema
@@ -194,7 +194,7 @@ anything goes wrong during the upgrade.
 =============
 Evergreen provides incremental upgrade scripts that allow you to upgrade
 from one minor version to the next until you have the current version of
-the schema. For example, if you want to upgrade from 2.5.1 to 2.10.0, you
+the schema. For example, if you want to upgrade from 2.5.1 to 2.10.1, you
 would run the following upgrade scripts:
 
 - 2.5.1-2.5.2-upgrade-db.sql
@@ -216,13 +216,14 @@ would run the following upgrade scripts:
 - 2.9.1-2.9.2-upgrade-db.sql
 - 2.9.2-2.9.3-upgrade-db.sql
 - 2.9.3-2.10.0-upgrade-db.sql
+- 2.10.0-2.10.1-upgrade-db.sql
 
 Note that you do *not* want to run additional 2.5 scripts to upgrade to the
 newest version of 2.5, since currently there is no automated way to upgrade
 from 2.5.4+ to 2.6. Only upgrade as far as necessary to reach the major
 version upgrade script (in this example, as far as 2.5.3).
 
-To upgrade across multiple major versions (e.g. from 2.3.0 to 2.10.0), use
+To upgrade across multiple major versions (e.g. from 2.3.0 to 2.10.1), use
 the same logic to utilize the provided major version upgrade scripts. For
 example:
 
@@ -240,6 +241,7 @@ example:
 - 2.8.4-2.9.0-upgrade-db.sql
 - (run all incremental scripts from 2.9.0 to 2.9.3)
 - 2.9.3-2.10.0-upgrade-db.sql
+- (run all incremental scripts from 2.10.0 to 2.10.1)
 =============
 
 [CAUTION]
@@ -254,7 +256,7 @@ as a user with the ability to connect to the database server.
 [source, bash]
 ----------------------------------------------------------
 cd /home/opensrf/Evergreen-ILS-2.10.0/Open-ILS/src/sql/Pg
-psql -U evergreen -h localhost -f version-upgrade/2.9.3-2.10.0-upgrade-db.sql evergreen
+psql -U evergreen -h localhost -f version-upgrade/2.10.0-2.10.1-upgrade-db.sql evergreen
 ----------------------------------------------------------
 
 [TIP]

commit 2b38160a67b90f15855cd5e94b49c7a32d738359
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Tue Mar 22 22:24:33 2016 -0400

    release notes for Evergreen 2.10.1
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/docs/RELEASE_NOTES_2_10.adoc b/docs/RELEASE_NOTES_2_10.adoc
index 38f3622..0570266 100644
--- a/docs/RELEASE_NOTES_2_10.adoc
+++ b/docs/RELEASE_NOTES_2_10.adoc
@@ -1,10 +1,35 @@
-Evergreen 2.10.0 Release Notes
+Evergreen 2.10.1 Release Notes
 ==============================
 :toc:
 :numbered:
 
-Upgrade notes
--------------
+Evergreen 2.10.1
+----------------
+
+Evergreen 2.10.1 is a bugfix release that fixes one significant
+bug in 2.10.0:
+
+* https://bugs.launchpad.net/bugs/1560174[Bug 1560174: Importing MARC records can fail in database upgraded to 2.10.0]
+
+This bug affected only databases that were upgraded to 2.10.0 from a
+previous version; fresh installations of 2.10.0 are not affected.
+
+Evergreen users who prefer not to perform a full upgrade from 2.10.0
+to 2.10.1 can fix the bug by applying the database update script
+`2.10.0-2.10.1-upgrade-db.sql` (found in the source directory
+`Open-ILS/src/sql/Pg/version-upgrade`).
+
+Evergreen 2.10.1 Acknowledgments
+--------------------------------
+The Evergreen project would like to thank the following 
+individuals who contributed code and testing to this release
+of Evergreen:
+
+ * Galen Charlton
+ * Dan Wells
+
+Evergreen 2.10.0 Upgrade notes
+------------------------------
 
 * Support for PostgreSQL 9.1 is deprecated as of
   the release of Evergreen 2.10.0. Users are recommended
@@ -19,8 +44,8 @@ Upgrade notes
   changes to `opensrf.xml` in order for users to be able
   log in.
 
-New Features
-------------
+Evergreen 2.10.0 New Features
+-----------------------------
 
 
 
@@ -949,8 +974,8 @@ Miscellaneous
   a patron who does not have an email address registered in
   Evergreen tries to email a record.
 
-Bugs and enhancement requests closed in this release
-----------------------------------------------------
+Evergreen 2.10.0 bugs closed
+----------------------------
 
 * https://bugs.launchpad.net/bugs/838525[Bug 838525: Timestamp on dob can make date appear off by a day]
 * https://bugs.launchpad.net/bugs/963341[Bug 963341: Allow the JSPac and TPac to display both MFHD records and Serial Control/Alternate records,]
@@ -1055,8 +1080,8 @@ Bugs and enhancement requests closed in this release
 * https://bugs.launchpad.net/bugs/1557621[Bug 1557621: Verify password API fails on barcode; returns success on deleted users]
 * https://bugs.launchpad.net/bugs/1557683[Bug 1557683: Missing semicolon in 0953.function.unapi-bre.external-includes.sql]
 
-Acknowledgments
----------------
+Evergreen 2.10.0 Acknowledgments
+--------------------------------
 The Evergreen project would like to thank the following 
 individuals who contributed code, documentations patches and
 tests to this release of Evergreen:

commit d5e5f6b8684bea8eac79abc11b5c7414311a4d63
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Tue Mar 22 21:51:39 2016 -0400

    2.10.0 - 2.10.1 schema update script
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.10.0-2.10.1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.10.0-2.10.1-upgrade-db.sql
new file mode 100644
index 0000000..c79e9e8
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.10.0-2.10.1-upgrade-db.sql
@@ -0,0 +1,413 @@
+--Upgrade Script for 2.10.0 to 2.10.1
+\set eg_version '''2.10.1'''
+BEGIN;
+
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.10.1', :eg_version);
+
+SELECT evergreen.upgrade_deps_block_check('0975', :eg_version);
+
+CREATE OR REPLACE FUNCTION vandelay.ingest_items ( import_id BIGINT, attr_def_id BIGINT ) RETURNS SETOF vandelay.import_item AS $$
+DECLARE
+
+    owning_lib      TEXT;
+    circ_lib        TEXT;
+    call_number     TEXT;
+    copy_number     TEXT;
+    status          TEXT;
+    location        TEXT;
+    circulate       TEXT;
+    deposit         TEXT;
+    deposit_amount  TEXT;
+    ref             TEXT;
+    holdable        TEXT;
+    price           TEXT;
+    barcode         TEXT;
+    circ_modifier   TEXT;
+    circ_as_type    TEXT;
+    alert_message   TEXT;
+    opac_visible    TEXT;
+    pub_note        TEXT;
+    priv_note       TEXT;
+    internal_id     TEXT;
+    stat_cat_data   TEXT;
+    parts_data      TEXT;
+
+    attr_def        RECORD;
+    tmp_attr_set    RECORD;
+    attr_set        vandelay.import_item%ROWTYPE;
+
+    xpaths          TEXT[];
+    tmp_str         TEXT;
+
+BEGIN
+
+    SELECT * INTO attr_def FROM vandelay.import_item_attr_definition WHERE id = attr_def_id;
+
+    IF FOUND THEN
+
+        attr_set.definition := attr_def.id;
+
+        -- Build the combined XPath
+
+        owning_lib :=
+            CASE
+                WHEN attr_def.owning_lib IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.owning_lib ) = 1 THEN '*[@code="' || attr_def.owning_lib || '"]'
+                ELSE '*' || attr_def.owning_lib
+            END;
+
+        circ_lib :=
+            CASE
+                WHEN attr_def.circ_lib IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.circ_lib ) = 1 THEN '*[@code="' || attr_def.circ_lib || '"]'
+                ELSE '*' || attr_def.circ_lib
+            END;
+
+        call_number :=
+            CASE
+                WHEN attr_def.call_number IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.call_number ) = 1 THEN '*[@code="' || attr_def.call_number || '"]'
+                ELSE '*' || attr_def.call_number
+            END;
+
+        copy_number :=
+            CASE
+                WHEN attr_def.copy_number IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.copy_number ) = 1 THEN '*[@code="' || attr_def.copy_number || '"]'
+                ELSE '*' || attr_def.copy_number
+            END;
+
+        status :=
+            CASE
+                WHEN attr_def.status IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.status ) = 1 THEN '*[@code="' || attr_def.status || '"]'
+                ELSE '*' || attr_def.status
+            END;
+
+        location :=
+            CASE
+                WHEN attr_def.location IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.location ) = 1 THEN '*[@code="' || attr_def.location || '"]'
+                ELSE '*' || attr_def.location
+            END;
+
+        circulate :=
+            CASE
+                WHEN attr_def.circulate IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.circulate ) = 1 THEN '*[@code="' || attr_def.circulate || '"]'
+                ELSE '*' || attr_def.circulate
+            END;
+
+        deposit :=
+            CASE
+                WHEN attr_def.deposit IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.deposit ) = 1 THEN '*[@code="' || attr_def.deposit || '"]'
+                ELSE '*' || attr_def.deposit
+            END;
+
+        deposit_amount :=
+            CASE
+                WHEN attr_def.deposit_amount IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.deposit_amount ) = 1 THEN '*[@code="' || attr_def.deposit_amount || '"]'
+                ELSE '*' || attr_def.deposit_amount
+            END;
+
+        ref :=
+            CASE
+                WHEN attr_def.ref IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.ref ) = 1 THEN '*[@code="' || attr_def.ref || '"]'
+                ELSE '*' || attr_def.ref
+            END;
+
+        holdable :=
+            CASE
+                WHEN attr_def.holdable IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.holdable ) = 1 THEN '*[@code="' || attr_def.holdable || '"]'
+                ELSE '*' || attr_def.holdable
+            END;
+
+        price :=
+            CASE
+                WHEN attr_def.price IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.price ) = 1 THEN '*[@code="' || attr_def.price || '"]'
+                ELSE '*' || attr_def.price
+            END;
+
+        barcode :=
+            CASE
+                WHEN attr_def.barcode IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.barcode ) = 1 THEN '*[@code="' || attr_def.barcode || '"]'
+                ELSE '*' || attr_def.barcode
+            END;
+
+        circ_modifier :=
+            CASE
+                WHEN attr_def.circ_modifier IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.circ_modifier ) = 1 THEN '*[@code="' || attr_def.circ_modifier || '"]'
+                ELSE '*' || attr_def.circ_modifier
+            END;
+
+        circ_as_type :=
+            CASE
+                WHEN attr_def.circ_as_type IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.circ_as_type ) = 1 THEN '*[@code="' || attr_def.circ_as_type || '"]'
+                ELSE '*' || attr_def.circ_as_type
+            END;
+
+        alert_message :=
+            CASE
+                WHEN attr_def.alert_message IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.alert_message ) = 1 THEN '*[@code="' || attr_def.alert_message || '"]'
+                ELSE '*' || attr_def.alert_message
+            END;
+
+        opac_visible :=
+            CASE
+                WHEN attr_def.opac_visible IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.opac_visible ) = 1 THEN '*[@code="' || attr_def.opac_visible || '"]'
+                ELSE '*' || attr_def.opac_visible
+            END;
+
+        pub_note :=
+            CASE
+                WHEN attr_def.pub_note IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.pub_note ) = 1 THEN '*[@code="' || attr_def.pub_note || '"]'
+                ELSE '*' || attr_def.pub_note
+            END;
+        priv_note :=
+            CASE
+                WHEN attr_def.priv_note IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.priv_note ) = 1 THEN '*[@code="' || attr_def.priv_note || '"]'
+                ELSE '*' || attr_def.priv_note
+            END;
+
+        internal_id :=
+            CASE
+                WHEN attr_def.internal_id IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.internal_id ) = 1 THEN '*[@code="' || attr_def.internal_id || '"]'
+                ELSE '*' || attr_def.internal_id
+            END;
+
+        stat_cat_data :=
+            CASE
+                WHEN attr_def.stat_cat_data IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.stat_cat_data ) = 1 THEN '*[@code="' || attr_def.stat_cat_data || '"]'
+                ELSE '*' || attr_def.stat_cat_data
+            END;
+
+        parts_data :=
+            CASE
+                WHEN attr_def.parts_data IS NULL THEN 'null()'
+                WHEN LENGTH( attr_def.parts_data ) = 1 THEN '*[@code="' || attr_def.parts_data || '"]'
+                ELSE '*' || attr_def.parts_data
+            END;
+
+
+
+        xpaths := ARRAY[owning_lib, circ_lib, call_number, copy_number, status, location, circulate,
+                        deposit, deposit_amount, ref, holdable, price, barcode, circ_modifier, circ_as_type,
+                        alert_message, pub_note, priv_note, internal_id, stat_cat_data, parts_data, opac_visible];
+
+        FOR tmp_attr_set IN
+                SELECT  *
+                  FROM  oils_xpath_tag_to_table( (SELECT marc FROM vandelay.queued_bib_record WHERE id = import_id), attr_def.tag, xpaths)
+                            AS t( ol TEXT, clib TEXT, cn TEXT, cnum TEXT, cs TEXT, cl TEXT, circ TEXT,
+                                  dep TEXT, dep_amount TEXT, r TEXT, hold TEXT, pr TEXT, bc TEXT, circ_mod TEXT,
+                                  circ_as TEXT, amessage TEXT, note TEXT, pnote TEXT, internal_id TEXT,
+                                  stat_cat_data TEXT, parts_data TEXT, opac_vis TEXT )
+        LOOP
+
+            attr_set.import_error := NULL;
+            attr_set.error_detail := NULL;
+            attr_set.deposit_amount := NULL;
+            attr_set.copy_number := NULL;
+            attr_set.price := NULL;
+            attr_set.circ_modifier := NULL;
+            attr_set.location := NULL;
+            attr_set.barcode := NULL;
+            attr_set.call_number := NULL;
+
+            IF tmp_attr_set.pr != '' THEN
+                tmp_str = REGEXP_REPLACE(tmp_attr_set.pr, E'[^0-9\\.]', '', 'g');
+                IF tmp_str = '' THEN 
+                    attr_set.import_error := 'import.item.invalid.price';
+                    attr_set.error_detail := tmp_attr_set.pr; -- original value
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+                attr_set.price := tmp_str::NUMERIC(8,2); 
+            END IF;
+
+            IF tmp_attr_set.dep_amount != '' THEN
+                tmp_str = REGEXP_REPLACE(tmp_attr_set.dep_amount, E'[^0-9\\.]', '', 'g');
+                IF tmp_str = '' THEN 
+                    attr_set.import_error := 'import.item.invalid.deposit_amount';
+                    attr_set.error_detail := tmp_attr_set.dep_amount; 
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+                attr_set.deposit_amount := tmp_str::NUMERIC(8,2); 
+            END IF;
+
+            IF tmp_attr_set.cnum != '' THEN
+                tmp_str = REGEXP_REPLACE(tmp_attr_set.cnum, E'[^0-9]', '', 'g');
+                IF tmp_str = '' THEN 
+                    attr_set.import_error := 'import.item.invalid.copy_number';
+                    attr_set.error_detail := tmp_attr_set.cnum; 
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+                attr_set.copy_number := tmp_str::INT; 
+            END IF;
+
+            IF tmp_attr_set.ol != '' THEN
+                SELECT id INTO attr_set.owning_lib FROM actor.org_unit WHERE shortname = UPPER(tmp_attr_set.ol); -- INT
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.owning_lib';
+                    attr_set.error_detail := tmp_attr_set.ol;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            IF tmp_attr_set.clib != '' THEN
+                SELECT id INTO attr_set.circ_lib FROM actor.org_unit WHERE shortname = UPPER(tmp_attr_set.clib); -- INT
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.circ_lib';
+                    attr_set.error_detail := tmp_attr_set.clib;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            IF tmp_attr_set.cs != '' THEN
+                SELECT id INTO attr_set.status FROM config.copy_status WHERE LOWER(name) = LOWER(tmp_attr_set.cs); -- INT
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.status';
+                    attr_set.error_detail := tmp_attr_set.cs;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            IF COALESCE(tmp_attr_set.circ_mod, '') = '' THEN
+
+                -- no circ mod defined, see if we should apply a default
+                SELECT INTO attr_set.circ_modifier TRIM(BOTH '"' FROM value) 
+                    FROM actor.org_unit_ancestor_setting(
+                        'vandelay.item.circ_modifier.default', 
+                        attr_set.owning_lib
+                    );
+
+                -- make sure the value from the org setting is still valid
+                PERFORM 1 FROM config.circ_modifier WHERE code = attr_set.circ_modifier;
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.circ_modifier';
+                    attr_set.error_detail := tmp_attr_set.circ_mod;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+
+            ELSE 
+
+                SELECT code INTO attr_set.circ_modifier FROM config.circ_modifier WHERE code = tmp_attr_set.circ_mod;
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.circ_modifier';
+                    attr_set.error_detail := tmp_attr_set.circ_mod;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            IF tmp_attr_set.circ_as != '' THEN
+                SELECT code INTO attr_set.circ_as_type FROM config.coded_value_map WHERE ctype = 'item_type' AND code = tmp_attr_set.circ_as;
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.circ_as_type';
+                    attr_set.error_detail := tmp_attr_set.circ_as;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            IF COALESCE(tmp_attr_set.cl, '') = '' THEN
+                -- no location specified, see if we should apply a default
+
+                SELECT INTO attr_set.location TRIM(BOTH '"' FROM value) 
+                    FROM actor.org_unit_ancestor_setting(
+                        'vandelay.item.copy_location.default', 
+                        attr_set.owning_lib
+                    );
+
+                -- make sure the value from the org setting is still valid
+                PERFORM 1 FROM asset.copy_location 
+                    WHERE id = attr_set.location AND NOT deleted;
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.location';
+                    attr_set.error_detail := tmp_attr_set.cs;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            ELSE
+
+                -- search up the org unit tree for a matching copy location
+                WITH RECURSIVE anscestor_depth AS (
+                    SELECT  ou.id,
+                        out.depth AS depth,
+                        ou.parent_ou
+                    FROM  actor.org_unit ou
+                        JOIN actor.org_unit_type out ON (out.id = ou.ou_type)
+                    WHERE ou.id = COALESCE(attr_set.owning_lib, attr_set.circ_lib)
+                        UNION ALL
+                    SELECT  ou.id,
+                        out.depth,
+                        ou.parent_ou
+                    FROM  actor.org_unit ou
+                        JOIN actor.org_unit_type out ON (out.id = ou.ou_type)
+                        JOIN anscestor_depth ot ON (ot.parent_ou = ou.id)
+                ) SELECT  cpl.id INTO attr_set.location
+                    FROM  anscestor_depth a
+                        JOIN asset.copy_location cpl ON (cpl.owning_lib = a.id)
+                    WHERE LOWER(cpl.name) = LOWER(tmp_attr_set.cl) 
+                        AND NOT cpl.deleted
+                    ORDER BY a.depth DESC
+                    LIMIT 1; 
+
+                IF NOT FOUND THEN
+                    attr_set.import_error := 'import.item.invalid.location';
+                    attr_set.error_detail := tmp_attr_set.cs;
+                    RETURN NEXT attr_set; CONTINUE; 
+                END IF;
+            END IF;
+
+            attr_set.circulate      :=
+                LOWER( SUBSTRING( tmp_attr_set.circ, 1, 1)) IN ('t','y','1')
+                OR LOWER(tmp_attr_set.circ) = 'circulating'; -- BOOL
+
+            attr_set.deposit        :=
+                LOWER( SUBSTRING( tmp_attr_set.dep, 1, 1 ) ) IN ('t','y','1')
+                OR LOWER(tmp_attr_set.dep) = 'deposit'; -- BOOL
+
+            attr_set.holdable       :=
+                LOWER( SUBSTRING( tmp_attr_set.hold, 1, 1 ) ) IN ('t','y','1')
+                OR LOWER(tmp_attr_set.hold) = 'holdable'; -- BOOL
+
+            attr_set.opac_visible   :=
+                LOWER( SUBSTRING( tmp_attr_set.opac_vis, 1, 1 ) ) IN ('t','y','1')
+                OR LOWER(tmp_attr_set.opac_vis) = 'visible'; -- BOOL
+
+            attr_set.ref            :=
+                LOWER( SUBSTRING( tmp_attr_set.r, 1, 1 ) ) IN ('t','y','1')
+                OR LOWER(tmp_attr_set.r) = 'reference'; -- BOOL
+
+            attr_set.call_number    := tmp_attr_set.cn; -- TEXT
+            attr_set.barcode        := tmp_attr_set.bc; -- TEXT,
+            attr_set.alert_message  := tmp_attr_set.amessage; -- TEXT,
+            attr_set.pub_note       := tmp_attr_set.note; -- TEXT,
+            attr_set.priv_note      := tmp_attr_set.pnote; -- TEXT,
+            attr_set.alert_message  := tmp_attr_set.amessage; -- TEXT,
+            attr_set.internal_id    := tmp_attr_set.internal_id::BIGINT;
+            attr_set.stat_cat_data  := tmp_attr_set.stat_cat_data; -- TEXT,
+            attr_set.parts_data     := tmp_attr_set.parts_data; -- TEXT,
+
+            RETURN NEXT attr_set;
+
+        END LOOP;
+
+    END IF;
+
+    RETURN;
+
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;

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

Summary of changes:
 .../2.10.0-2.10.1-upgrade-db.sql}                  |    4 ++
 docs/RELEASE_NOTES_2_10.adoc                       |   43 +++++++++++++++----
 docs/installation/server_upgrade.txt               |   34 ++++++++-------
 3 files changed, 56 insertions(+), 25 deletions(-)
 copy Open-ILS/src/sql/Pg/{upgrade/0975.schema.fix_vandelay_stored_procs.sql => version-upgrade/2.10.0-2.10.1-upgrade-db.sql} (99%)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list