Bugzilla – Attachment 137998 Details for
Bug 23538
Email library when new patrons self register
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23538: Email library when new patron self-registers
Bug-23538-Email-library-when-new-patron-self-regis.patch (text/plain), 9.37 KB, created by
Alex Buckley
on 2022-07-22 02:00:13 UTC
(
hide
)
Description:
Bug 23538: Email library when new patron self-registers
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2022-07-22 02:00:13 UTC
Size:
9.37 KB
patch
obsolete
>From 4332c4227fce5b12c11d1beb8b88bf25e4488fb4 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 6 Apr 2022 09:33:12 +1200 >Subject: [PATCH] Bug 23538: Email library when new patron self-registers > >Test plan: >1. Apply all patches >2. Update database >3. Restart services >4. Set email addresses in: >- KohaAdminEmailAddress syspref >- EmailAddressForPatronRegistrations syspref >- Email address in the library branch >5. Enable PatronSelfRegistration syspref >6. Test the following use cases: > >- EmailPatronRegistrations syspref = 'none'. >Submit OPAC registration. >= OUTCOME: Confirm no OPAC_REG notice in message_queue table > >--- > >- EmailPatronRegistrations syspref = 'email address of branch'. >Submit OPAC registration. >= OUTCOME: Confirm OPAC_REG notice in message_queue with to_address >equalling the branch address > >--- > >- EmailPatronRegistrations syspref = 'EmailAddressForPatronRegistrations'. >Submit OPAC registration. >= OUTCOME: Confirm OPAC_REG notice in message_queue with to_address >equalling EmailAddressForPatronRegistrations syspref > >--- > >- EmailPatronRegistrations syspref = 'KohaAdminEmailAddress'. >Submit OPAC registration. >= OUTCOME: Confirm OPAC_REG notice in message_queue with to_address >equalling KohaAdminEmailAddress syspref > >7. Enable PatronSelfRegistrationVerifyByEmail syspref >8. Repeat testing all use cases. Confirm this time the expected outcomes only happen AFTER you have clicked the verification link in the OPAC_REG_VERIFY notice > >Sponsored-by: Catalyst IT >--- > Koha/Patron.pm | 51 +++++++++++++++++++ > ...lAddressForPatronRegistrations_sysprefs.pl | 19 ++++--- > .../mysql/en/mandatory/sample_notices.yml | 19 ++++--- > opac/opac-memberentry.pl | 7 +++ > opac/opac-registration-verify.pl | 6 +++ > 5 files changed, 82 insertions(+), 20 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 0a165ae0d1..82bcc5c9d2 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -2093,6 +2093,57 @@ sub account_balance { > return $self->account->balance; > } > >+=head3 notify_library_of_registration >+ >+$patron->notify_library_of_registration( $email_patron_registrations ); >+ >+Send patron registration email to library if EmailPatronRegistrations system preference is enabled. >+ >+=cut >+ >+sub notify_library_of_registration { >+ my ( $self, $email_patron_registrations ) = @_; >+ >+ if ( >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'members', >+ letter_code => 'OPAC_REG', >+ branchcode => $self->branchcode, >+ lang => $self->lang || 'default', >+ tables => { >+ 'borrowers' => $self->borrowernumber >+ }, >+ ) >+ ) { >+ my $to_address; >+ if ( $email_patron_registrations eq "BranchEmailAddress" ) { >+ my $library = Koha::Libraries->find( $self->branchcode ); >+ $to_address = $library->inbound_email_address; >+ } >+ elsif ( $email_patron_registrations eq "KohaAdminEmailAddress" ) { >+ $to_address = C4::Context->preference('ReplytoDefault') >+ || C4::Context->preference('KohaAdminEmailAddress'); >+ } >+ else { >+ $to_address = >+ C4::Context->preference('EmailAddressForPatronRegistrations') >+ || C4::Context->preference('ReplytoDefault') >+ || C4::Context->preference('KohaAdminEmailAddress'); >+ } >+ >+ my $message_id = C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $self->borrowernumber, >+ to_address => $to_address, >+ message_transport_type => 'email' >+ } >+ ) or warn "can't enqueue letter $letter"; >+ if ( $message_id ) { >+ return 1; >+ } >+ } >+} > > =head3 has_messaging_preference > >diff --git a/installer/data/mysql/atomicupdate/bug23538-add_EmailPatronRegistrations_and_EmailAddressForPatronRegistrations_sysprefs.pl b/installer/data/mysql/atomicupdate/bug23538-add_EmailPatronRegistrations_and_EmailAddressForPatronRegistrations_sysprefs.pl >index 61ee73395e..55082df006 100755 >--- a/installer/data/mysql/atomicupdate/bug23538-add_EmailPatronRegistrations_and_EmailAddressForPatronRegistrations_sysprefs.pl >+++ b/installer/data/mysql/atomicupdate/bug23538-add_EmailPatronRegistrations_and_EmailAddressForPatronRegistrations_sysprefs.pl >@@ -13,16 +13,15 @@ return { > '<h3>New OPAC self-registration</h3> > <p><h4>Self-registration made by</h4> > <ul> >- <li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li> >- <li>Physical address: <<borrower_modifications.streetnumber>> <<borrower_modifications.streettype>> <<borrower_modifications.address>> <<borrower_modifications.address2>>, <<borrower_modifications.city>>, <<borrower_modifications.state>> <<borrower_modifications.zipcode>>, <<borrower_modifications.country>></li> >- <li>Email: <<borrower_modifications.email>></li> >- <li>Phone: <<borrower_modifications.phone>></li> >- <li>Mobile: <<borrower_modifications.mobile>></li> >- <li>Fax: <<borrower_modifications.fax>></li> >- <li>Secondary email: <<borrower_modifications.emailpro>></li> >- <li>Secondary phone:<<borrower_modifications.phonepro>></li> >- <li>Home library: <<borrower_modifications.branchcode>></li> >- <li>Temporary patron category: <<borrower_modifications.categorycode>></li> >+ <li><<borrowers.firstname>> <<borrowers.surname>></li> >+ <li>Email: <<borrowers.email>></li> >+ <li>Phone: <<borrowers.phone>></li> >+ <li>Mobile: <<borrowers.mobile>></li> >+ <li>Fax: <<borrowers.fax>></li> >+ <li>Secondary email: <<borrowers.emailpro>></li> >+ <li>Secondary phone:<<borrowers.phonepro>></li> >+ <li>Home library: <<borrowers.branchcode>></li> >+ <li>Patron category: <<borrowers.categorycode>></li> > </ul> > </p>', 'email', 'default') }); > }, >diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml >index fcd76b85f8..36a5d61342 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.yml >+++ b/installer/data/mysql/en/mandatory/sample_notices.yml >@@ -1711,15 +1711,14 @@ tables: > - "<h3>New OPAC self-registration</h3>" > - "<p><h4>Self-registration made by</h4>" > - "<ul>" >- - "<li><<borrower_modifications.firstname>> <<borrower_modifications.surname>></li>" >- - "<li>Physical address: <<borrower_modifications.streetnumber>> <<borrower_modifications.streettype>> <<borrower_modifications.address>> <<borrower_modifications.address2>>, <<borrower_modifications.city>>, <<borrower_modifications.state>> <<borrower_modifications.zipcode>>, <<borrower_modifications.country>></li>" >- - "<li>Email: <<borrower_modifications.email>></li>" >- - "<li>Phone: <<borrower_modifications.phone>></li>" >- - "<li>Mobile: <<borrower_modifications.mobile>></li>" >- - "<li>Fax: <<borrower_modifications.fax>></li>" >- - "<li>Secondary email: <<borrower_modifications.emailpro>></li>" >- - "<li>Secondary phone:<<borrower_modifications.phonepro>></li>" >- - "<li>Home library: <<borrower_modifications.branchcode>></li>" >- - "<li>Temporary patron category: <<borrower_modifications.categorycode>></li>" >+ - "<li><<borrowers.firstname>> <<borrowers.surname>></li>" >+ - "<li>Email: <<borrowers.email>></li>" >+ - "<li>Phone: <<borrowers.phone>></li>" >+ - "<li>Mobile: <<borrowers.mobile>></li>" >+ - "<li>Fax: <<borrowers.fax>></li>" >+ - "<li>Secondary email: <<borrowers.emailpro>></li>" >+ - "<li>Secondary phone:<<borrowers.phonepro>></li>" >+ - "<li>Home library: <<borrowers.branchcode>></li>" >+ - "<li>Temporary patron category: <<borrowers.categorycode>></li>" > - "</ul>" > - "</p>" >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index f456362c3a..7ae7f343fa 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -275,6 +275,13 @@ if ( $action eq 'create' ) { > }; > } > } >+ >+ # Notify library of new patron registration >+ my $notify_library = C4::Context->preference('EmailPatronRegistrations'); >+ if ($notify_library) { >+ $patron->notify_library_of_registration($notify_library); >+ } >+ > } else { > # FIXME Handle possible errors here > } >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 73ff55e6e5..673507ab3e 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -117,6 +117,12 @@ if ( > } > } > >+ # Notify library of new patron registration >+ my $notify_library = C4::Context->preference("EmailPatronRegistrations"); >+ if ($notify_library) { >+ $patron->notify_library_of_registration($notify_library); >+ } >+ > $template->param( > PatronSelfRegistrationAdditionalInstructions => > C4::Context->preference( >-- >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 23538
:
133050
|
133051
|
133052
|
133053
|
133097
|
133098
|
133099
|
133100
|
133101
|
133102
|
133103
|
137997
|
137998
|
137999
|
138000
|
138001
|
138237
|
138238
|
138239
|
138240
|
138383
|
138384
|
138385
|
138386
|
138387
|
141223