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 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
3276e0fa0c
commit
2accac5fd9
2 changed files with 6 additions and 10 deletions
|
@ -29,6 +29,7 @@ use C4::Output qw( output_html_with_http_headers );
|
||||||
use C4::Context;
|
use C4::Context;
|
||||||
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
|
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
|
||||||
use C4::Form::MessagingPreferences;
|
use C4::Form::MessagingPreferences;
|
||||||
|
use C4::Members::Messaging qw( SetMessagingPreferencesFromDefaults );
|
||||||
use Koha::AuthUtils;
|
use Koha::AuthUtils;
|
||||||
use Koha::Patrons;
|
use Koha::Patrons;
|
||||||
use Koha::Patron::Consent;
|
use Koha::Patron::Consent;
|
||||||
|
@ -230,6 +231,8 @@ if ( $op eq 'cud-create' ) {
|
||||||
try {
|
try {
|
||||||
$patron = Koha::Patron->new( \%borrower )->store;
|
$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;
|
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 {
|
} catch {
|
||||||
my $type = ref($_);
|
my $type = ref($_);
|
||||||
my $info = "$_";
|
my $info = "$_";
|
||||||
|
@ -249,15 +252,6 @@ if ( $op eq 'cud-create' ) {
|
||||||
if ( $patron ) {
|
if ( $patron ) {
|
||||||
$patron->extended_attributes->filter_by_branch_limitations->delete;
|
$patron->extended_attributes->filter_by_branch_limitations->delete;
|
||||||
$patron->extended_attributes($attributes);
|
$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( password_cleartext => $patron->plain_text_password );
|
||||||
$template->param( borrower => $patron->unblessed );
|
$template->param( borrower => $patron->unblessed );
|
||||||
|
|
|
@ -25,6 +25,7 @@ use C4::Context;
|
||||||
use C4::Output qw( output_html_with_http_headers );
|
use C4::Output qw( output_html_with_http_headers );
|
||||||
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
|
use C4::Letters qw( GetPreparedLetter EnqueueLetter SendQueuedMessages );
|
||||||
use C4::Members;
|
use C4::Members;
|
||||||
|
use C4::Members::Messaging qw( SetMessagingPreferencesFromDefaults );
|
||||||
use C4::Form::MessagingPreferences;
|
use C4::Form::MessagingPreferences;
|
||||||
use Koha::AuthUtils;
|
use Koha::AuthUtils;
|
||||||
use Koha::Patrons;
|
use Koha::Patrons;
|
||||||
|
@ -90,6 +91,8 @@ elsif ( $rego_found
|
||||||
try {
|
try {
|
||||||
$patron = Koha::Patron->new( $patron_attrs )->store;
|
$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;
|
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 {
|
} catch {
|
||||||
$error_type = ref($_);
|
$error_type = ref($_);
|
||||||
$error_info = "$_";
|
$error_info = "$_";
|
||||||
|
@ -112,7 +115,6 @@ elsif ( $rego_found
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$template->param( "confirmed" => 1 );
|
$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( password_cleartext => $patron->plain_text_password );
|
||||||
$template->param( borrower => $patron );
|
$template->param( borrower => $patron );
|
||||||
|
|
Loading…
Reference in a new issue