@@ -, +, @@ --------- -- you should see the changes you just made. -- the values should be as expected -- the values should be as expected --- Koha/Patron/Modification.pm | 10 +++++----- Koha/Patron/Modifications.pm | 3 ++- opac/opac-memberentry.pl | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) --- a/Koha/Patron/Modification.pm +++ a/Koha/Patron/Modification.pm @@ -33,6 +33,8 @@ use Try::Tiny; use base qw(Koha::Object); +our $DUMMY_DATE = '9999-12-31'; + =head1 NAME Koha::Patron::Modification - Class represents a request to modify or create a patron @@ -96,12 +98,10 @@ sub approve { 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}; + if (defined $data && defined $data->{$key} && $data->{$key} eq $Koha::Patron::Modification::DUMMY_DATE) { + $data->{$key} = undef; + } } $patron->set($data); --- a/Koha/Patron/Modifications.pm +++ a/Koha/Patron/Modifications.pm @@ -33,6 +33,7 @@ use JSON; use base qw(Koha::Objects); + =head2 pending_count $count = Koha::Patron::Modifications->pending_count(); @@ -132,7 +133,7 @@ sub pending { $row->{$key} = \@pending_attributes; } - if ( $key eq 'dateofbirth' and not defined $row->{$key}) { + if ( $key eq 'dateofbirth' && defined $row->{$key} && $row->{$key} eq $Koha::Patron::Modification::DUMMY_DATE) { $row->{$key} = ''; } else { delete $row->{$key} unless defined $row->{$key}; --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -247,6 +247,9 @@ elsif ( $action eq 'update' ) { my %borrower = ParseCgiForBorrower($cgi); $borrower{borrowernumber} = $borrowernumber; + if (defined $borrower->{dateofbirth} && ! $borrower{dateofbirth}) { + $borrower{dateofbirth} = $Koha::Patron::Modification::DUMMY_DATE; + } my %borrower_changes = DelEmptyFields(%borrower); my @empty_mandatory_fields = CheckMandatoryFields( \%borrower_changes, $action ); --