Bugzilla – Attachment 132273 Details for
Bug 30120
Allow extended attributes during self registration when using PatronSelfRegistrationVerifyByEmail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30120: Save and apply extended attributes during self registration verification by email
Bug-30120-Save-and-apply-extended-attributes-durin.patch (text/plain), 5.42 KB, created by
Katrin Fischer
on 2022-03-27 13:09:06 UTC
(
hide
)
Description:
Bug 30120: Save and apply extended attributes during self registration verification by email
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-03-27 13:09:06 UTC
Size:
5.42 KB
patch
obsolete
>From 5357fc4f7d9e3f6e22289ce5a36eae11438ebe7a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 17 Feb 2022 14:02:35 +0000 >Subject: [PATCH] Bug 30120: Save and apply extended attributes during self > registration verification by email > >The self registration form stores a new borrower as a borrower modification when verifying by email. > >Borrower modifications can handle extended attributes. > >This patch simply sotres the extended attributes in the modifications table, and approves a modification >to the extended attributes only after patron is created > >To test: >1 - Apply patch >2 - Create a patron attribute and set it as viewable/editable in the OPAC >3 - Set system preference PatronSelfRegistrationVerifyByEmail >4 - Reigster a new patron on the OPAC, provide an email and populate the extended attribute >5 - Retrieve the verification token, the last on in the messages table > SELECT * FROM message_queue; >6 - Go tot he url from above >7 - Confirm successful patron creation >8 - View patron record and confirm attribute was set > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/admin/patron-attr-types.tt | 2 +- > .../opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 2 +- > opac/opac-memberentry.pl | 1 + > opac/opac-registration-verify.pl | 9 ++++++++- > 4 files changed, 11 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >index b57890ace2..8a809c7d8c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >@@ -165,7 +165,7 @@ Patron attribute types › Administration › Koha > [% ELSE %] > <input type="checkbox" id="opac_editable" name="opac_editable" /> > [% END %] >- <span class="hint">Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above, does not work during <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistration" target="_blank">self-registration</a> if <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=PatronSelfRegistrationVerifyByEmail" target="_blank">PatronSelfRegistrationVerifyByEmail</a> is set.)</span> >+ <span class="hint">Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above)</span> > </li> > <li><label for="staff_searchable">Searchable: </label> > [% IF attribute_type AND attribute_type.staff_searchable %] >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 5a1a31e9d5..4e1a4fd692 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -886,7 +886,7 @@ > </div> <!-- /.row --> > [% END %] > >- [% IF ( Koha.Preference('ExtendedPatronAttributes') && patron_attribute_classes.size && ! ( action == 'new' && Koha.Preference('PatronSelfRegistrationVerifyByEmail') ) ) %] >+ [% IF ( Koha.Preference('ExtendedPatronAttributes') && patron_attribute_classes.size ) %] > <div class="row"> > <div class="col"> > [% FOREACH pa_class IN patron_attribute_classes %] >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index e33ab0391e..3eb94b2ab6 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -190,6 +190,7 @@ if ( $action eq 'create' ) { > $borrower{password} = Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})) unless $borrower{password}; > $borrower{verification_token} = $verification_token; > >+ $borrower{extended_attributes} = to_json($attributes); > Koha::Patron::Modification->new( \%borrower )->store(); > > #Send verification email >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 99651eef5c..90eb16e629 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -67,12 +67,19 @@ if ( > delete $patron_attrs->{timestamp}; > delete $patron_attrs->{verification_token}; > delete $patron_attrs->{changed_fields}; >+ delete $patron_attrs->{extended_attributes}; > my $patron = Koha::Patron->new( $patron_attrs )->store; > > Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; > > if ($patron) { >- $m->delete(); >+ if( $m->extended_attributes ){ >+ $m->borrowernumber( $patron->borrowernumber); >+ $m->changed_fields(['extended_attributes']); >+ $m->approve(); >+ } else { >+ $m->delete(); >+ } > 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 ); >-- >2.30.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 30120
:
130748
|
130750
| 132273