LP#1545115: add description field for policy matrix tables
authorRogan Hamby <rogan.hamby@gmail.com>
Mon, 25 Apr 2016 16:59:12 +0000 (12:59 -0400)
committerJason Stephenson <jason@sigio.com>
Tue, 25 Apr 2017 17:30:13 +0000 (13:30 -0400)
This patch adds description column for the
config.hold_matrix_matchpoint and circ_matrix_matchpoint tables
and pgTAP tests for them.

Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/100.circ_matrix.sql
Open-ILS/src/sql/Pg/110.hold_matrix.sql
Open-ILS/src/sql/Pg/t/lp1545115-circ-and-hold-matrix-get-notes.pg [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_circ_matrix.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_hold_matrix.sql [new file with mode: 0644]
Open-ILS/src/templates/conify/global/config/circ_matrix_matchpoint.tt2
Open-ILS/src/templates/conify/global/config/hold_matrix_matchpoint.tt2

index ee01905..4c1ed76 100644 (file)
@@ -1870,6 +1870,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Max Holds" name="max_holds" reporter:datatype="int"/>
                        <field reporter:label="Max includes Frozen" name="include_frozen_holds" reporter:datatype="bool"/>
                        <field reporter:label="Copy Age Hold Protection Rule" name="age_hold_protect_rule" reporter:datatype="link"/>
+                       <field name="description" reporter:datatype="text" reporter:label="Description"/>
                </fields>
                <links>
                        <link field="user_home_ou" reltype="has_a" key="id" map="" class="aou"/>
@@ -1928,6 +1929,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Script Test" name="script_test" reporter:datatype="text"/>
                        <field name="total_copy_hold_ratio" reporter:datatype="float" reporter:label="Minimum Total Copy/Hold Ratio"/>
                        <field name="available_copy_hold_ratio" reporter:datatype="float" reporter:label="Minimum Available Copy/Hold Ratio"/>
+                       <field name="description" reporter:datatype="text" reporter:label="Description"/>
                </fields>
                <links>
                        <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
index 53b207a..09b4e3d 100644 (file)
@@ -81,7 +81,8 @@ CREATE TABLE config.circ_matrix_matchpoint (
     grace_period         INTERVAL,    -- Grace period override
     script_test          TEXT,                           -- javascript source 
     total_copy_hold_ratio     FLOAT,
-    available_copy_hold_ratio FLOAT
+    available_copy_hold_ratio FLOAT,
+    description          TEXT
 );
 
 -- Nulls don't count for a constraint match, so we have to coalesce them into something that does.
index fe17a9a..3b47b62 100644 (file)
@@ -55,7 +55,8 @@ CREATE TABLE config.hold_matrix_matchpoint (
     max_holds               INT,                            -- Total hold requests must be less than this, NULL means skip (always pass)
     include_frozen_holds    BOOL    NOT NULL DEFAULT TRUE,                -- Include frozen hold requests in the count for max_holds test
     stop_blocked_user       BOOL    NOT NULL DEFAULT FALSE,                -- Stop users who cannot check out items from placing holds
-    age_hold_protect_rule   INT        REFERENCES config.rule_age_hold_protect (id) DEFERRABLE INITIALLY DEFERRED    -- still not sure we want to move this off the copy
+    age_hold_protect_rule   INT        REFERENCES config.rule_age_hold_protect (id) DEFERRABLE INITIALLY DEFERRED,    -- still not sure we want to move this off the copy
+    description             TEXT
 );
 
 -- Nulls don't count for a constraint match, so we have to coalesce them into something that does.
diff --git a/Open-ILS/src/sql/Pg/t/lp1545115-circ-and-hold-matrix-get-notes.pg b/Open-ILS/src/sql/Pg/t/lp1545115-circ-and-hold-matrix-get-notes.pg
new file mode 100644 (file)
index 0000000..65e8c46
--- /dev/null
@@ -0,0 +1,17 @@
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(2);
+
+-- Run the tests.
+
+SELECT has_column('config', 'circ_matrix_matchpoint', 'description', 
+    'Column "description" on config.circ_matrix_matchpoint should exist');
+SELECT has_column('config', 'hold_matrix_matchpoint', 'description',
+    'Column "description" on config.hold_matrix_matchpoint should exist');
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_circ_matrix.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_circ_matrix.sql
new file mode 100644 (file)
index 0000000..a461c4b
--- /dev/null
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE config.circ_matrix_matchpoint
+    ADD COLUMN description TEXT;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_hold_matrix.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.schema.add_description_hold_matrix.sql
new file mode 100644 (file)
index 0000000..f65fc13
--- /dev/null
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE config.hold_matrix_matchpoint
+    ADD COLUMN description TEXT;
+
+COMMIT;
index a576d46..df2b8cc 100644 (file)
@@ -9,7 +9,7 @@
     <table  jsId="cmGrid"
             style="height: 600px;"
             dojoType="openils.widget.AutoGrid"
-            fieldOrder="['id', 'active', 'grp', 'org_unit', 'copy_circ_lib', 'copy_owning_lib', 'user_home_ou', 'is_renewal', 'juvenile_flag', 'circ_modifier', 'copy_location', 'marc_type', 'marc_form', 'marc_bib_level', 'marc_vr_format', 'ref_flag', 'usr_age_lower_bound', 'usr_age_upper_bound', 'item_age', 'circulate', 'duration_rule', 'renewals', 'hard_due_date', 'recurring_fine_rule', 'grace_period', 'max_fine_rule', 'available_copy_hold_ratio', 'total_copy_hold_ratio', 'script_test']"
+            fieldOrder="['id', 'active', 'grp', 'org_unit', 'copy_circ_lib', 'copy_owning_lib', 'user_home_ou', 'is_renewal', 'juvenile_flag', 'circ_modifier', 'copy_location', 'marc_type', 'marc_form', 'marc_bib_level', 'marc_vr_format', 'ref_flag', 'usr_age_lower_bound', 'usr_age_upper_bound', 'item_age', 'circulate', 'duration_rule', 'renewals', 'hard_due_date', 'recurring_fine_rule', 'grace_period', 'max_fine_rule', 'available_copy_hold_ratio', 'total_copy_hold_ratio', 'script_test', 'description']"
             defaultCellWidth='"auto"'
             query="{id: '*'}"
             fmClass='ccmm'
index d92eaa2..3079f02 100644 (file)
@@ -8,7 +8,7 @@
     <table  jsId="hmGrid" 
             autoHeight='true'
             dojoType="openils.widget.AutoGrid" 
-            fieldOrder="['id', 'strict_ou_match', 'user_home_ou', 'request_ou', 'pickup_ou', 'item_owning_ou', 'item_circ_ou', 'requestor_grp', 'circ_modifier', 'marc_type', 'marc_form', 'marc_bib_level', 'marc_vr_format']"
+            fieldOrder="['id', 'strict_ou_match', 'user_home_ou', 'request_ou', 'pickup_ou', 'item_owning_ou', 'item_circ_ou', 'requestor_grp', 'circ_modifier', 'marc_type', 'marc_form', 'marc_bib_level', 'marc_vr_format', 'description']"
             defaultCellWidth='"auto"'
             query="{id: '*'}" 
             fmClass='chmm'