Patch from Lebbeous Fogle-Weekley to add a sample long wait notice for holds
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Nov 2009 13:40:23 +0000 (13:40 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 16 Nov 2009 13:40:23 +0000 (13:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14919 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/action_trigger_filters.json.example
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql [new file with mode: 0644]

index f9b9df8..d599d7b 100644 (file)
             "shelf_time": {"!=": null},
             "cancel_time": null
         }
+    },
+    "hold_request.long_wait" : {
+        "context_org": "pickup_lib",
+        "filter": {
+            "frozen": "f",
+            "cancel_time": null,
+            "capture_time": null
+        }
     }
 }
index 0f8dba6..f7baeb5 100644 (file)
@@ -4867,7 +4867,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="id" reltype="might_have" key="id" map="" class="circ"/>
                </links>
        </class>
-       <class id="rhrr" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::hold_request_record" oils_persist:tablename="reporter.hold_request_record" reporter:label="Hold Request Record">
+       <class id="rhrr" controller="open-ils.reporter-store open-ils.cstore" oils_obj:fieldmapper="reporter::hold_request_record" oils_persist:tablename="reporter.hold_request_record" reporter:label="Hold Request Record">
                <fields oils_persist:primary="id">
                        <field reporter:label="Hold ID" name="id" reporter:datatype="id" />
                        <field reporter:label="Hold Target" name="target" reporter:datatype="int" />
index 2d67552..2475548 100644 (file)
@@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0083'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0084'); -- senator
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index d4ec9cf..a0752f0 100644 (file)
@@ -2228,6 +2228,72 @@ INSERT INTO action_trigger.environment (
     ( 7, 'pickup_lib.billing_address'),
     ( 7, 'usr');
 
+-- long wait hold request notifications
+
+INSERT INTO action_trigger.hook (
+        key,
+        core_type,
+        description,
+        passive
+    ) VALUES (
+        'hold_request.long_wait',
+        'ahr',
+        'A patron has been waiting on a hold to be fulfilled for a long time.',
+        TRUE
+    );
+
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        delay,
+        delay_field,
+        group_field,
+        template
+    ) VALUES (
+        9,
+        FALSE,
+        1,
+        'Hold waiting for pickup for long time',
+        'hold_request.long_wait',
+        'NOOP_True',
+        'SendEmail',
+        '6 MONTHS',
+        'request_time',
+        'usr',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Long Wait Hold Notification
+
+Dear [% user.family_name %], [% user.first_given_name %]
+
+You requested hold(s) on the following item(s), but unfortunately
+we have not been able to fulfill your request after a considerable
+length of time.  If you would still like to recieve these items,
+no action is required.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+[% END %]
+$$
+);
+
+INSERT INTO action_trigger.environment (event_def, path)
+    VALUES
+        (9, 'pickup_lib'),
+        (9, 'usr'),
+        (9, 'bib_rec.bib_record.simple_record');
+
+
+
 SELECT SETVAL('action_trigger.event_definition_id_seq'::TEXT, 100);
 
 -- Org Unit Settings for configuring org unit weights and org unit max-loops for hold targeting
diff --git a/Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql b/Open-ILS/src/sql/Pg/upgrade/0084.data.hold_request.long_wait.sql
new file mode 100644 (file)
index 0000000..4abf7a0
--- /dev/null
@@ -0,0 +1,70 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0084'); -- senator
+
+INSERT INTO action_trigger.hook (
+        key,
+        core_type,
+        description,
+        passive
+    ) VALUES (
+        'hold_request.long_wait',
+        'ahr',
+        'A patron has been waiting on a hold to be fulfilled for a long time.',
+        TRUE
+    );
+
+INSERT INTO action_trigger.event_definition (
+        id,
+        active,
+        owner,
+        name,
+        hook,
+        validator,
+        reactor,
+        delay,
+        delay_field,
+        group_field,
+        template
+    ) VALUES (
+        9,
+        FALSE,
+        1,
+        'Hold waiting for pickup for long time',
+        'hold_request.long_wait',
+        'NOOP_True',
+        'SendEmail',
+        '6 MONTHS',
+        'request_time',
+        'usr',
+$$
+[%- USE date -%]
+[%- user = target.0.usr -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Long Wait Hold Notification
+
+Dear [% user.family_name %], [% user.first_given_name %]
+
+You requested hold(s) on the following item(s), but unfortunately
+we have not been able to fulfill your request after a considerable
+length of time.  If you would still like to recieve these items,
+no action is required.
+
+[% FOR hold IN target %]
+    Title: [% hold.bib_rec.bib_record.simple_record.title %]
+    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+[% END %]
+$$
+);
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+    (9, 'pickup_lib'),
+    (9, 'usr'),
+    (9, 'bib_rec.bib_record.simple_record');
+
+
+COMMIT;