stop hold permit check from crashing if age protection in effect
authorGalen Charlton <gmc@esilibrary.com>
Tue, 17 May 2011 04:40:02 +0000 (00:40 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 24 May 2011 15:50:28 +0000 (11:50 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/sql/Pg/110.hold_matrix.sql

index 4105472..602bcdb 100644 (file)
@@ -174,6 +174,7 @@ DECLARE
     transit_range_ou_type    actor.org_unit_type%ROWTYPE;
     transit_source        actor.org_unit%ROWTYPE;
     item_object        asset.copy%ROWTYPE;
+    item_cn_object     asset.call_number%ROWTYPE;
     result            action.matrix_test_result;
     hold_test        config.hold_matrix_matchpoint%ROWTYPE;
     hold_count        INT;
@@ -308,6 +309,7 @@ BEGIN
 
         IF item_object.create_date + age_protect_object.age > NOW() THEN
             IF hold_test.distance_is_from_owner THEN
+                SELECT INTO item_cn_object * FROM asset.call_number WHERE id = item_object.call_number;
                 SELECT INTO hold_transit_prox prox FROM actor.org_unit_proximity WHERE from_org = item_cn_object.owning_lib AND to_org = pickup_ou;
             ELSE
                 SELECT INTO hold_transit_prox prox FROM actor.org_unit_proximity WHERE from_org = item_object.circ_lib AND to_org = pickup_ou;