From: miker Date: Thu, 23 Apr 2009 00:50:03 +0000 (+0000) Subject: allow groups of circ modifiers for the max-per-circ-mod test X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=516ded60f028871deff9dc9f950399f20b05f4d1;p=evergreen%2Fmasslnc.git allow groups of circ modifiers for the max-per-circ-mod test git-svn-id: svn://svn.open-ils.org/ILS/trunk@12971 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 12694a3ab6..83baaa4c5e 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -1055,10 +1055,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/100.circ_matrix.sql b/Open-ILS/src/sql/Pg/100.circ_matrix.sql index 20ff081524..b27fb735a6 100644 --- a/Open-ILS/src/sql/Pg/100.circ_matrix.sql +++ b/Open-ILS/src/sql/Pg/100.circ_matrix.sql @@ -122,10 +122,15 @@ CREATE TABLE config.circ_matrix_matchpoint ( CREATE TABLE config.circ_matrix_circ_mod_test ( id SERIAL PRIMARY KEY, matchpoint INT NOT NULL REFERENCES config.circ_matrix_matchpoint (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - items_out INT NOT NULL, -- Total current active circulations must be less than this, NULL means skip (always pass) - circ_mod TEXT NOT NULL REFERENCES config.circ_modifier (code) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED-- circ_modifier type that the max out applies to + items_out INT NOT NULL -- Total current active circulations must be less than this, NULL means skip (always pass) ); +CREATE TABLE config.circ_matrix_circ_mod_test_map ( + id SERIAL PRIMARY KEY, + circ_mod_test INT NOT NULL REFERENCES config.circ_matrix_circ_mod_test (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + circ_mod TEXT NOT NULL REFERENCES config.circ_modifier (code) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT cm_once_per_test UNIQUE (circ_mod_test, circ_mod) +); CREATE OR REPLACE FUNCTION action.find_circ_matrix_matchpoint( context_ou INT, match_item BIGINT, match_user INT, renewal BOOL ) RETURNS config.circ_matrix_matchpoint AS $func$ DECLARE @@ -224,6 +229,7 @@ DECLARE result action.matrix_test_result; circ_test config.circ_matrix_matchpoint%ROWTYPE; out_by_circ_mod config.circ_matrix_circ_mod_test%ROWTYPE; + circ_mod_map config.circ_matrix_circ_mod_test_map%ROWTYPE; penalty_type TEXT; tmp_grp INT; items_out INT; @@ -332,7 +338,7 @@ BEGIN AND circ_lib IN ( SELECT * FROM explode_array(context_org_list) ) AND circ.checkin_time IS NULL AND (circ.stop_fines IN ('MAXFINES','LONGOVERDUE') OR circ.stop_fines IS NULL) - AND cp.circ_modifier = out_by_circ_mod.circ_mod; + AND cp.circ_modifier IN (SELECT circ_mod FROM config.circ_matrix_circ_mod_test_map WHERE circ_mod_test = out_by_circ_mod.id); IF items_out >= out_by_circ_mod.items_out THEN result.fail_part := 'config.circ_matrix_circ_mod_test'; result.success := FALSE;