use Koha::Patron::Modification;
use JSON;
+use List::Util qw /any none/;
use base qw(Koha::Objects);
my @m;
while ( my $row = $sth->fetchrow_hashref() ) {
+ my @changed_keys = split /,/, $row->{changed_fields};
foreach my $key ( keys %$row ) {
+ if ($key eq 'changed_fields') {
+ delete $row->{$key};
+ next;
+ }
if ( defined $row->{$key} && $key eq 'extended_attributes' ) {
my $attributes = from_json( $row->{$key} );
my @pending_attributes;
$row->{$key} = \@pending_attributes;
}
- if ( $key eq 'dateofbirth' and not defined $row->{$key}) {
- $row->{$key} = '';
- } else {
+ if (none { $_ eq $key } @changed_keys) {
delete $row->{$key} unless defined $row->{$key};
}
}