Bugzilla – Attachment 140243 Details for
Bug 30295
Send a notification when a recall is manually cancelled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30295: Send a notification when a recall is manually cancelled
Bug-30295-Send-a-notification-when-a-recall-is-man.patch (text/plain), 13.29 KB, created by
Aleisha Amohia
on 2022-09-07 04:54:52 UTC
(
hide
)
Description:
Bug 30295: Send a notification when a recall is manually cancelled
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2022-09-07 04:54:52 UTC
Size:
13.29 KB
patch
obsolete
>From fa7f378cde5df4adb4937db2bf9d95cebf69853b Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 15 Mar 2022 06:57:54 +1300 >Subject: [PATCH] Bug 30295: Send a notification when a recall is manually > cancelled > >This patch adds a RECALL_MANUAL_CANCEL email and sms notice which will >be sent to the requestor when their recall is cancelled. This notice >can also be configured using the messaging preferences. > >To test: > >1. Apply the patch, update database, restart services. >2. Ensure UseRecalls system preference is enabled and values have been >set in the circulation rules for recalls >3. Log in as a patron (Patron A) to the staff client and view your account details >4. Notice there is now a 'recall cancelled' notice that can be >configured under messaging preferences >5. Confirm this notice also shows in the messaging preferences page on >the OPAC >6. Select email and sms as a preference for the 'recall cancelled' notice and >save. You may need to enable other settings to see the sms options >(SMSSendDriver for example) >7. Check out an item to another patron (Patron B) >8. Log into the OPAC as Patron A and place a recall on the checked out >item/biblio >9. Go back to the staff client and view the biblio. Go to the recalls >tab and cancel the recall. >10. Go to Patron A's accout and view their notices tab >11. Confirm the 'recall cancelled' notice has been generated for both >email and sms. > >Sponsored-by: Toi Ohomai Institute of Technology >--- > Koha/Recall.pm | 27 ++++++++++++++++- > ...-add_RECALL_MANUAL_CANCEL_message_attributes.pl | 12 ++++++++ > ...-add_RECALL_MANUAL_CANCEL_message_transports.pl | 12 ++++++++ > .../bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl | 24 +++++++++++++++ > .../data/mysql/en/mandatory/sample_notices.yml | 34 ++++++++++++++++++++++ > .../sample_notices_message_attributes.sql | 3 +- > .../sample_notices_message_transports.sql | 4 ++- > .../prog/en/includes/messaging-preference-form.inc | 5 ++-- > .../bootstrap/en/modules/opac-messaging.tt | 5 ++-- > 9 files changed, 119 insertions(+), 7 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl > create mode 100644 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl > create mode 100644 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl > >diff --git a/Koha/Recall.pm b/Koha/Recall.pm >index bd2912e670..536809623e 100644 >--- a/Koha/Recall.pm >+++ b/Koha/Recall.pm >@@ -18,7 +18,8 @@ package Koha::Recall; > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >- >+use C4::Letters; >+use C4::Members::Messaging; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Biblios; >@@ -451,6 +452,30 @@ sub set_cancelled { > my ( $self ) = @_; > $self->update({ status => 'cancelled', completed => 1, completed_date => dt_from_string }); > C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') ); >+ >+ # send notice to recaller to pick up item >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'circulation', >+ letter_code => 'RECALL_MANUAL_CANCEL', >+ branchcode => $self->branchcode, >+ lang => $self->patron->lang, >+ tables => { >+ biblio => $self->biblionumber, >+ borrowers => $self->borrowernumber, >+ branches => $self->branchcode, >+ }, >+ ); >+ >+ my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->borrowernumber, message_name => 'Recall_Cancelled' }); >+ while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) { >+ if ( $transport eq 'email' ){ >+ C4::Message->enqueue($letter, $self->patron->unblessed, 'email'); >+ } >+ if ( $transport eq 'sms' ){ >+ C4::Message->enqueue($letter, $self->patron->unblessed, 'sms'); >+ } >+ } >+ > return $self; > } > >diff --git a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl >new file mode 100644 >index 0000000000..d0c2c6cd45 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl >@@ -0,0 +1,12 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30295", >+ description => "Adding message attributes for RECALL_MANUAL_CANCEL", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (13, 'Recall_Cancelled', 0) }); >+ }, >+}; >diff --git a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl >new file mode 100644 >index 0000000000..1c515c7269 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl >@@ -0,0 +1,12 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30295", >+ description => "Adding message transports for RECALL_MANUAL_CANCEL notice", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code, branchcode) VALUES (13, "email", 0, "circulation", "RECALL_MANUAL_CANCEL", null), (13, "sms", 0, "circulation", "RECALL_MANUAL_CANCEL", null) }); >+ }, >+}; >diff --git a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl >new file mode 100644 >index 0000000000..46e0882883 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl >@@ -0,0 +1,24 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "30295", >+ description => "Add RECALL_MANUAL_CANCEL email and sms notice", >+ 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`) VALUES ('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %], >+ >+We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled. >+ >+Title: [% biblio.title %] >+Author: [% biblio.author %] >+Location: [% branch.branchname %]','sms'), ('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %], >+ >+We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled. >+ >+Title: [% biblio.title %] >+Author: [% biblio.author %] >+Location: [% branch.branchname %]','email') }); >+ }, >+}; >diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml >index 6d0c50ac13..ccd88b7ac6 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.yml >+++ b/installer/data/mysql/en/mandatory/sample_notices.yml >@@ -1780,3 +1780,37 @@ tables: > - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>" > - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>" > - "<p>Your library</p>" >+ >+ - module: circulation >+ code: RECALL_MANUAL_CANCEL >+ branchcode: "" >+ name: "Recall has been cancelled" >+ is_html: 0 >+ title: "Recall has been cancelled" >+ message_transport_type: email >+ lang: default >+ content: >+ - "Dear [% borrower.firstname %] [% borrower.surname %]," >+ - "" >+ - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled." >+ - "" >+ - "Title: [% biblio.title %]" >+ - "Author: [% biblio.author %]" >+ - "Location: [% branch.branchname %]" >+ >+ - module: circulation >+ code: RECALL_MANUAL_CANCEL >+ branchcode: "" >+ name: "Recall has been cancelled" >+ is_html: 0 >+ title: "Recall has been cancelled" >+ message_transport_type: sms >+ lang: default >+ content: >+ - "Dear [% borrower.firstname %] [% borrower.surname %]," >+ - "" >+ - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled." >+ - "" >+ - "Title: [% biblio.title %]" >+ - "Author: [% biblio.author %]" >+ - "Location: [% branch.branchname %]" >diff --git a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/mandatory/sample_notices_message_attributes.sql >index 4c84f556b1..ade719c321 100644 >--- a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql >+++ b/installer/data/mysql/mandatory/sample_notices_message_attributes.sql >@@ -11,4 +11,5 @@ values > (9, 'Auto_Renewals', 0), > (10, 'Hold_Reminder', 0), > (11, 'Recall_Waiting', 0), >-(12, 'Recall_Requested', 0); >+(12, 'Recall_Requested', 0), >+(13, 'Recall_Cancelled', 0); >diff --git a/installer/data/mysql/mandatory/sample_notices_message_transports.sql b/installer/data/mysql/mandatory/sample_notices_message_transports.sql >index 29e4c06eed..89daf976fd 100644 >--- a/installer/data/mysql/mandatory/sample_notices_message_transports.sql >+++ b/installer/data/mysql/mandatory/sample_notices_message_transports.sql >@@ -42,4 +42,6 @@ values > (11, "email", 0, "circulation", "PICKUP_RECALLED_ITEM"), > (11, "sms", 0, "circulation", "PICKUP_RECALLED_ITEM"), > (12, "email", 0, "circulation", "RETURN_RECALLED_ITEM"), >-(12, "sms", 0, "circulation", "RETURN_RECALLED_ITEM"); >+(12, "sms", 0, "circulation", "RETURN_RECALLED_ITEM"), >+(13, "email", 0, "circulation", "RECALL_MANUAL_CANCEL"), >+(13, "sms", 0, "circulation", "RECALL_MANUAL_CANCEL"); >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 1d6b9066ec..91f33f6b68 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 >@@ -30,8 +30,9 @@ > [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span> > [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span> > [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span> >- [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span> >- [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span> > [% ELSE %]<span>Unknown</span> > [% END %] > </td> >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 b97045973b..3ea18dc681 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -76,8 +76,9 @@ > [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span> > [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span> > [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span> >- [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span> >- [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span> >+ [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span> > [% ELSE %]<span>Unknown</span> [% END %]</td> > [% IF ( messaging_preference.takes_days ) %] > <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS"> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30295
:
131763
|
140243
|
140245
|
147108
|
148114
|
149127
|
150431
|
155347
|
155358
|
158699
|
158700
|
158701
|
159007
|
159008
|
159009
|
172038
|
172039
|
172041