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 );