Bugzilla – Attachment 89483 Details for
Bug 11853
Cannot clear date of birth via OPAC patron update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11853: Allow to clear the date of birth at the OPAC
Bug-11853-Allow-to-clear-the-date-of-birth-at-the-.patch (text/plain), 2.46 KB, created by
Liz Rea
on 2019-05-08 22:25:30 UTC
(
hide
)
Description:
Bug 11853: Allow to clear the date of birth at the OPAC
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-05-08 22:25:30 UTC
Size:
2.46 KB
patch
obsolete
>From 0163d09514bae9cf8e13842d036f3fffed581f95 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 8 May 2019 16:37:50 -0500 >Subject: [PATCH] Bug 11853: Allow to clear the date of birth at the OPAC > >A patron is not able to clear their date of birth. > >When cleared tt is set to NULL in DB which means, for the patron's >modifications feature, that nothing has been changed. > >Test plan: >0/ Do not apply the patch >1/ Edit your personal details at the OPAC >2/ Add a date of birth >3/ On the staff interface, approve the modification request >=> OK it is updated >4/ Edit your personal details and clear the date of birth >5/ On the staff interface >=> KO the table display is wrong, nothing is marked has changed >6/ Approve the modification requiest >=> KO it has not been cleared >7/ Apply the patch and repeat 1 to 6 and confirm that the behaviors are >now correct. > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > Koha/Patron/Modification.pm | 14 +++++++++----- > Koha/Patron/Modifications.pm | 6 +++++- > 2 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/Koha/Patron/Modification.pm b/Koha/Patron/Modification.pm >index b0e01b7378..b5d5aded70 100644 >--- a/Koha/Patron/Modification.pm >+++ b/Koha/Patron/Modification.pm >@@ -92,14 +92,18 @@ sub approve { > delete $data->{verification_token}; > delete $data->{extended_attributes}; > >- foreach my $key ( keys %$data ) { >- delete $data->{$key} unless ( defined( $data->{$key} ) ); >- } >- > my $patron = Koha::Patrons->find( $self->borrowernumber ); >- > return unless $patron; > >+ foreach my $key ( keys %$data ) { >+ next # Unset it! >+ if $key eq 'dateofbirth' >+ && $patron->dateofbirth >+ && not defined $data->{$key}; >+ >+ delete $data->{$key} unless defined $data->{$key}; >+ } >+ > $patron->set($data); > > # Take care of extended attributes >diff --git a/Koha/Patron/Modifications.pm b/Koha/Patron/Modifications.pm >index 5b424cd7d0..646d112f4c 100644 >--- a/Koha/Patron/Modifications.pm >+++ b/Koha/Patron/Modifications.pm >@@ -132,7 +132,11 @@ sub pending { > > $row->{$key} = \@pending_attributes; > } >- delete $row->{$key} unless defined $row->{$key}; >+ if ( $key eq 'dateofbirth' and not defined $row->{$key}) { >+ $row->{$key} = ''; >+ } else { >+ delete $row->{$key} unless defined $row->{$key}; >+ } > } > > push( @m, $row ); >-- >2.11.0
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 11853
:
89480
|
89481
|
89483
|
89484
|
89580
|
89581
|
90321