Bugzilla – Attachment 168920 Details for
Bug 37339
Default messaging preferences are not applied when self registering in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37339: Set messaging preferences from default on self registration
Bug-37339-Set-messaging-preferences-from-default-o.patch (text/plain), 4.66 KB, created by
Nick Clemens (kidclamp)
on 2024-07-12 15:29:15 UTC
(
hide
)
Description:
Bug 37339: Set messaging preferences from default on self registration
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-07-12 15:29:15 UTC
Size:
4.66 KB
patch
obsolete
>From dad85302d04a6e685442f8088e7caf0f712f7e86 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 12 Jul 2024 14:00:49 +0000 >Subject: [PATCH] Bug 37339: Set messaging preferences from default on self > registration > >The change on bug 30318 prevented setting the default messaging preferences when none were passed. >Self registration relied on this for setting borrower preferences from the defaults. > >This patch removes the call to handle_form_action and replaces it with a call to: >SetMessagingPreferencesFromDefault > >To test: > 1 - Ensure self registration is enabled > 2 - Set default messaging preferences for the self registration category > 3 - Self register a patron from the OPAC, confirm defaults not set > 4 - Apply patch, restart all > 5 - Self register a patron > 6 - Confirm defaults have been set > 7 - Enable PatronSelfRegistrationVerifyByEmail > 8 - Self register a patron on OPAC with an email > 9 - Find the email and grab the verification link (unless you have emails enabled) > SELECT * FROM message_queue; >10 - Visit the link and confirm registration >11 - Confirm messaging defaults are set >--- > opac/opac-memberentry.pl | 12 +++--------- > opac/opac-registration-verify.pl | 4 +++- > 2 files changed, 6 insertions(+), 10 deletions(-) > >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index c40d09d5129..b671dde7c04 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -29,6 +29,7 @@ use C4::Output qw( output_html_with_http_headers ); > use C4::Context; > use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); > use C4::Form::MessagingPreferences; >+use C4::Members::Messaging qw( SetMessagingPreferencesFromDefaults ); > use Koha::AuthUtils; > use Koha::Patrons; > use Koha::Patron::Consent; >@@ -230,6 +231,8 @@ if ( $op eq 'cud-create' ) { > try { > $patron = Koha::Patron->new( \%borrower )->store; > Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $patron && $consent_dt; >+ C4::Members::Messaging::SetMessagingPreferencesFromDefaults( >+ { borrowernumber => $patron->borrowernumber, categorycode => $patron->categorycode } ); > } catch { > my $type = ref($_); > my $info = "$_"; >@@ -249,15 +252,6 @@ if ( $op eq 'cud-create' ) { > if ( $patron ) { > $patron->extended_attributes->filter_by_branch_limitations->delete; > $patron->extended_attributes($attributes); >- if ( C4::Context->preference('EnhancedMessagingPreferences') ) { >- C4::Form::MessagingPreferences::handle_form_action( >- $cgi, >- { borrowernumber => $patron->borrowernumber }, >- $template, >- 1, >- $PatronSelfRegistrationDefaultCategory >- ); >- } > > $template->param( password_cleartext => $patron->plain_text_password ); > $template->param( borrower => $patron->unblessed ); >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 129d51cbb9e..d3ae183384c 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -25,6 +25,7 @@ use C4::Context; > use C4::Output qw( output_html_with_http_headers ); > use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages ); > use C4::Members; >+use C4::Members::Messaging qw( SetMessagingPreferencesFromDefaults ); > use C4::Form::MessagingPreferences; > use Koha::AuthUtils; > use Koha::Patrons; >@@ -90,6 +91,8 @@ elsif ( $rego_found > try { > $patron = Koha::Patron->new( $patron_attrs )->store; > Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $patron && $consent_dt; >+ C4::Members::Messaging::SetMessagingPreferencesFromDefaults( >+ { borrowernumber => $patron->borrowernumber, categorycode => $patron->categorycode } ); > } catch { > $error_type = ref($_); > $error_info = "$_"; >@@ -112,7 +115,6 @@ elsif ( $rego_found > } > ); > $template->param( "confirmed" => 1 ); >- C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences'); > > $template->param( password_cleartext => $patron->plain_text_password ); > $template->param( borrower => $patron ); >-- >2.39.2
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 37339
:
168920
|
168924
|
169098