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
);
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;
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
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