item_status_object config.copy_status%ROWTYPE;
item_location_object asset.copy_location%ROWTYPE;
ou_skip actor.org_unit_setting%ROWTYPE;
+ check_holdability_strictly actor.org_unit_setting%ROWTYPE;
result action.matrix_test_result;
hold_test config.hold_matrix_matchpoint%ROWTYPE;
use_active_date TEXT;
RETURN NEXT result;
END IF;
- IF item_object.holdable IS FALSE THEN
- result.fail_part := 'item.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
- END IF;
+ SELECT INTO check_holdability_strictly *
+ FROM actor.org_unit_setting
+ WHERE name = 'circ.holds.strict_holdability_check' AND org_unit = item_object.circ_lib;
- IF item_status_object.holdable IS FALSE THEN
- result.fail_part := 'status.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
- END IF;
+ IF check_holdability_strictly.id IS NOT NULL AND check_holdability_strictly.value = 'true' THEN
+ IF item_object.holdable IS FALSE THEN
+ result.fail_part := 'item.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
- IF item_location_object.holdable IS FALSE THEN
- result.fail_part := 'location.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
+ IF item_status_object.holdable IS FALSE THEN
+ result.fail_part := 'status.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
+
+ IF item_location_object.holdable IS FALSE THEN
+ result.fail_part := 'location.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
END IF;
IF hold_test.transit_range IS NOT NULL THEN
'coust', 'description'),
'bool', null)
+,( 'circ.holds.strict_holdability_check', 'holds',
+ oils_i18n_gettext('circ.strict_holdability_check',
+ 'Strict holdability check',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.holds.strict_holdability_check',
+ 'Allow hold to be placed only if at least one holdable copy is present',
+ 'coust', 'description'),
+ 'bool', null)
+
;
UPDATE config.org_unit_setting_type
,(1, 'cat.label.font.weight', '"normal"')
;
+INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (
+ 1, 'circ.holds.strict_holdability_check', 'true'
+);
-- Staged Search (for default matchpoints)
INSERT INTO search.relevance_adjustment (field, bump_type, multiplier) VALUES(1, 'first_word', 1.5);
item_status_object config.copy_status%ROWTYPE;
item_location_object asset.copy_location%ROWTYPE;
ou_skip actor.org_unit_setting%ROWTYPE;
+ check_holdability_strictly actor.org_unit_setting%ROWTYPE;
result action.matrix_test_result;
hold_test config.hold_matrix_matchpoint%ROWTYPE;
use_active_date TEXT;
RETURN NEXT result;
END IF;
- IF item_object.holdable IS FALSE THEN
- result.fail_part := 'item.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
- END IF;
+ SELECT INTO check_holdability_strictly *
+ FROM actor.org_unit_setting
+ WHERE name = 'circ.holds.strict_holdability_check' AND org_unit = item_object.circ_lib;
- IF item_status_object.holdable IS FALSE THEN
- result.fail_part := 'status.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
- END IF;
+ IF check_holdability_strictly.id IS NOT NULL AND check_holdability_strictly.value = 'true' THEN
+ IF item_object.holdable IS FALSE THEN
+ result.fail_part := 'item.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
- IF item_location_object.holdable IS FALSE THEN
- result.fail_part := 'location.holdable';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
+ IF item_status_object.holdable IS FALSE THEN
+ result.fail_part := 'status.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
+
+ IF item_location_object.holdable IS FALSE THEN
+ result.fail_part := 'location.holdable';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
END IF;
IF hold_test.transit_range IS NOT NULL THEN
RETURN;
END;
+
$func$ LANGUAGE plpgsql;
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype ) VALUES
+( 'circ.holds.strict_holdability_check', 'holds',
+ oils_i18n_gettext('circ.strict_holdability_check',
+ 'Strict holdability check',
+ 'coust', 'label'),
+ oils_i18n_gettext('circ.holds.strict_holdability_check',
+ 'Allow hold to be placed only if at least one holdable copy is present',
+ 'coust', 'description'),
+ 'bool');
+
+INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (
+ 1, 'circ.holds.strict_holdability_check', 'true'
+);
+
+
+