Bugzilla – Attachment 148205 Details for
Bug 32426
Make userid generation pluggable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32426: Changes for opac-memberentry
Bug-32426-Changes-for-opac-memberentry.patch (text/plain), 4.79 KB, created by
Martin Renvoize (ashimema)
on 2023-03-15 13:43:15 UTC
(
hide
)
Description:
Bug 32426: Changes for opac-memberentry
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-03-15 13:43:15 UTC
Size:
4.79 KB
patch
obsolete
>From d0a785c51ad7a025aee4e21381ccdedae6148137 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 15 Dec 2022 16:03:47 +0100 >Subject: [PATCH] Bug 32426: Changes for opac-memberentry > >Test plan: >Enable self registration, pick a default category too for it. >The changes will be tested later with a plugin, but now change >Koha/Patron.pm as follows: > sub _generate_userid_legacy { # as we always did > my ($self) = @_; >+return $self; >So, add the return $self line only. >Restart all. Try to register an account on OPAC. >You should see an alert about problems processing your registration. >Undo the change in Patron.pm and restart all. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../bootstrap/en/modules/opac-memberentry.tt | 11 ++++++++++ > opac/opac-memberentry.pl | 22 +++++++++++++------ > 2 files changed, 26 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index b051a14c02..f9eb61242c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -125,6 +125,17 @@ > </div> > [% END %] > >+ [% IF error_type OR error_info %] >+ <div class="alert alert-error"><li> >+ <p>There were problems processing your registration. Please contact your library for help.</p> >+ [% IF error_type == 'Koha::Exceptions::Patron::InvalidUserid' %] >+ <p>Error: Userid is not valid</p> >+ [% ELSE %] >+ <p>Error [% error_type %]: [% error_info %]</p> >+ [% END %] >+ </li></div> >+ [% END %] >+ > [% IF failed_captcha %] > <div class="alert alert-warning">You typed in the wrong characters in the box before submitting. Please try again.</div> > [% END %] >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 0115d78f98..a09bcb8bc1 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -22,6 +22,7 @@ use Digest::MD5 qw( md5_base64 md5_hex ); > use JSON qw( to_json ); > use List::MoreUtils qw( any each_array uniq ); > use String::Random qw( random_string ); >+use Try::Tiny; > > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); >@@ -213,6 +214,19 @@ if ( $action eq 'create' ) { > C4::Letters::SendQueuedMessages({ message_id => $message_id }); > } > else { >+ $borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); >+ my $consent_dt = delete $borrower{gdpr_proc_consent}; >+ my $patron; >+ 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; >+ } catch { >+ my $type = ref($_); >+ my $info = "$_"; >+ $template->param( error_type => $type, error_info => $info ); >+ $template->param( borrower => \%borrower ); >+ }; >+ > ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "opac-registration-confirmation.tt", >@@ -220,12 +234,8 @@ if ( $action eq 'create' ) { > query => $cgi, > authnotrequired => 1, > } >- ); >+ ) if $patron; > >- $borrower{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})); >- my $consent_dt = delete $borrower{gdpr_proc_consent}; >- my $patron = Koha::Patron->new( \%borrower )->store; >- Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; > if ( $patron ) { > $patron->extended_attributes->filter_by_branch_limitations->delete; > $patron->extended_attributes($attributes); >@@ -280,8 +290,6 @@ if ( $action eq 'create' ) { > $patron->notify_library_of_registration($notify_library); > } > >- } else { >- # FIXME Handle possible errors here > } > $template->param( > PatronSelfRegistrationAdditionalInstructions => >-- >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 32426
:
146947
|
146948
|
146949
|
146950
|
146951
|
146952
|
146953
|
146954
|
147252
|
147253
|
147254
|
147255
|
147704
|
147705
|
147706
|
147707
|
147708
|
147709
|
147710
|
147711
|
147712
|
148203
|
148204
| 148205 |
148206
|
148207
|
148208
|
148209
|
148210
|
148211
|
148782
|
148793