Bugzilla – Attachment 141118 Details for
Bug 30646
Add option to send WELCOME notice for new patrons added at first login via LDAP/SAML
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30646: Add welcome email support to SAML2
Bug-30646-Add-welcome-email-support-to-SAML2.patch (text/plain), 2.97 KB, created by
Martin Renvoize (ashimema)
on 2022-09-30 10:46:48 UTC
(
hide
)
Description:
Bug 30646: Add welcome email support to SAML2
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-09-30 10:46:48 UTC
Size:
2.97 KB
patch
obsolete
>From 0ecc09e493ec9983167944b41206a14af9821f61 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 28 Apr 2022 16:12:47 +0100 >Subject: [PATCH] Bug 30646: Add welcome email support to SAML2 > >This patch adds the ability to enable the welcome email notice for new >users added via the Shibboleth autocreate option. > >Test plan >1) Configure Shibboleth for authentication >2) Enable the welcome email by adding '<welcome>1</welcome>' to your > shibboleth config block >3) Confirm you have autocreate enabled for your Shibboleth config >4) Attempt to login with an entirely new user to Koha using the shibboleth > connection (with a user who has a valid email address mapped to Koha > borrower fields) >5) Confirm the email is sent by looking at the notices for the new user. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Auth_with_shibboleth.pm | 39 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 37 insertions(+), 2 deletions(-) > >diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm >index 5a46737c59..8801530857 100644 >--- a/C4/Auth_with_shibboleth.pm >+++ b/C4/Auth_with_shibboleth.pm >@@ -23,6 +23,7 @@ use C4::Context; > use Koha::AuthUtils qw( get_script_name ); > use Koha::Database; > use Koha::Patrons; >+use C4::Letters qw( GetPreparedLetter EnqueueLetter ); > use C4::Members::Messaging; > use Carp qw( carp ); > use List::MoreUtils qw( any ); >@@ -134,8 +135,42 @@ sub _autocreate { > } > > my $patron = Koha::Patron->new( \%borrower )->store; >- C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $patron->borrowernumber, categorycode => $patron->categorycode } ); >- >+ C4::Members::Messaging::SetMessagingPreferencesFromDefaults( >+ { >+ borrowernumber => $patron->borrowernumber, >+ categorycode => $patron->categorycode >+ } >+ ); >+ >+ # Send welcome email if enabled >+ if ( $config->{welcome} ) { >+ my $emailaddr = $patron->notice_email_address; >+ >+ # if we manage to find a valid email address, send notice >+ if ($emailaddr) { >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'members', >+ letter_code => 'WELCOME', >+ branchcode => $patron->branchcode, >+ , >+ lang => $patron->lang || 'default', >+ tables => { >+ 'branches' => $patron->branchcode, >+ 'borrowers' => $patron->borrowernumber, >+ }, >+ want_librarian => 1, >+ ) or return; >+ >+ my $message_id = C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->id, >+ to_address => $emailaddr, >+ message_transport_type => 'email' >+ } >+ ); >+ } >+ } > return ( 1, $patron->cardnumber, $patron->userid ); > } > >-- >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 30646
:
134272
|
134279
|
136171
|
136172
|
136173
|
138708
|
138709
|
138710
|
141117
| 141118 |
141119
|
141120
|
141121