From: miker Date: Mon, 11 Aug 2008 00:11:18 +0000 (+0000) Subject: allow blocked users to be stopped from placing holds (clear as mud, eh?) X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0c1996a09ffc71dce262e81b90f10f6ea1526a0d;p=Evergreen.git allow blocked users to be stopped from placing holds (clear as mud, eh?) git-svn-id: svn://svn.open-ils.org/ILS/trunk@10324 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/110.hold_matrix.sql b/Open-ILS/src/sql/Pg/110.hold_matrix.sql index b80dcdd60b..f55355777b 100644 --- a/Open-ILS/src/sql/Pg/110.hold_matrix.sql +++ b/Open-ILS/src/sql/Pg/110.hold_matrix.sql @@ -42,6 +42,7 @@ CREATE TABLE config.hold_matrix_test ( transit_range INT REFERENCES actor.org_unit_type (id) DEFERRABLE INITIALLY DEFERRED, -- Can circ inside range of cn.owner/cp.circ_lib at depth of the org_unit_type specified here max_holds INT, -- Total hold requests must be less than this, NULL means skip (always pass) 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 ); @@ -164,6 +165,7 @@ DECLARE hold_count INT; hold_transit_prox INT; frozen_hold_count INT; + patron_penalties INT; done BOOL := FALSE; BEGIN SELECT INTO user_object * FROM actor.usr WHERE id = match_user; @@ -177,6 +179,15 @@ BEGIN RETURN; END IF; + -- Fail if user is barred + IF user_object.barred IS TRUE THEN + result.fail_part := 'actor.usr.barred'; + result.success := FALSE; + done := TRUE; + RETURN NEXT result; + RETURN; + END IF; + SELECT INTO item_object * FROM asset.copy WHERE id = match_item; -- Fail if we couldn't find a copy @@ -229,6 +240,19 @@ BEGIN END IF; END IF; + IF hold_test.stop_blocked_user IS TRUE THEN + SELECT INTO patron_penalties COUNT(*) + FROM actor.usr_standing_penalty + WHERE usr = match_user; + + IF items_out > 0 THEN + result.fail_part := 'config.hold_matrix_test.stop_blocked_user'; + result.success := FALSE; + done := TRUE; + RETURN NEXT result; + END IF; + END IF; + IF hold_test.max_holds IS NOT NULL THEN SELECT INTO hold_count COUNT(*) FROM action.hold_request