View | Details | Raw Unified | Return to bug 23151
Collapse All | Expand All

(-)a/Koha/Patron/Modification.pm (-5 / +5 lines)
Lines 33-38 use Try::Tiny; Link Here
33
33
34
use base qw(Koha::Object);
34
use base qw(Koha::Object);
35
35
36
our $DUMMY_DATE = '9999-12-31';
37
36
=head1 NAME
38
=head1 NAME
37
39
38
Koha::Patron::Modification - Class represents a request to modify or create a patron
40
Koha::Patron::Modification - Class represents a request to modify or create a patron
Lines 96-107 sub approve { Link Here
96
    return unless $patron;
98
    return unless $patron;
97
99
98
    foreach my $key ( keys %$data ) {
100
    foreach my $key ( keys %$data ) {
99
        next # Unset it!
100
          if $key eq 'dateofbirth'
101
          && $patron->dateofbirth
102
          && not defined $data->{$key};
103
104
        delete $data->{$key} unless defined $data->{$key};
101
        delete $data->{$key} unless defined $data->{$key};
102
        if ($data->{$key} == $Koha::Patron::Modification::DUMMY_DATE) {
103
            $data->{$key} = undef;
104
        }
105
    }
105
    }
106
106
107
    $patron->set($data);
107
    $patron->set($data);
(-)a/Koha/Patron/Modifications.pm (-1 / +2 lines)
Lines 33-38 use JSON; Link Here
33
33
34
use base qw(Koha::Objects);
34
use base qw(Koha::Objects);
35
35
36
36
=head2 pending_count
37
=head2 pending_count
37
38
38
$count = Koha::Patron::Modifications->pending_count();
39
$count = Koha::Patron::Modifications->pending_count();
Lines 132-138 sub pending { Link Here
132
133
133
                $row->{$key} = \@pending_attributes;
134
                $row->{$key} = \@pending_attributes;
134
            }
135
            }
135
            if ( $key eq 'dateofbirth' and not defined $row->{$key}) {
136
            if ( $key eq 'dateofbirth' and $row->{$key} == $Koha::Patron::Modification::DUMMY_DATE) {
136
                $row->{$key} = '';
137
                $row->{$key} = '';
137
            } else {
138
            } else {
138
                delete $row->{$key} unless defined $row->{$key};
139
                delete $row->{$key} unless defined $row->{$key};
(-)a/opac/opac-memberentry.pl (-1 / +3 lines)
Lines 247-252 elsif ( $action eq 'update' ) { Link Here
247
    my %borrower = ParseCgiForBorrower($cgi);
247
    my %borrower = ParseCgiForBorrower($cgi);
248
    $borrower{borrowernumber} = $borrowernumber;
248
    $borrower{borrowernumber} = $borrowernumber;
249
249
250
    if (defined $borrower->{dateofbirth} && ! $borrower{dateofbirth}) {
251
        $borrower{dateofbirth} = $Koha::Patron::Modification::DUMMY_DATE;
252
    }
250
    my %borrower_changes = DelEmptyFields(%borrower);
253
    my %borrower_changes = DelEmptyFields(%borrower);
251
    my @empty_mandatory_fields =
254
    my @empty_mandatory_fields =
252
      CheckMandatoryFields( \%borrower_changes, $action );
255
      CheckMandatoryFields( \%borrower_changes, $action );
253
- 

Return to bug 23151