Bugzilla – Attachment 126040 Details for
Bug 29005
Add option to send WELCOME notice for new patrons added via patron imports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29005: Enable welcome email from patron imports
Bug-29005-Enable-welcome-email-from-patron-imports.patch (text/plain), 2.86 KB, created by
Martin Renvoize (ashimema)
on 2021-10-11 12:27:52 UTC
(
hide
)
Description:
Bug 29005: Enable welcome email from patron imports
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-11 12:27:52 UTC
Size:
2.86 KB
patch
obsolete
>From a42b045787130d23b4b85b702f658f6b111bf952 Mon Sep 17 00:00:00 2001 >From: Kris Sinnaeve <kris.sinnaeve@etf.edu> >Date: Fri, 1 Oct 2021 10:40:50 +0100 >Subject: [PATCH] Bug 29005: Enable welcome email from patron imports > >This patch was updated from work done by Evangelische Theologische >Faculteit to allow the patron import to send welcome emails to users >when enabled. > >Test plan >1. Enable 'AutoEmailOpacUser' system preference >2. Add a new user via the csv patron imports (Include a password and an > email address for which you have access) >3. Check that you received a welcome email for the user. >4. Overwrite the previous user with a new password using CSV imports >5. Check that you received a welcome email again for the user. > >Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Patrons/Import.pm | 25 +++++++++++++++++++++++-- > 1 file changed, 23 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index fe3fd80c11..7b84397053 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -24,6 +24,7 @@ use Encode qw( decode_utf8 ); > use Try::Tiny qw( catch try ); > > use C4::Members qw( checkcardnumber ); >+use C4::Letters qw( SendAlerts ); > > use Koha::Libraries; > use Koha::Patrons; >@@ -277,7 +278,6 @@ sub import_patrons { > } > } > >- my $patron = Koha::Patrons->find( $borrowernumber ); > try { > $schema->storage->txn_do(sub { > $patron->set(\%borrower)->store; >@@ -373,7 +373,7 @@ sub import_patrons { > else { > try { > $schema->storage->txn_do(sub { >- my $patron = Koha::Patron->new(\%borrower)->store; >+ $patron = Koha::Patron->new(\%borrower)->store; > $borrowernumber = $patron->id; > > if ( $patron->is_debarred ) { >@@ -437,6 +437,27 @@ sub import_patrons { > }; > } > >+ if ($success) { >+ >+ # If 'AutoEmailOpacUser' syspref is on, email user their account details from the 'notice' >+ # that matches the user's branchcode. >+ if ( C4::Context->preference("AutoEmailOpacUser") == 1 >+ && $patron->plain_text_password ) >+ { >+ my $emailaddr = $patron->notice_email_address; >+ >+ # if we manage to find a valid email address, send notice >+ if ($emailaddr) { >+ $borrower{emailaddr} = $emailaddr; >+ my $err; >+ eval { >+ $err = >+ SendAlerts( 'members', \%borrower, "ACCTDETAILS" ); >+ }; >+ } >+ } >+ } >+ > next LINE unless $success; > > # Add a guarantor if we are given a relationship >-- >2.20.1
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 29005
:
125598
|
126039
|
126040
|
131246
|
131247
|
131248
|
131249
|
131250
|
131251
|
131252
|
131253
|
131254
|
132782
|
132783
|
132784
|
132909
|
132910