[open-ils-commits] r12971 - in trunk/Open-ILS: examples src/sql/Pg (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 22 20:50:04 EDT 2009
Author: miker
Date: 2009-04-22 20:50:03 -0400 (Wed, 22 Apr 2009)
New Revision: 12971
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
Log:
allow groups of circ modifiers for the max-per-circ-mod test
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-04-22 20:13:20 UTC (rev 12970)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-04-23 00:50:03 UTC (rev 12971)
@@ -1055,10 +1055,23 @@
<field reporter:label="Test ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id"/>
<field reporter:label="Matchpoint ID" name="matchpoint" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link"/>
<field reporter:label="Items Out" name="items_out" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="int"/>
- <field reporter:label="Circulation Modifier" name="circ_mod" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="link"/>
</fields>
<links>
<link field="matchpoint" reltype="has_a" key="id" map="" class="ccmm"/>
+ </links>
+ </class>
+
+ <class id="ccmcmtm" controller="open-ils.cstore" oils_obj:fieldmapper="config::circ_matrix_circ_mod_test_map" oils_persist:tablename="config.circ_matrix_circ_mod_test_map" reporter:label="Circulation Matrix Circulation Modifier Subtest Circulation Modifier Set">
+ <fields oils_persist:primary="id" oils_persist:sequence="config.circ_matrix_circ_mod_test_map_id_seq">
+ <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+ <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+ <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+ <field reporter:label="Entry ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id"/>
+ <field reporter:label="Circulation Modifier Subtest ID" name="circ_mod_test" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link"/>
+ <field reporter:label="Circulation Modifier" name="circ_mod" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link"/>
+ </fields>
+ <links>
+ <link field="circ_mod_test" reltype="has_a" key="id" map="" class="ccmcmt"/>
<link field="circ_mod" reltype="has_a" key="code" map="" class="ccm"/>
</links>
</class>
Modified: trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2009-04-22 20:13:20 UTC (rev 12970)
+++ trunk/Open-ILS/src/sql/Pg/100.circ_matrix.sql 2009-04-23 00:50:03 UTC (rev 12971)
@@ -122,10 +122,15 @@
CREATE TABLE config.circ_matrix_circ_mod_test (
id SERIAL PRIMARY KEY,
matchpoint INT NOT NULL REFERENCES config.circ_matrix_matchpoint (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- items_out INT NOT NULL, -- Total current active circulations must be less than this, NULL means skip (always pass)
- circ_mod TEXT NOT NULL REFERENCES config.circ_modifier (code) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED-- circ_modifier type that the max out applies to
+ items_out INT NOT NULL -- Total current active circulations must be less than this, NULL means skip (always pass)
);
+CREATE TABLE config.circ_matrix_circ_mod_test_map (
+ id SERIAL PRIMARY KEY,
+ circ_mod_test INT NOT NULL REFERENCES config.circ_matrix_circ_mod_test (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ circ_mod TEXT NOT NULL REFERENCES config.circ_modifier (code) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ CONSTRAINT cm_once_per_test UNIQUE (circ_mod_test, circ_mod)
+);
CREATE OR REPLACE FUNCTION action.find_circ_matrix_matchpoint( context_ou INT, match_item BIGINT, match_user INT, renewal BOOL ) RETURNS config.circ_matrix_matchpoint AS $func$
DECLARE
@@ -224,6 +229,7 @@
result action.matrix_test_result;
circ_test config.circ_matrix_matchpoint%ROWTYPE;
out_by_circ_mod config.circ_matrix_circ_mod_test%ROWTYPE;
+ circ_mod_map config.circ_matrix_circ_mod_test_map%ROWTYPE;
penalty_type TEXT;
tmp_grp INT;
items_out INT;
@@ -332,7 +338,7 @@
AND circ_lib IN ( SELECT * FROM explode_array(context_org_list) )
AND circ.checkin_time IS NULL
AND (circ.stop_fines IN ('MAXFINES','LONGOVERDUE') OR circ.stop_fines IS NULL)
- AND cp.circ_modifier = out_by_circ_mod.circ_mod;
+ AND cp.circ_modifier IN (SELECT circ_mod FROM config.circ_matrix_circ_mod_test_map WHERE circ_mod_test = out_by_circ_mod.id);
IF items_out >= out_by_circ_mod.items_out THEN
result.fail_part := 'config.circ_matrix_circ_mod_test';
result.success := FALSE;
More information about the open-ils-commits
mailing list