[open-ils-commits] r9599 - trunk/Open-ILS/src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 14 12:23:44 EDT 2008
Author: miker
Date: 2008-05-14 12:23:42 -0400 (Wed, 14 May 2008)
New Revision: 9599
Modified:
trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
Log:
use a RECORD for LOOP for postgres 8.1 compat
Modified: trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2008-05-14 02:50:37 UTC (rev 9598)
+++ trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2008-05-14 16:23:42 UTC (rev 9599)
@@ -228,7 +228,7 @@
items_overdue INT;
current_fines NUMERIC(8,2) := 0.0;
tmp_fines NUMERIC(8,2);
- tmp_xact BIGINT;
+ tmp_xact RECORD;
done BOOL := FALSE;
BEGIN
result.success := TRUE;
@@ -352,10 +352,10 @@
-- Fail if the user has a high fine balance
IF circ_test.max_fines IS NOT NULL THEN
- FOR tmp_xact IN SELECT id FROM money.billable_xact WHERE usr = match_usr AND xact_finish IS NULL LOOP
- SELECT INTO tmp_fines SUM( amount ) FROM money.billing WHERE xact = tmp_xact AND NOT voided;
+ FOR tmp_xact IN SELECT * FROM money.billable_xact WHERE usr = match_usr AND xact_finish IS NULL LOOP
+ SELECT INTO tmp_fines SUM( amount ) FROM money.billing WHERE xact = tmp_xact.id AND NOT voided;
current_fines = current_fines + COALESCE(tmp_fines, 0.0);
- SELECT INTO tmp_fines SUM( amount ) FROM money.payment WHERE xact = tmp_xact AND NOT voided;
+ SELECT INTO tmp_fines SUM( amount ) FROM money.payment WHERE xact = tmp_xact.id AND NOT voided;
current_fines = current_fines - COALESCE(tmp_fines, 0.0);
END LOOP;
More information about the open-ils-commits
mailing list