+ my $dtf = Koha::Database->new->schema->storage->datetime_parser;
+ my %search_params;
+
+ if ($datefrom and $dateto ) {
+ my $dateto_endday = dt_from_string($dateto);
+ $dateto_endday->set( # We set last second of day to see all log from that day
+ hour => 23,
+ minute => 59,
+ second => 59
+ );
+ $search_params{'timestamp'} = {
+ -between => [
+ $dtf->format_datetime( dt_from_string($datefrom) ),
+ $dtf->format_datetime( $dateto_endday ),
+ ]
+ };
+ } elsif ($datefrom) {
+ $search_params{'timestamp'} = {
+ '>=' => $dtf->format_datetime( dt_from_string($datefrom) )
+ };
+ } elsif ($dateto) {
+ my $dateto_endday = dt_from_string($dateto);
+ $dateto_endday->set( # We set last second of day to see all log from that day
+ hour => 23,
+ minute => 59,
+ second => 59
+ );
+ $search_params{'timestamp'} = {
+ '<=' => $dtf->format_datetime( $dateto_endday )
+ };
+ }
+ $search_params{user} = $user if $user;
+ $search_params{module} = { -in => [ @modules ] } if ( defined $modules[0] and $modules[0] ne '' ) ;
+ $search_params{action} = { -in => [ @actions ] } if ( defined $actions[0] && $actions[0] ne '' );
+ $search_params{object} = $object if $object;
+ $search_params{info} = $info if $info;
+ $search_params{interface} = { -in => [ @interfaces ] } if ( defined $interfaces[0] && $interfaces[0] ne '' );