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

(-)a/Koha/Objects.pm (-5 / +4 lines)
Lines 237-243 sub update { Link Here
237
237
238
    my $filtered_objects = $objects->filter_by_last_update({
238
    my $filtered_objects = $objects->filter_by_last_update({
239
        from => $from_datetime, to => $to_datetime,
239
        from => $from_datetime, to => $to_datetime,
240
        days|older_than => $days, min_days => $days, younger_than => $days,
240
        days|older_than => $days, min_days => $days, younger_than => $days, exact_days => $days
241
    });
241
    });
242
242
243
You should pass at least one of the parameters: from, to, days|older_than,
243
You should pass at least one of the parameters: from, to, days|older_than,
Lines 255-261 sub filter_by_last_update { Link Here
255
    my $timestamp_column_name = $params->{timestamp_column_name} || 'timestamp';
255
    my $timestamp_column_name = $params->{timestamp_column_name} || 'timestamp';
256
    my $conditions;
256
    my $conditions;
257
    Koha::Exceptions::MissingParameter->throw("Please pass: days|from|to|older_than|younger_than")
257
    Koha::Exceptions::MissingParameter->throw("Please pass: days|from|to|older_than|younger_than")
258
        unless grep { exists $params->{$_} } qw/days from to older_than younger_than min_days/;
258
        unless grep { exists $params->{$_} } qw/days from to older_than younger_than min_days exact_days/;
259
259
260
    foreach my $key (qw(from to)) {
260
    foreach my $key (qw(from to)) {
261
        if ( exists $params->{$key} and ref $params->{$key} ne 'DateTime' ) {
261
        if ( exists $params->{$key} and ref $params->{$key} ne 'DateTime' ) {
Lines 264-273 sub filter_by_last_update { Link Here
264
    }
264
    }
265
265
266
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
266
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
267
    foreach my $p (qw/days older_than younger_than min_days/) {
267
    foreach my $p (qw/days older_than younger_than min_days exact_days/) {
268
        next if !exists $params->{$p};
268
        next if !exists $params->{$p};
269
        my $days     = $params->{$p};
269
        my $days     = $params->{$p};
270
        my $operator = { days => '<', older_than => '<', min_days => '<=' }->{$p} // '>';
270
        my $operator = { days => '<', older_than => '<', min_days => '<=', 'exact_days' => "=" }->{$p} // '>';
271
        $conditions->{$operator} = \[ 'DATE_SUB(CURDATE(), INTERVAL ? DAY)', $days ];
271
        $conditions->{$operator} = \[ 'DATE_SUB(CURDATE(), INTERVAL ? DAY)', $days ];
272
    }
272
    }
273
    if ( exists $params->{from} ) {
273
    if ( exists $params->{from} ) {
274
- 

Return to bug 39729