[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. bea01daf41459afa245a1c28a4aea1df9781cf06
Evergreen Git
git at git.evergreen-ils.org
Thu Jul 12 09:42:09 EDT 2018
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_3_1 has been updated
via bea01daf41459afa245a1c28a4aea1df9781cf06 (commit)
via 5dc8eabaa8a1d77e53f55297d2b766ef8de8b5e9 (commit)
from d927f87f742224ccbc4d737f8db3277a200ba6f0 (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 bea01daf41459afa245a1c28a4aea1df9781cf06
Author: Mike Rylander <mrylander at gmail.com>
Date: Thu Jul 12 09:39:36 2018 -0400
Stamping upgrade script
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index c71db97..5527d7d 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1113', :eg_version); -- Dyrcona/csharp/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1114', :eg_version); -- JBoyer/miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql b/Open-ILS/src/sql/Pg/upgrade/1114.function.asset.copy_state-update.sql
similarity index 94%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql
rename to Open-ILS/src/sql/Pg/upgrade/1114.function.asset.copy_state-update.sql
index 8ddf6cb..f288fd7 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1114.function.asset.copy_state-update.sql
@@ -1,6 +1,6 @@
BEGIN;
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('1114', :eg_version);
CREATE OR REPLACE FUNCTION asset.copy_state (cid BIGINT) RETURNS TEXT AS $$
DECLARE
commit 5dc8eabaa8a1d77e53f55297d2b766ef8de8b5e9
Author: Jason Boyer <jboyer at library.in.gov>
Date: Thu Jun 21 07:17:48 2018 -0400
LP1773452: Repeating copy alerts
Without considering the checkin_time on the most
recent circ for an item, checking in a lost, claims
returned, or claims never checked out item would
cause copy alerts on checkin repeatedly until it
was checked out again. Staff may be confused by this
thinking that there is a continuing problem with
the item until the alerts go away.
Signed-off-by: Jason Boyer <jboyer at library.in.gov>
Signed-off-by: Jennifer Pringle <jennifer.pringle at bc.libraries.coop>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index 24dda3c..a7870aa 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -1008,7 +1008,7 @@ BEGIN
SELECT stop_fines INTO last_circ_stop
FROM action.circulation
- WHERE target_copy = cid
+ WHERE target_copy = cid AND checkin_time IS NULL
ORDER BY xact_start DESC LIMIT 1;
IF FOUND THEN
diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1773452_copy_state_post_checkin.pg b/Open-ILS/src/sql/Pg/t/regress/lp1773452_copy_state_post_checkin.pg
new file mode 100644
index 0000000..6a6f2e8
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/regress/lp1773452_copy_state_post_checkin.pg
@@ -0,0 +1,20 @@
+BEGIN;
+
+SELECT plan(2);
+
+INSERT INTO asset.copy (id,circ_lib,creator,loan_duration,fine_level,call_number,editor,barcode,dummy_title,dummy_author)
+ VALUES (8765309,1,1,2,2,-1,1,'8765309','Spooky Dance','Steve Bachman');
+
+INSERT INTO action.circulation (id,usr,target_copy,circ_lib,circ_staff,renewal_remaining,
+ duration_rule,recurring_fine_rule,max_fine_rule,stop_fines,grace_period)
+ VALUES (8765309,1,8765309,1,1,0,
+ 1,1,1,'LONGOVERDUE','0 hours');
+
+SELECT is(asset.copy_state(8765309),'LONGOVERDUE', 'Copy state is LONGOVERDUE when stop_fines='LONGOVERDUE' and checkin_time is null');
+
+-- Our long overdue item has returned!
+UPDATE action.circulation SET checkin_time=now() WHERE id=8765309;
+
+SELECT is(asset.copy_state(8765309),'NORMAL', 'Copy state is NORMAL when stop_fines='LONGOVERDUE' and checkin_time is not null');
+
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql
new file mode 100644
index 0000000..8ddf6cb
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.asset.copy_state-update.sql
@@ -0,0 +1,44 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE FUNCTION asset.copy_state (cid BIGINT) RETURNS TEXT AS $$
+DECLARE
+ last_circ_stop TEXT;
+ the_copy asset.copy%ROWTYPE;
+BEGIN
+
+ SELECT * INTO the_copy FROM asset.copy WHERE id = cid;
+ IF NOT FOUND THEN RETURN NULL; END IF;
+
+ IF the_copy.status = 3 THEN -- Lost
+ RETURN 'LOST';
+ ELSIF the_copy.status = 4 THEN -- Missing
+ RETURN 'MISSING';
+ ELSIF the_copy.status = 14 THEN -- Damaged
+ RETURN 'DAMAGED';
+ ELSIF the_copy.status = 17 THEN -- Lost and paid
+ RETURN 'LOST_AND_PAID';
+ END IF;
+
+ SELECT stop_fines INTO last_circ_stop
+ FROM action.circulation
+ WHERE target_copy = cid AND checkin_time IS NULL
+ ORDER BY xact_start DESC LIMIT 1;
+
+ IF FOUND THEN
+ IF last_circ_stop IN (
+ 'CLAIMSNEVERCHECKEDOUT',
+ 'CLAIMSRETURNED',
+ 'LONGOVERDUE'
+ ) THEN
+ RETURN last_circ_stop;
+ END IF;
+ END IF;
+
+ RETURN 'NORMAL';
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
+
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/040.schema.asset.sql | 2 +-
.../t/regress/lp1773452_copy_state_post_checkin.pg | 20 +++++++++
.../1114.function.asset.copy_state-update.sql | 44 ++++++++++++++++++++
4 files changed, 66 insertions(+), 2 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/t/regress/lp1773452_copy_state_post_checkin.pg
create mode 100644 Open-ILS/src/sql/Pg/upgrade/1114.function.asset.copy_state-update.sql
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list