From c1da8abc359b6d9f24ce57b1d8852d18a3f043c0 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Fri, 8 Apr 2022 16:06:37 +0100 Subject: [PATCH] Bug 30484: Add ILL update notice Adds a new ILL_REQUEST_UPDATE notice which is to be used for the formation of notices informing users of updates to ILL requests. Commit includes database updates and template changes for messaging preferences Signed-off-by: Katrin Fischer https://bugs.koha-community.org/show_bug.cgi?id=28909 --- .../bug_30484-add-ill-update-notice.pl | 22 ++++++ .../mysql/en/mandatory/sample_notices.yml | 68 +++++++++++++++++++ .../sample_notices_message_attributes.sql | 3 +- .../sample_notices_message_transports.sql | 5 +- .../en/includes/messaging-preference-form.inc | 1 + .../prog/en/modules/admin/categories.tt | 1 + .../bootstrap/en/modules/opac-messaging.tt | 1 + 7 files changed, 99 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_30484-add-ill-update-notice.pl diff --git a/installer/data/mysql/atomicupdate/bug_30484-add-ill-update-notice.pl b/installer/data/mysql/atomicupdate/bug_30484-add-ill-update-notice.pl new file mode 100755 index 0000000000..06583df78c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30484-add-ill-update-notice.pl @@ -0,0 +1,22 @@ +use Modern::Perl; + +return { + bug_number => "30484", + description => "Add a notice template for ILL Update notices", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_UPDATE', '', 'ILL request update', 0, "Interlibrary loan request update", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nThe Interlibrary loans request number [% illrequest.illrequest_id %] you placed for\n\n- [% ill_bib_title %] - [% ill_bib_author %]\n\nhas been updated\n\nDetails of the update are below:\n\n[% additional_text %]\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'email', 'default');}); + $dbh->do(q{INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('ill', 'ILL_REQUEST_UPDATE', '', 'ILL request update', 0, "Interlibrary loan request update", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nThe Interlibrary loans request number [% illrequest.illrequest_id %] you placed for\n\n- [% ill_bib_title %] - [% ill_bib_author %]\n\nhas been updated\n\nDetails of the update are below:\n\n[% additional_text %]\n\nKind Regards\n\n[% branch.branchname %]\n[% branch.branchaddress1 %]\n[% branch.branchaddress2 %]\n[% branch.branchaddress3 %]\n[% branch.branchcity %]\n[% branch.branchstate %]\n[% branch.branchzip %]\n[% branch.branchphone %]\n[% branch.branchillemail %]\n[% branch.branchemail %]", 'sms', 'default');}); + $dbh->do(q{INSERT IGNORE INTO message_attributes (message_name, takes_days) VALUES ('Ill_update', 0);}); + my $ready_id = $dbh->last_insert_id(undef, undef, 'message_attributes', undef); + if (defined $ready_id) { + $dbh->do(qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'email', 0, 'ill', 'ILL_REQUEST_UPDATE');)); + $dbh->do(qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'sms', 0, 'ill', 'ILL_REQUEST_UPDATE');)); + $dbh->do(qq(INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES ($ready_id, 'phone', 0, 'ill', 'ILL_REQUEST_UPDATE');)); + say $out "Bug 30484 DB update complete"; + } else { + say $out "Bug 30484 DB update not completed"; + } + }, +}; diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml index cdb8ab18d0..ebe2a38715 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ b/installer/data/mysql/en/mandatory/sample_notices.yml @@ -838,6 +838,40 @@ tables: - "[% branch.branchillemail %]" - "[% branch.branchemail %]" + - module: ill + code: ILL_REQUEST_UPDATE + branchcode: "" + name: "ILL request update" + is_html: 0 + title: "Interlibrary loan request update" + message_transport_type: email + lang: default + content: + - "Dear [% borrower.firstname %] [% borrower.surname %]," + - "" + - "The Interlibrary loans request number [% illrequest.illrequest_id %] you placed for" + - "" + - "- [% ill_bib_title %] - [% ill_bib_author %]" + - "" + - "has been updated." + - "" + - "Details of the update are below:" + - "" + - "[% additional_text %]" + - "" + - "Kind Regards" + - "" + - "[% branch.branchname %]" + - "[% branch.branchaddress1 %]" + - "[% branch.branchaddress2 %]" + - "[% branch.branchaddress3 %]" + - "[% branch.branchcity %]" + - "[% branch.branchstate %]" + - "[% branch.branchzip %]" + - "[% branch.branchphone %]" + - "[% branch.branchillemail %]" + - "[% branch.branchemail %]" + - module: ill code: ILL_PICKUP_READY branchcode: "" @@ -954,6 +988,40 @@ tables: - "[% branch.branchillemail %]" - "[% branch.branchemail %]" + - module: ill + code: ILL_REQUEST_UPDATE + branchcode: "" + name: "ILL request update" + is_html: 0 + title: "Interlibrary loan request update" + message_transport_type: sms + lang: default + content: + - "Dear [% borrower.firstname %] [% borrower.surname %]," + - "" + - "The Interlibrary loans request number [% illrequest.illrequest_id %] you placed for" + - "" + - "- [% ill_bib_title %] - [% ill_bib_author %]" + - "" + - "has been updated." + - "" + - "Details of the update are below:" + - "" + - "[% additional_text %]" + - "" + - "Kind Regards" + - "" + - "[% branch.branchname %]" + - "[% branch.branchaddress1 %]" + - "[% branch.branchaddress2 %]" + - "[% branch.branchaddress3 %]" + - "[% branch.branchcity %]" + - "[% branch.branchstate %]" + - "[% branch.branchzip %]" + - "[% branch.branchphone %]" + - "[% branch.branchillemail %]" + - "[% branch.branchemail %]" + - module: members code: DISCHARGE branchcode: "" diff --git a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/mandatory/sample_notices_message_attributes.sql index 6cabc4e92e..bd0294c960 100644 --- a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql +++ b/installer/data/mysql/mandatory/sample_notices_message_attributes.sql @@ -9,5 +9,6 @@ values (7, 'Ill_ready', 0), (8, 'Ill_unavailable', 0), (9, 'Auto_Renewals', 0), -(10, 'Hold_Reminder', 0); +(10, 'Hold_Reminder', 0), +(11, 'Ill_update', 0); diff --git a/installer/data/mysql/mandatory/sample_notices_message_transports.sql b/installer/data/mysql/mandatory/sample_notices_message_transports.sql index 2a224996c7..d1fae4c0ce 100644 --- a/installer/data/mysql/mandatory/sample_notices_message_transports.sql +++ b/installer/data/mysql/mandatory/sample_notices_message_transports.sql @@ -38,4 +38,7 @@ values (10, 'email', 0, 'circulation', 'HOLD_REMINDER'), (10, 'sms', 0, 'circulation', 'HOLD_REMINDER'), (10, 'phone', 0, 'circulation', 'HOLD_REMINDER'), -(10, 'itiva', 0, 'circulation', 'HOLD_REMINDER'); +(10, 'itiva', 0, 'circulation', 'HOLD_REMINDER'), +(11, 'email', 0, 'ill', 'ILL_REQUEST_UPDATE'), +(11, 'sms', 0, 'ill', 'ILL_REQUEST_UPDATE'), +(11, 'phone', 0, 'ill', 'ILL_REQUEST_UPDATE'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc index 279e78c84c..1fe1d67696 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -29,6 +29,7 @@ [% END %] [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable + [% ELSIF ( messaging_preference.Ill_update ) %]Interlibrary loan updated [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal [% ELSE %]Unknown [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt index 8f9a736e5e..dedab43085 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -623,6 +623,7 @@ [% ELSIF ( prefs.Item_Checkout ) %]Item checkout [% ELSIF ( prefs.Ill_ready ) %]Interlibrary loan ready [% ELSIF ( prefs.Ill_unavailable ) %]Interlibrary loan unavailable + [% ELSIF ( prefs.Ill_update ) %]Interlibrary loan updated [% ELSIF ( prefs.Auto_Renewals ) %]Auto renewal [% ELSIF ( prefs.Hold_Reminder ) %]Hold reminder [% ELSE %]Unknown diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index e8eaaac6b8..44e6ca4dfc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -75,6 +75,7 @@ [% END %] [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable + [% ELSIF ( messaging_preference.Ill_update ) %]Interlibrary loan updated [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal [% ELSE %]Unknown [% END %] [% IF ( messaging_preference.takes_days ) %] -- 2.30.2