Bugzilla – Attachment 106964 Details for
Bug 15986
Add a script for sending hold waiting reminder notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15986: Rename send_notice to queue_notice and update test count
Bug-15986-Rename-sendnotice-to-queuenotice-and-upd.patch (text/plain), 7.17 KB, created by
Nick Clemens (kidclamp)
on 2020-07-16 16:54:17 UTC
(
hide
)
Description:
Bug 15986: Rename send_notice to queue_notice and update test count
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-07-16 16:54:17 UTC
Size:
7.17 KB
patch
obsolete
>From 645ebe97b8e3e9cf225739e4c77bb7f6b3944db8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 16 Jul 2020 16:46:22 +0000 >Subject: [PATCH] Bug 15986: Rename send_notice to queue_notice and update test > count > >--- > Koha/Patron.pm | 10 +++++----- > misc/cronjobs/holds_reminder.pl | 4 ++-- > t/db_dependent/Koha/Patrons.t | 22 +++++++++++----------- > 3 files changed, 18 insertions(+), 18 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index d966ac4adf..9208ef7d01 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1713,11 +1713,11 @@ sub to_api_mapping { > }; > } > >-=head3 send_notice >+=head3 queue_notice > >- Koha::Patrons->send_notice({ letter_params => $letter_params, message_name => 'DUE'}); >- Koha::Patrons->send_notice({ letter_params => $letter_params, message_transports => \@message_transports }); >- Koha::Patrons->send_notice({ letter_params => $letter_params, message_transports => \@message_transports, test_mode => 1 }); >+ Koha::Patrons->queue_notice({ letter_params => $letter_params, message_name => 'DUE'}); >+ Koha::Patrons->queue_notice({ letter_params => $letter_params, message_transports => \@message_transports }); >+ Koha::Patrons->queue_notice({ letter_params => $letter_params, message_transports => \@message_transports, test_mode => 1 }); > > Queue messages to a patron. Can pass a message that is part of the message_attributes > table or supply the transport to use. >@@ -1732,7 +1732,7 @@ sub to_api_mapping { > > =cut > >-sub send_notice { >+sub queue_notice { > my ( $self, $params ) = @_; > my $letter_params = $params->{letter_params}; > my $test_mode = $params->{test_mode}; >diff --git a/misc/cronjobs/holds_reminder.pl b/misc/cronjobs/holds_reminder.pl >index d892ccfa49..0a88fa7d5e 100755 >--- a/misc/cronjobs/holds_reminder.pl >+++ b/misc/cronjobs/holds_reminder.pl >@@ -282,8 +282,8 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > $sending_params->{letter_params} = $letter_params; > $sending_params->{test_mode} = $nomail; > my $result_text = $nomail ? "would have been sent" : "was sent"; >- # send_notice queues the notices, falling back to print for email or SMS, and ignores phone (they are handled by Itiva) >- my $result = $patron->send_notice( $sending_params ); >+ # queue_notice queues the notices, falling back to print for email or SMS, and ignores phone (they are handled by Itiva) >+ my $result = $patron->queue_notice( $sending_params ); > $verbose and print " borrower " . $patron->surname . ", " . $patron->firstname . " $result_text notices via: @{$result->{sent}}\n" if defined $result->{sent}; > $verbose and print " borrower " . $patron->surname . ", " . $patron->firstname . " $result_text print fallback for: @{$result->{fallback}}\n" if defined $result->{fallback}; > # Mark this borrower as completed >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 44fa9a3a6e..525e867913 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 41; >+use Test::More tests => 42; > use Test::Warn; > use Test::Exception; > use Test::MockModule; >@@ -2032,7 +2032,7 @@ subtest 'anonymize' => sub { > is( $patron2->firstname, undef, 'First name patron2 cleared' ); > }; > >-subtest 'send_notice' => sub { >+subtest 'queue_notice' => sub { > plan tests => 11; > > my $dbh = C4::Context->dbh; >@@ -2079,26 +2079,26 @@ subtest 'send_notice' => sub { > }; > my @mtts = ('email'); > >- is( $patron->send_notice(), undef, "Nothing is done if no params passed"); >- is( $patron->send_notice({ letter_params => $letter_params }),undef, "Nothing done if only letter"); >+ is( $patron->queue_notice(), undef, "Nothing is done if no params passed"); >+ is( $patron->queue_notice({ letter_params => $letter_params }),undef, "Nothing done if only letter"); > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_transports => \@mtts }), >+ $patron->queue_notice({ letter_params => $letter_params, message_transports => \@mtts }), > {sent => ['email'] }, "Email sent" > ); > $patron->email("")->store; > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_transports => \@mtts }), >+ $patron->queue_notice({ letter_params => $letter_params, message_transports => \@mtts }), > {sent => ['print'],fallback => ['email']}, "Email fallsback to print if no email" > ); > push @mtts, 'sms'; > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_transports => \@mtts }), >+ $patron->queue_notice({ letter_params => $letter_params, message_transports => \@mtts }), > {sent => ['print','sms'],fallback => ['email']}, "Email fallsback to print if no email, sms sent" > ); > $patron->smsalertnumber("")->store; > my $counter = Koha::Notice::Messages->search({borrowernumber => $patron->borrowernumber })->count; > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_transports => \@mtts }), >+ $patron->queue_notice({ letter_params => $letter_params, message_transports => \@mtts }), > {sent => ['print'],fallback => ['email','sms']}, "Email fallsback to print if no emai, sms fallsback to print if no sms, only one print sent" > ); > is( Koha::Notice::Messages->search({borrowernumber => $patron->borrowernumber })->count, $counter+1,"Count of queued notices went up by one"); >@@ -2108,16 +2108,16 @@ subtest 'send_notice' => sub { > my $borrower_message_preference_id = $dbh->last_insert_id(undef, undef, "borrower_message_preferences", undef); > $dbh->do(q|INSERT INTO borrower_message_transport_preferences( borrower_message_preference_id, message_transport_type) VALUES ( ?, ? )|, undef, $borrower_message_preference_id, 'email' ); > >- is( $patron->send_notice({ letter_params => $letter_params, message_transports => \@mtts, message_name => 'Hold_Filled' }),undef, "Nothing done if transports and name sent"); >+ is( $patron->queue_notice({ letter_params => $letter_params, message_transports => \@mtts, message_name => 'Hold_Filled' }),undef, "Nothing done if transports and name sent"); > > $patron->email(q|awesome@ismymiddle.name|)->store; > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_name => 'Hold_Filled' }), >+ $patron->queue_notice({ letter_params => $letter_params, message_name => 'Hold_Filled' }), > {sent => ['email'] }, "Email sent when using borrower preferences" > ); > $counter = Koha::Notice::Messages->search({borrowernumber => $patron->borrowernumber })->count; > is_deeply( >- $patron->send_notice({ letter_params => $letter_params, message_name => 'Hold_Filled', test_mode => 1 }), >+ $patron->queue_notice({ letter_params => $letter_params, message_name => 'Hold_Filled', test_mode => 1 }), > {sent => ['email'] }, "Report that email sent when using borrower preferences in test_mode" > ); > is( Koha::Notice::Messages->search({borrowernumber => $patron->borrowernumber })->count, $counter,"Count of queued notices not increased in test mode"); >-- >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 15986
:
53323
|
53354
|
53594
|
55723
|
91767
|
91768
|
99919
|
102723
|
102926
|
106962
|
106963
|
106964
|
112999
|
113000
|
113001
|
118733
|
118734
|
118735
|
118736
|
118737
|
119277
|
119308
|
119327
|
119328
|
119329
|
119383
|
119384
|
119386
|
119624
|
119725
|
119748
|
120224