Bugzilla – Attachment 181409 Details for
Bug 39729
Add option -exact_days to filter_by_last_update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39729: Add option -exact_days to filter_by_last_update
Bug-39729-Add-option--exactdays-to-filterbylastupd.patch (text/plain), 2.08 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-04-24 09:11:10 UTC
(
hide
)
Description:
Bug 39729: Add option -exact_days to filter_by_last_update
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-04-24 09:11:10 UTC
Size:
2.08 KB
patch
obsolete
>From 0963bf101a33802910f082337b5629a69bfddfb5 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Thu, 10 Apr 2025 15:22:33 +0200 >Subject: [PATCH] Bug 39729: Add option -exact_days to filter_by_last_update > >--- > Koha/Objects.pm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 405e6a76..b933a0bc 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -237,7 +237,7 @@ sub update { > > my $filtered_objects = $objects->filter_by_last_update({ > from => $from_datetime, to => $to_datetime, >- days|older_than => $days, min_days => $days, younger_than => $days, >+ days|older_than => $days, min_days => $days, younger_than => $days, exact_days => $days > }); > > You should pass at least one of the parameters: from, to, days|older_than, >@@ -255,7 +255,7 @@ sub filter_by_last_update { > my $timestamp_column_name = $params->{timestamp_column_name} || 'timestamp'; > my $conditions; > Koha::Exceptions::MissingParameter->throw("Please pass: days|from|to|older_than|younger_than") >- unless grep { exists $params->{$_} } qw/days from to older_than younger_than min_days/; >+ unless grep { exists $params->{$_} } qw/days from to older_than younger_than min_days exact_days/; > > foreach my $key (qw(from to)) { > if ( exists $params->{$key} and ref $params->{$key} ne 'DateTime' ) { >@@ -264,10 +264,10 @@ sub filter_by_last_update { > } > > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- foreach my $p (qw/days older_than younger_than min_days/) { >+ foreach my $p (qw/days older_than younger_than min_days exact_days/) { > next if !exists $params->{$p}; > my $days = $params->{$p}; >- my $operator = { days => '<', older_than => '<', min_days => '<=' }->{$p} // '>'; >+ my $operator = { days => '<', older_than => '<', min_days => '<=', 'exact_days' => "=" }->{$p} // '>'; > $conditions->{$operator} = \[ 'DATE_SUB(CURDATE(), INTERVAL ? DAY)', $days ]; > } > if ( exists $params->{from} ) { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39729
: 181409