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

(-)a/Koha/Patrons.pm (-3 / +2 lines)
Lines 180-186 sub anonymize_last_borrowers { Link Here
180
180
181
    return unless C4::Context->preference("AnonymizeLastBorrower");
181
    return unless C4::Context->preference("AnonymizeLastBorrower");
182
    my $days = C4::Context->preference("AnonymizeLastBorrowerDays") || 0;
182
    my $days = C4::Context->preference("AnonymizeLastBorrowerDays") || 0;
183
    my ( $year,    $month,    $day )    = Today();
183
    my ( $year, $month, $day )          = Today();
184
    my ( $newyear, $newmonth, $newday ) = Add_Delta_Days( $year, $month, $day, (-1) * $days );
184
    my ( $newyear, $newmonth, $newday ) = Add_Delta_Days( $year, $month, $day, (-1) * $days );
185
    my $older_than_date = dt_from_string( sprintf "%4d-%02d-%02d", $newyear, $newmonth, $newday );
185
    my $older_than_date = dt_from_string( sprintf "%4d-%02d-%02d", $newyear, $newmonth, $newday );
186
186
Lines 189-195 sub anonymize_last_borrowers { Link Here
189
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
189
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
190
    my $rs  = $self->_resultset->search(
190
    my $rs  = $self->_resultset->search(
191
        {
191
        {
192
            created_on => { '<' => $dtf->format_datetime($older_than_date), },
192
            created_on                            => { '<'   => $dtf->format_datetime($older_than_date), },
193
            'items_last_borrowers.borrowernumber' => { 'not' => undef },    # Keep forever
193
            'items_last_borrowers.borrowernumber' => { 'not' => undef },    # Keep forever
194
            ( $anonymous_patron ? ( 'items_last_borrowers.borrowernumber' => { '!=' => $anonymous_patron } ) : () ),
194
            ( $anonymous_patron ? ( 'items_last_borrowers.borrowernumber' => { '!=' => $anonymous_patron } ) : () ),
195
        },
195
        },
196
- 

Return to bug 23260