X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FLog.pm;h=14448e3ca54afdf9cfc7f5aa1cd0c9ea533bcb06;hb=6fd9b3febeebf95bd0590269bd33739f5cbed7de;hp=9f4430cbb64df4c3bbd6e4834179dd62e0dfe67e;hpb=17923b97f60201583584a527b4038d5c13730ed4;p=koha_fer diff --git a/C4/Log.pm b/C4/Log.pm index 9f4430cbb6..14448e3ca5 100644 --- a/C4/Log.pm +++ b/C4/Log.pm @@ -4,6 +4,7 @@ package C4::Log; # Copyright 2000-2002 Katipo Communications +# Copyright 2011 MJ Ray and software.coop # # This file is part of Koha. # @@ -16,11 +17,13 @@ package C4::Log; # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; +use warnings; + use C4::Context; use C4::Dates qw(format_date); @@ -28,7 +31,7 @@ use vars qw($VERSION @ISA @EXPORT); BEGIN { # set the version for version checking - $VERSION = 3.01; + $VERSION = 3.07.00.049; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(&logaction &GetLogStatus &displaylog &GetLogs); @@ -211,26 +214,21 @@ sub GetLogs { my @parameters; $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; #fix me - mysql specific $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto; - if($user) { - $query .= " AND user LIKE ? "; - push(@parameters,"%".$user."%"); + if($user ne "") { + $query .= " AND user = ? "; + push(@parameters,$user); } - if(scalar @$modules > 1 or @$modules[0] ne "") { - $query .= " AND (1 = 2"; #always false but used to build the query - foreach my $module (@$modules) { - next if $module eq ""; - $query .= " or module = ?"; - push(@parameters,$module); - } - $query .= ")"; + if($modules && scalar(@$modules)) { + $query .= " AND module IN (".join(",",map {"?"} @$modules).") "; + push(@parameters,@$modules); } - if($action) { - $query .= " AND action LIKE ? "; - push(@parameters,"%".$action."%"); + if($action && scalar(@$action)) { + $query .= " AND action IN (".join(",",map {"?"} @$action).") "; + push(@parameters,@$action); } if($object) { - $query .= " AND object LIKE ? "; - push(@parameters,"%".$object."%"); + $query .= " AND object = ? "; + push(@parameters,$object); } if($info) { $query .= " AND info LIKE ? "; @@ -255,6 +253,6 @@ __END__ =head1 AUTHOR -Koha Developement team +Koha Development Team =cut