[open-ils-commits] [GIT] Evergreen ILS branch master updated. ffcf0428e6c57d7c3e075094caae3a62305c1f32

Evergreen Git git at git.evergreen-ils.org
Tue Nov 15 12:11:31 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  ffcf0428e6c57d7c3e075094caae3a62305c1f32 (commit)
       via  ae9a66066ff3d50e6aa5bb37ad50afdd7e795af2 (commit)
      from  ceeea809f0f5fedd694b8d18fc03dd1bcc1a174f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ffcf0428e6c57d7c3e075094caae3a62305c1f32
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Nov 15 12:18:53 2011 -0500

    Stamped upgrade script for hold_notification update via A/T cleanup module
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 6cac923..2a45321 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -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 ('0646', :eg_version); -- jamesrf/senator
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0647', :eg_version); -- berick/miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql b/Open-ILS/src/sql/Pg/upgrade/0647.data.hold-notification-cleanup-mod.sql
similarity index 90%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql
rename to Open-ILS/src/sql/Pg/upgrade/0647.data.hold-notification-cleanup-mod.sql
index 40da866..2578ccb 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0647.data.hold-notification-cleanup-mod.sql
@@ -2,7 +2,7 @@
 BEGIN;
 
 -- check whether patch can be applied
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0647', :eg_version);
 
 INSERT INTO action_trigger.cleanup ( module, description ) VALUES (
     'CreateHoldNotification',

commit ae9a66066ff3d50e6aa5bb37ad50afdd7e795af2
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Jun 9 15:21:39 2011 -0400

    Hold notification creation A/T cleanup module
    
    New CreateHoldNotification Action/Trigger cleanup module that, when
    linked to a hold-based event_definition, adds an entry into
    action.hold_notification for each hold processed.  The main user-facing
    change from this will be that the hold notification time / count in the
    staff client will now take A/T notices into effect in addition to
    manually created hold notifications.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Cleanup.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Cleanup.pm
index 495a60a..67e2daf 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Cleanup.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Cleanup.pm
@@ -2,6 +2,7 @@ package OpenILS::Application::Trigger::Cleanup;
 use strict; use warnings;
 use OpenILS::Utils::CStoreEditor q/:funcs/;
 use OpenSRF::Utils::Logger qw/:logger/;
+use OpenILS::Utils::Fieldmapper;
 
 sub fourty_two { return 42 }
 sub NOOP_True { return 1 }
@@ -26,4 +27,31 @@ sub DeleteTempBiblioBucket {
     return 1;
 }
 
+# This is really more of an auxillary reactor
+sub CreateHoldNotification {
+    my ($self, $env) = @_;
+    my $e = new_editor(xact => 1);
+    my $holds = $env->{target};
+
+    my $event_def = (ref $env->{event} eq 'ARRAY') ?
+        $env->{event}->[0]->event_def : # event_def is grouped
+        $env->{event}->event_def;
+
+    for my $hold (@$holds) {
+
+        my $notify = Fieldmapper::action::hold_notification->new;
+        $notify->hold($hold->id);
+        $notify->method($event_def->reactor);
+
+        unless($e->create_action_hold_notification($notify)) {
+            $e->rollback;
+            return 0;
+        }
+    }
+
+    return 1 if $e->commit;
+    $e->rollback;
+    return 0;
+}
+
 1;
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 686471e..e317202 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -6341,9 +6341,18 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
     (4, 'lineitems.lineitem_notes'),
     (4, 'notes');
 
+INSERT INTO action_trigger.cleanup ( module, description ) VALUES (
+    'CreateHoldNotification',
+    oils_i18n_gettext(
+        'CreateHoldNotification',
+        'Creates a hold_notification record for each notified hold',
+        'atclean',
+        'description'
+    )
+);
 
-INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template)
-    VALUES (5, 'f', 1, 'Hold Ready for Pickup Email Notification', 'hold.available', 'HoldIsAvailable', 'SendEmail', '30 minutes', 'shelf_time', 'usr',
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, cleanup_success, template)
+    VALUES (5, 'f', 1, 'Hold Ready for Pickup Email Notification', 'hold.available', 'HoldIsAvailable', 'SendEmail', '30 minutes', 'shelf_time', 'usr', 'CreateHoldNotification',
 $$
 [%- USE date -%]
 [%- user = target.0.usr -%]
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql
new file mode 100644
index 0000000..40da866
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.hold-notification-cleanup-mod.sql
@@ -0,0 +1,24 @@
+-- Evergreen DB patch XXXX.data.hold-notification-cleanup-mod.sql
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO action_trigger.cleanup ( module, description ) VALUES (
+    'CreateHoldNotification',
+    oils_i18n_gettext(
+        'CreateHoldNotification',
+        'Creates a hold_notification record for each notified hold',
+        'atclean',
+        'description'
+    )
+);
+
+UPDATE action_trigger.event_definition 
+    SET 
+        cleanup_success = 'CreateHoldNotification' 
+    WHERE 
+        id = 5 -- stock hold-ready email event_def
+        AND cleanup_success IS NULL; -- don't clobber any existing cleanup mod
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Trigger/Cleanup.pm     |   28 ++++++++++++++++++++
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   13 ++++++++-
 .../0647.data.hold-notification-cleanup-mod.sql    |   24 +++++++++++++++++
 4 files changed, 64 insertions(+), 3 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0647.data.hold-notification-cleanup-mod.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list