[open-ils-commits] r11434 - trunk/Open-ILS/src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 5 22:54:17 EST 2008
Author: miker
Date: 2008-12-05 22:54:15 -0500 (Fri, 05 Dec 2008)
New Revision: 11434
Modified:
trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
Log:
adding actor.usr.juvenile as a circ/hold matrix matchpoint criterium
Modified: trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2008-12-06 03:48:00 UTC (rev 11433)
+++ trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2008-12-06 03:54:15 UTC (rev 11434)
@@ -96,24 +96,25 @@
--
CREATE TABLE config.circ_matrix_matchpoint (
- id SERIAL PRIMARY KEY,
- active BOOL NOT NULL DEFAULT TRUE,
- org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, -- Set to the top OU for the matchpoint applicability range; we can use org_unit_prox to choose the "best"
- grp INT NOT NULL REFERENCES permission.grp_tree (id) DEFERRABLE INITIALLY DEFERRED, -- Set to the top applicable group from the group tree; will need descendents and prox functions for filtering
+ id SERIAL PRIMARY KEY,
+ active BOOL NOT NULL DEFAULT TRUE,
+ org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, -- Set to the top OU for the matchpoint applicability range; we can use org_unit_prox to choose the "best"
+ grp INT NOT NULL REFERENCES permission.grp_tree (id) DEFERRABLE INITIALLY DEFERRED, -- Set to the top applicable group from the group tree; will need descendents and prox functions for filtering
circ_modifier TEXT REFERENCES config.circ_modifier (code) DEFERRABLE INITIALLY DEFERRED,
marc_type TEXT REFERENCES config.item_type_map (code) DEFERRABLE INITIALLY DEFERRED,
marc_form TEXT REFERENCES config.item_form_map (code) DEFERRABLE INITIALLY DEFERRED,
- marc_vr_format TEXT REFERENCES config.videorecording_format_map (code) DEFERRABLE INITIALLY DEFERRED,
- ref_flag BOOL,
- is_renewal BOOL,
- usr_age_lower_bound INTERVAL,
- usr_age_upper_bound INTERVAL,
- circulate BOOL NOT NULL DEFAULT TRUE, -- Hard "can't circ" flag requiring an override
+ marc_vr_format TEXT REFERENCES config.videorecording_format_map (code) DEFERRABLE INITIALLY DEFERRED,
+ ref_flag BOOL,
+ juvenile_flag BOOL,
+ is_renewal BOOL,
+ usr_age_lower_bound INTERVAL,
+ usr_age_upper_bound INTERVAL,
+ circulate BOOL NOT NULL DEFAULT TRUE, -- Hard "can't circ" flag requiring an override
duration_rule INT NOT NULL REFERENCES config.rule_circ_duration (id) DEFERRABLE INITIALLY DEFERRED,
- recurring_fine_rule INT NOT NULL REFERENCES config.rule_recuring_fine (id) DEFERRABLE INITIALLY DEFERRED,
+ recurring_fine_rule INT NOT NULL REFERENCES config.rule_recuring_fine (id) DEFERRABLE INITIALLY DEFERRED,
max_fine_rule INT NOT NULL REFERENCES config.rule_max_fine (id) DEFERRABLE INITIALLY DEFERRED,
- script_test TEXT, -- javascript source
- CONSTRAINT ep_once_per_grp_loc_mod_marc UNIQUE (grp, org_unit, circ_modifier, marc_type, marc_form, marc_vr_format, ref_flag, usr_age_lower_bound, usr_age_upper_bound, is_renewal)
+ script_test TEXT, -- javascript source
+ CONSTRAINT ep_once_per_grp_loc_mod_marc UNIQUE (grp, org_unit, circ_modifier, marc_type, marc_form, marc_vr_format, ref_flag, juvenile_flag, usr_age_lower_bound, usr_age_upper_bound, is_renewal)
);
@@ -149,7 +150,8 @@
LEFT JOIN actor.org_unit_proximity p ON (p.from_org = context_ou AND p.to_org = d.id)
WHERE m.grp = current_group.id AND m.active
ORDER BY CASE WHEN p.prox IS NULL THEN 999 ELSE p.prox END,
- CASE WHEN m.is_renewal = renewal THEN 64 ELSE 0 END +
+ CASE WHEN m.is_renewal = renewal THEN 128 ELSE 0 END +
+ CASE WHEN m.juvenile_flag IS NOT NULL THEN 64 ELSE 0 END +
CASE WHEN m.circ_modifier IS NOT NULL THEN 32 ELSE 0 END +
CASE WHEN m.marc_type IS NOT NULL THEN 16 ELSE 0 END +
CASE WHEN m.marc_form IS NOT NULL THEN 8 ELSE 0 END +
@@ -182,6 +184,10 @@
CONTINUE WHEN current_mp.ref_flag <> item_object.ref;
END IF;
+ IF current_mp.juvenile_flag IS NOT NULL THEN
+ CONTINUE WHEN current_mp.juvenile_flag <> user_object.juvenile;
+ END IF;
+
IF current_mp.usr_age_lower_bound IS NOT NULL THEN
CONTINUE WHEN user_object.dob IS NULL OR current_mp.usr_age_lower_bound < age(user_object.dob);
END IF;
Modified: trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2008-12-06 03:48:00 UTC (rev 11433)
+++ trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2008-12-06 03:54:15 UTC (rev 11434)
@@ -42,6 +42,7 @@
marc_type TEXT REFERENCES config.item_type_map (code) DEFERRABLE INITIALLY DEFERRED,
marc_form TEXT REFERENCES config.item_form_map (code) DEFERRABLE INITIALLY DEFERRED,
marc_vr_format TEXT REFERENCES config.videorecording_format_map (code) DEFERRABLE INITIALLY DEFERRED,
+ juvenile_flag BOOL,
ref_flag BOOL,
holdable BOOL NOT NULL DEFAULT TRUE, -- Hard "can't hold" flag requiring an override
distance_is_from_owner BOOL NOT NULL DEFAULT FALSE, -- How to calculate transit_range. True means owning lib, false means copy circ lib
@@ -50,7 +51,7 @@
include_frozen_holds BOOL NOT NULL DEFAULT TRUE, -- Include frozen hold requests in the count for max_holds test
stop_blocked_user BOOL NOT NULL DEFAULT FALSE, -- Stop users who cannot check out items from placing holds
age_hold_protect_rule INT REFERENCES config.rule_age_hold_protect (id) DEFERRABLE INITIALLY DEFERRED, -- still not sure we want to move this off the copy
- CONSTRAINT hous_once_per_grp_loc_mod_marc UNIQUE (user_home_ou, request_ou, pickup_ou, item_owning_ou, item_circ_ou, requestor_grp, usr_grp, circ_modifier, marc_type, marc_form, marc_vr_format)
+ CONSTRAINT hous_once_per_grp_loc_mod_marc UNIQUE (user_home_ou, request_ou, pickup_ou, item_owning_ou, item_circ_ou, requestor_grp, usr_grp, circ_modifier, marc_type, marc_form, marc_vr_format, ref_flag, juvenile_flag)
);
CREATE OR REPLACE FUNCTION action.find_hold_matrix_matchpoint( pickup_ou INT, request_ou INT, match_item BIGINT, match_user INT, match_requestor INT ) RETURNS INT AS $func$
@@ -83,6 +84,7 @@
FROM config.hold_matrix_matchpoint m
WHERE m.requestor_grp = current_requestor_group.id AND m.active
ORDER BY CASE WHEN m.circ_modifier IS NOT NULL THEN 16 ELSE 0 END +
+ CASE WHEN m.juvenile_flag IS NOT NULL THEN 16 ELSE 0 END +
CASE WHEN m.marc_type IS NOT NULL THEN 8 ELSE 0 END +
CASE WHEN m.marc_form IS NOT NULL THEN 4 ELSE 0 END +
CASE WHEN m.marc_vr_format IS NOT NULL THEN 2 ELSE 0 END +
@@ -110,6 +112,10 @@
CONTINUE WHEN current_mp.marc_vr_format <> rec_descriptor.vr_format;
END IF;
+ IF current_mp.juvenile_flag IS NOT NULL THEN
+ CONTINUE WHEN current_mp.juvenile_flag <> user_object.juvenile;
+ END IF;
+
IF current_mp.ref_flag IS NOT NULL THEN
CONTINUE WHEN current_mp.ref_flag <> item_object.ref;
END IF;
More information about the open-ils-commits
mailing list