Stamped DB version for hold_pull_list_template w/ parts
authorBill Erickson <berick@esilibrary.com>
Thu, 7 Jul 2011 18:24:45 +0000 (14:24 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 7 Jul 2011 18:25:20 +0000 (14:25 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0574.data.hold_pull_list_template.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql [deleted file]

index 67b3493..294eb0e 100644 (file)
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0573', :eg_version); -- miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0574', :eg_version); -- berick
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0574.data.hold_pull_list_template.sql b/Open-ILS/src/sql/Pg/upgrade/0574.data.hold_pull_list_template.sql
new file mode 100644 (file)
index 0000000..a0bea8c
--- /dev/null
@@ -0,0 +1,79 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0574', :eg_version);
+
+UPDATE action_trigger.event_definition SET template =
+$$
+[%- USE date -%]
+<style>
+    table { border-collapse: collapse; }
+    td { padding: 5px; border-bottom: 1px solid #888; }
+    th { font-weight: bold; }
+</style>
+[%
+    # Sort the holds into copy-location buckets
+    # In the main print loop, sort each bucket by callnumber before printing
+    SET holds_list = [];
+    SET loc_data = [];
+    SET current_location = target.0.current_copy.location.id;
+    FOR hold IN target;
+        IF current_location != hold.current_copy.location.id;
+            SET current_location = hold.current_copy.location.id;
+            holds_list.push(loc_data);
+            SET loc_data = [];
+        END;
+        SET hold_data = {
+            'hold' => hold,
+            'callnumber' => hold.current_copy.call_number.label
+        };
+        loc_data.push(hold_data);
+    END;
+    holds_list.push(loc_data)
+%]
+<table>
+    <thead>
+        <tr>
+            <th>Title</th>
+            <th>Author</th>
+            <th>Shelving Location</th>
+            <th>Call Number</th>
+            <th>Barcode/Part</th>
+            <th>Patron</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR loc_data IN holds_list  %]
+        [% FOR hold_data IN loc_data.sort('callnumber') %]
+            [%
+                SET hold = hold_data.hold;
+                SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
+            %]
+            <tr>
+                <td>[% copy_data.title | truncate %]</td>
+                <td>[% copy_data.author | truncate %]</td>
+                <td>[% hold.current_copy.location.name %]</td>
+                <td>[% hold.current_copy.call_number.label %]</td>
+                <td>[% hold.current_copy.barcode %]
+                    [% FOR part IN hold.current_copy.parts %]
+                       [% part.part.label %]
+                    [% END %]
+                </td>
+                <td>[% hold.usr.card.barcode %]</td>
+            </tr>
+        [% END %]
+    [% END %]
+    <tbody>
+</table>
+$$
+    WHERE id = 35;
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+        (35, 'current_copy.parts'),
+        (35, 'current_copy.parts.part')
+;
+
+COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql b/Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql
deleted file mode 100644 (file)
index 32c9460..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-BEGIN;
-
-INSERT INTO config.upgrade_log (version) VALUES ('xxxx');
-
-UPDATE action_trigger.event_definition SET template =
-$$
-[%- USE date -%]
-<style>
-    table { border-collapse: collapse; }
-    td { padding: 5px; border-bottom: 1px solid #888; }
-    th { font-weight: bold; }
-</style>
-[%
-    # Sort the holds into copy-location buckets
-    # In the main print loop, sort each bucket by callnumber before printing
-    SET holds_list = [];
-    SET loc_data = [];
-    SET current_location = target.0.current_copy.location.id;
-    FOR hold IN target;
-        IF current_location != hold.current_copy.location.id;
-            SET current_location = hold.current_copy.location.id;
-            holds_list.push(loc_data);
-            SET loc_data = [];
-        END;
-        SET hold_data = {
-            'hold' => hold,
-            'callnumber' => hold.current_copy.call_number.label
-        };
-        loc_data.push(hold_data);
-    END;
-    holds_list.push(loc_data)
-%]
-<table>
-    <thead>
-        <tr>
-            <th>Title</th>
-            <th>Author</th>
-            <th>Shelving Location</th>
-            <th>Call Number</th>
-            <th>Barcode/Part</th>
-            <th>Patron</th>
-        </tr>
-    </thead>
-    <tbody>
-    [% FOR loc_data IN holds_list  %]
-        [% FOR hold_data IN loc_data.sort('callnumber') %]
-            [%
-                SET hold = hold_data.hold;
-                SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
-            %]
-            <tr>
-                <td>[% copy_data.title | truncate %]</td>
-                <td>[% copy_data.author | truncate %]</td>
-                <td>[% hold.current_copy.location.name %]</td>
-                <td>[% hold.current_copy.call_number.label %]</td>
-                <td>[% hold.current_copy.barcode %]
-                    [% FOR part IN hold.current_copy.parts %]
-                       [% part.part.label %]
-                    [% END %]
-                </td>
-                <td>[% hold.usr.card.barcode %]</td>
-            </tr>
-        [% END %]
-    [% END %]
-    <tbody>
-</table>
-$$
-    WHERE id = 35;
-
-INSERT INTO action_trigger.environment (
-        event_def,
-        path
-    ) VALUES
-        (35, 'current_copy.parts'),
-        (35, 'current_copy.parts.part')
-;
-
-COMMIT;
-