[open-ils-commits] r10324 - trunk/Open-ILS/src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Aug 10 20:11:18 EDT 2008
Author: miker
Date: 2008-08-10 20:11:18 -0400 (Sun, 10 Aug 2008)
New Revision: 10324
Modified:
trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
Log:
allow blocked users to be stopped from placing holds (clear as mud, eh?)
Modified: trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2008-08-10 18:59:38 UTC (rev 10323)
+++ trunk/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2008-08-11 00:11:18 UTC (rev 10324)
@@ -42,6 +42,7 @@
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 @@
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 @@
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 @@
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
More information about the open-ils-commits
mailing list