From c8cd690f8bfb1821061be0e92e1caed329268ea4 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 7 Sep 2023 23:10:09 +0000 Subject: [PATCH] Bug 30295: Use blessed patron to enqueue notice and QA fixes Signed-off-by: Stina Hallin Signed-off-by: David Nind --- Koha/Recall.pm | 23 ++++++++++--------- ...RECALL_MANUAL_CANCEL_message_attributes.pl | 10 ++++---- ...RECALL_MANUAL_CANCEL_message_transports.pl | 10 ++++---- ...g_30295-add_RECALL_MANUAL_CANCEL_notice.pl | 12 ++++++---- 4 files changed, 31 insertions(+), 24 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl diff --git a/Koha/Recall.pm b/Koha/Recall.pm index 0c2b0d0d87..6ded7f72ae 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -456,24 +456,25 @@ sub set_cancelled { # send notice to recaller to pick up item my $letter = C4::Letters::GetPreparedLetter( - module => 'circulation', + module => 'circulation', letter_code => 'RECALL_MANUAL_CANCEL', - branchcode => $self->pickup_library_id, - lang => $self->patron->lang, - tables => { - biblio => $self->biblio_id, + branchcode => $self->pickup_library_id, + lang => $self->patron->lang, + tables => { + biblio => $self->biblio_id, borrowers => $self->patron_id, - branches => $self->pickup_library_id, + branches => $self->pickup_library_id, }, ); - my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->patron_id, message_name => 'Recall_Cancelled' }); + my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences( + { borrowernumber => $self->patron_id, 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 'email' ) { + C4::Message->enqueue( $letter, $self->patron, 'email' ); } - if ( $transport eq 'sms' ){ - C4::Message->enqueue($letter, $self->patron->unblessed, 'sms'); + if ( $transport eq 'sms' ) { + C4::Message->enqueue( $letter, $self->patron, 'sms' ); } } 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 old mode 100644 new mode 100755 index 59fc9175b5..2bf5ae2031 --- 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 @@ -1,12 +1,14 @@ use Modern::Perl; return { - bug_number => "30295", + bug_number => "30295", description => "Adding message attributes for RECALL_MANUAL_CANCEL", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; - $dbh->do(q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (14, 'Recall_Cancelled', 0) }); + $dbh->do( + q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (14, '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 old mode 100644 new mode 100755 index e80b199735..267d5e1622 --- 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 @@ -1,12 +1,14 @@ use Modern::Perl; return { - bug_number => "30295", + bug_number => "30295", description => "Adding message transports for RECALL_MANUAL_CANCEL notice", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + 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 (14, "email", 0, "circulation", "RECALL_MANUAL_CANCEL", null), (14, "sms", 0, "circulation", "RECALL_MANUAL_CANCEL", null) }); + $dbh->do( + q{ INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code, branchcode) VALUES (14, "email", 0, "circulation", "RECALL_MANUAL_CANCEL", null), (14, "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 old mode 100644 new mode 100755 index 46e0882883..d9fb2f9d64 --- 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 @@ -1,13 +1,14 @@ use Modern::Perl; return { - bug_number => "30295", + bug_number => "30295", description => "Add RECALL_MANUAL_CANCEL email and sms notice", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + 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 %], + $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. @@ -19,6 +20,7 @@ We regret to inform you that the item you have recalled cannot be provided. Your Title: [% biblio.title %] Author: [% biblio.author %] -Location: [% branch.branchname %]','email') }); +Location: [% branch.branchname %]','email') } + ); }, }; -- 2.30.2