From f41109ee8e498a39f363ebe7bf482b230cf0e78e Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Tue, 18 Mar 2008 10:43:35 -0400 Subject: [PATCH] Bugfix to correct date format in query used in GetLogs() Signed-off-by: Joshua Ferraro --- C4/Log.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/C4/Log.pm b/C4/Log.pm index e3ac75a33a..c7088c7edf 100644 --- a/C4/Log.pm +++ b/C4/Log.pm @@ -188,21 +188,24 @@ sub GetLogs { my $action = shift; my $object = shift; my $info = shift; - + + my $iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso'); + my $iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso'); + my $dbh = C4::Context->dbh; my $query = " SELECT * FROM action_logs WHERE 1 "; - $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$datefrom."\" " if $datefrom; - $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$dateto."\" " if $dateto; + $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; + $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto; $query .= " AND user LIKE \"%".$user."%\" " if $user; $query .= " AND module LIKE \"%".$module."%\" " if $module; $query .= " AND action LIKE \"%".$action."%\" " if $action; $query .= " AND object LIKE \"%".$object."%\" " if $object; $query .= " AND info LIKE \"%".$info."%\" " if $info; - + my $sth = $dbh->prepare($query); $sth->execute; -- 2.39.5