Bugzilla – Attachment 72533 Details for
Bug 18570
Password recovery e-mail only sent after message queue is processed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18570: Send Password Reset Emails immediately
Bug-18570-Send-Password-Reset-Emails-immediately.patch (text/plain), 2.77 KB, created by
Josef Moravec
on 2018-03-08 11:38:01 UTC
(
hide
)
Description:
Bug 18570: Send Password Reset Emails immediately
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-03-08 11:38:01 UTC
Size:
2.77 KB
patch
obsolete
>From 37596f5aea02910dc5895b982c0d45643a279c22 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Thu, 8 Mar 2018 00:15:33 +0000 >Subject: [PATCH] Bug 18570: Send Password Reset Emails immediately > >Run through the password reset process, and your server >should send the message immediate, not waiting for the >cronjob. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Letters.pm | 15 ++++++++++++--- > Koha/Patron/Password/Recovery.pm | 7 +++++-- > 2 files changed, 17 insertions(+), 5 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 219779b..841362a 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1038,7 +1038,12 @@ Returns number of messages sent. > sub SendQueuedMessages { > my $params = shift; > >- my $unsent_messages = _get_unsent_messages( { limit => $params->{limit} } ); >+ my $which_unsent_messages = { >+ 'limit' => $params->{'limit'} // 0, >+ 'borrowernumber' => $params->{'borrowernumber'} // q{}, >+ 'letter_code' => $params->{'letter_code'} // q{}, >+ }; >+ my $unsent_messages = _get_unsent_messages( $which_unsent_messages ); > MESSAGE: foreach my $message ( @$unsent_messages ) { > # warn Data::Dumper->Dump( [ $message ], [ 'message' ] ); > warn sprintf( 'sending %s message to patron: %s', >@@ -1282,13 +1287,17 @@ sub _get_unsent_messages { > my @query_params = ('pending'); > if ( ref $params ) { > if ( $params->{'message_transport_type'} ) { >- $statement .= ' AND message_transport_type = ? '; >+ $statement .= ' AND mq.message_transport_type = ? '; > push @query_params, $params->{'message_transport_type'}; > } > if ( $params->{'borrowernumber'} ) { >- $statement .= ' AND borrowernumber = ? '; >+ $statement .= ' AND mq.borrowernumber = ? '; > push @query_params, $params->{'borrowernumber'}; > } >+ if ( $params->{'letter_code'} ) { >+ $statement .= ' AND mq.letter_code = ? '; >+ push @query_params, $params->{'letter_code'}; >+ } > if ( $params->{'limit'} ) { > $statement .= ' limit ? '; > push @query_params, $params->{'limit'}; >diff --git a/Koha/Patron/Password/Recovery.pm b/Koha/Patron/Password/Recovery.pm >index 5a352fb..0d09923 100644 >--- a/Koha/Patron/Password/Recovery.pm >+++ b/Koha/Patron/Password/Recovery.pm >@@ -161,8 +161,11 @@ sub SendPasswordRecoveryEmail { > message_transport_type => 'email', > } > ); >- >- return 1; >+ my $num_letters_attempted = C4::Letters::SendQueuedMessages( { >+ borrowernumber => $borrower->borrowernumber, >+ letter_code => 'PASSWORD_RESET' >+ } ); >+ return ($num_letters_attempted > 0); > } > > =head2 CompletePasswordRecovery >-- >2.1.4
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 18570
:
72499
|
72524
|
72525
|
72526
|
72531
|
72532
|
72533
|
72597
|
72599
|
72600
|
72601
|
72602
|
73221