From 6449843a30c98d0c5586d9f99a6f27e02692eb2b Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 25 Oct 2011 17:33:57 -0400 Subject: [PATCH] lp870029: add YAOUS for strict holdability checking Add circ.holds.strict_holdability_check to control whether the copy, copy status, and copy location holdable flags are checked when seeing if a hold can be placed or a copy can be targetted to fill a hold. Also set the default value of this OUS to true to retain legacy behavior. Signed-off-by: Galen Charlton --- Open-ILS/src/sql/Pg/110.hold_matrix.sql | 41 ++++++++------- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 12 +++++ .../sql/Pg/upgrade/XXXX.fix_indb_hold_permit.sql | 59 +++++++++++++++------- 3 files changed, 78 insertions(+), 34 deletions(-) diff --git a/Open-ILS/src/sql/Pg/110.hold_matrix.sql b/Open-ILS/src/sql/Pg/110.hold_matrix.sql index 5131afb22b..5a02995fff 100644 --- a/Open-ILS/src/sql/Pg/110.hold_matrix.sql +++ b/Open-ILS/src/sql/Pg/110.hold_matrix.sql @@ -227,6 +227,7 @@ DECLARE 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; @@ -307,25 +308,31 @@ BEGIN 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 diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 09466eb983..ce89100939 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -4447,6 +4447,15 @@ INSERT into config.org_unit_setting_type '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 @@ -4477,6 +4486,9 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES ( ,(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); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_indb_hold_permit.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_indb_hold_permit.sql index 35d2ba416c..1f4d013beb 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_indb_hold_permit.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.fix_indb_hold_permit.sql @@ -11,6 +11,7 @@ DECLARE 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; @@ -91,25 +92,31 @@ BEGIN 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 @@ -213,4 +220,22 @@ BEGIN 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' +); + + + -- 2.11.0