[open-ils-commits] r15759 - branches/rel_1_6_0/Open-ILS/src/sql/Pg (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 9 10:49:59 EST 2010
Author: miker
Date: 2010-03-09 10:49:57 -0500 (Tue, 09 Mar 2010)
New Revision: 15759
Modified:
branches/rel_1_6_0/Open-ILS/src/sql/Pg/100.circ_matrix.sql
branches/rel_1_6_0/Open-ILS/src/sql/Pg/110.hold_matrix.sql
Log:
backporting the relevant portions of r15619, get a matchpoint as early as possible for override purposes
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/100.circ_matrix.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2010-03-09 12:21:15 UTC (rev 15758)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2010-03-09 15:49:57 UTC (rev 15759)
@@ -241,7 +241,7 @@
-- Fail if the user is BARRED
SELECT INTO user_object * FROM actor.usr WHERE id = match_user;
- -- Fail if we couldn't find a set of tests
+ -- Fail if we couldn't find the user
IF user_object.id IS NULL THEN
result.fail_part := 'no_user';
result.success := FALSE;
@@ -250,6 +250,28 @@
RETURN;
END IF;
+ SELECT INTO item_object * FROM asset.copy WHERE id = match_item;
+
+ -- Fail if we couldn't find the item
+ IF item_object.id IS NULL THEN
+ result.fail_part := 'no_user';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ RETURN;
+ END IF;
+
+ SELECT INTO circ_test * FROM action.find_circ_matrix_matchpoint(circ_ou, match_item, match_user, renewal);
+ result.matchpoint := circ_test.id;
+
+ -- Fail if we couldn't find a matchpoint
+ IF result.matchpoint IS NULL THEN
+ result.fail_part := 'no_matchpoint';
+ result.success := FALSE;
+ done := TRUE;
+ RETURN NEXT result;
+ END IF;
+
IF user_object.barred IS TRUE THEN
result.fail_part := 'actor.usr.barred';
result.success := FALSE;
@@ -258,7 +280,6 @@
END IF;
-- Fail if the item can't circulate
- SELECT INTO item_object * FROM asset.copy WHERE id = match_item;
IF item_object.circulate IS FALSE THEN
result.fail_part := 'asset.copy.circulate';
result.success := FALSE;
@@ -288,19 +309,8 @@
RETURN NEXT result;
END IF;
- SELECT INTO circ_test * FROM action.find_circ_matrix_matchpoint(circ_ou, match_item, match_user, renewal);
- result.matchpoint := circ_test.id;
-
SELECT INTO context_org_list ARRAY_ACCUM(id) FROM actor.org_unit_full_path( circ_test.org_unit );
- -- Fail if we couldn't find a set of tests
- IF result.matchpoint IS NULL THEN
- result.fail_part := 'no_matchpoint';
- result.success := FALSE;
- done := TRUE;
- RETURN NEXT result;
- END IF;
-
-- Fail if the test is set to hard non-circulating
IF circ_test.circulate IS FALSE THEN
result.fail_part := 'config.circ_matrix_test.circulate';
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/110.hold_matrix.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2010-03-09 12:21:15 UTC (rev 15758)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/110.hold_matrix.sql 2010-03-09 15:49:57 UTC (rev 15759)
@@ -185,6 +185,8 @@
SELECT INTO user_object * FROM actor.usr WHERE id = match_user;
SELECT INTO context_org_list ARRAY_ACCUM(id) FROM actor.org_unit_full_path( pickup_ou );
+ result.success := TRUE;
+
-- Fail if we couldn't find a user
IF user_object.id IS NULL THEN
result.fail_part := 'no_user';
@@ -194,28 +196,29 @@
RETURN;
END IF;
- -- Fail if user is barred
- IF user_object.barred IS TRUE THEN
- result.fail_part := 'actor.usr.barred';
+ SELECT INTO item_object * FROM asset.copy WHERE id = match_item;
+
+ -- Fail if we couldn't find a copy
+ IF item_object.id IS NULL THEN
+ result.fail_part := 'no_item';
result.success := FALSE;
done := TRUE;
RETURN NEXT result;
RETURN;
END IF;
- SELECT INTO item_object * FROM asset.copy WHERE id = match_item;
+ SELECT INTO matchpoint_id action.find_hold_matrix_matchpoint(pickup_ou, request_ou, match_item, match_user, match_requestor);
+ result.matchpoint := matchpoint_id;
- -- Fail if we couldn't find a copy
- IF item_object.id IS NULL THEN
- result.fail_part := 'no_item';
+ -- 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 matchpoint_id action.find_hold_matrix_matchpoint(pickup_ou, request_ou, match_item, match_user, match_requestor);
-
-- Fail if we couldn't find any matchpoint (requires a default)
IF matchpoint_id IS NULL THEN
result.fail_part := 'no_matchpoint';
@@ -227,9 +230,6 @@
SELECT INTO hold_test * FROM config.hold_matrix_matchpoint WHERE id = matchpoint_id;
- result.matchpoint := hold_test.id;
- result.success := TRUE;
-
IF hold_test.holdable IS FALSE THEN
result.fail_part := 'config.hold_matrix_test.holdable';
result.success := FALSE;
More information about the open-ils-commits
mailing list