Advertisement
chrissharp123

Untitled

Jun 17th, 2022
1,563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. IF item_object.age_protect IS NOT NULL THEN
  2.     SELECT INTO age_protect_object * FROM config.rule_age_hold_protect WHERE id = item_object.age_protect;
  3.     IF hold_test.distance_is_from_owner THEN
  4.         SELECT INTO use_active_date value FROM actor.org_unit_ancestor_setting('circ.holds.age_protect.active_date', item_cn_object.owning_lib);
  5.     ELSE
  6.         SELECT INTO use_active_date value FROM actor.org_unit_ancestor_setting('circ.holds.age_protect.active_date', item_object.circ_lib);
  7.     END IF;
  8.     IF use_active_date = 'true' THEN
  9.         age_protect_date := COALESCE(item_object.active_date, NOW());
  10.     ELSE
  11.         age_protect_date := item_object.create_date;
  12.     END IF;
  13.     IF age_protect_date + age_protect_object.age > NOW() THEN
  14.         SELECT INTO calc_age_prox * FROM actor.org_unit_setting WHERE name = 'circ.holds.calculated_age_proximity' AND org_unit = item_object.circ_lib;
  15.         IF hold_test.distance_is_from_owner THEN
  16.             prox_ou := item_cn_object.owning_lib;
  17.         ELSE
  18.             prox_ou := item_object.circ_lib;
  19.         END IF;
  20.         IF calc_age_prox.id IS NOT NULL AND calc_age_prox.value = 'true' THEN
  21.             SELECT INTO hold_transit_prox action.copy_calculated_proximity(
  22.                 v_pickup_ou,
  23.                 v_request_ou,
  24.                 prox_ou,
  25.                 item_object.circ_modifier,
  26.                 item_cn_object.owning_lib,
  27.                 item_location_object.owning_lib
  28.             );
  29.         ELSE
  30.             SELECT INTO hold_transit_prox prox::NUMERIC FROM actor.org_unit_proximity WHERE from_org = prox_ou AND to_org = v_pickup_ou;
  31.         END IF;
  32.  
  33.         IF hold_transit_prox > age_protect_object.prox::NUMERIC THEN
  34.             result.fail_part := 'config.rule_age_hold_protect.prox';
  35.             result.success := FALSE;
  36.             done := TRUE;
  37.             RETURN NEXT result;
  38.         END IF;
  39.     END IF;
  40. END IF;
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement