|
Lines 23-31
package C4::Log;
Link Here
|
| 23 |
|
23 |
|
| 24 |
use strict; |
24 |
use strict; |
| 25 |
use warnings; |
25 |
use warnings; |
|
|
26 |
use Scalar::Util qw(blessed); |
| 26 |
|
27 |
|
| 27 |
use C4::Context; |
28 |
use C4::Context; |
| 28 |
use C4::Dates qw(format_date); |
29 |
use C4::Dates qw(format_date); |
|
|
30 |
use DateTime; |
| 29 |
|
31 |
|
| 30 |
use vars qw($VERSION @ISA @EXPORT); |
32 |
use vars qw($VERSION @ISA @EXPORT); |
| 31 |
|
33 |
|
|
Lines 202-209
sub GetLogs {
Link Here
|
| 202 |
my $object = shift; |
204 |
my $object = shift; |
| 203 |
my $info = shift; |
205 |
my $info = shift; |
| 204 |
|
206 |
|
| 205 |
my $iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso'); |
207 |
my $iso_datefrom; |
| 206 |
my $iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso'); |
208 |
if (blessed($datefrom) && $datefrom->isa('DateTime')) { |
|
|
209 |
$iso_datefrom = $datefrom->ymd(); |
| 210 |
} |
| 211 |
else { |
| 212 |
$iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso'); |
| 213 |
} |
| 214 |
my $iso_dateto; |
| 215 |
if (blessed($dateto) && $dateto->isa('DateTime')) { |
| 216 |
$iso_dateto = $dateto->ymd(); |
| 217 |
} |
| 218 |
else { |
| 219 |
$iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso'); |
| 220 |
} |
| 207 |
|
221 |
|
| 208 |
my $dbh = C4::Context->dbh; |
222 |
my $dbh = C4::Context->dbh; |
| 209 |
my $query = " |
223 |
my $query = " |
|
Lines 215-221
sub GetLogs {
Link Here
|
| 215 |
my @parameters; |
229 |
my @parameters; |
| 216 |
$query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; #fix me - mysql specific |
230 |
$query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; #fix me - mysql specific |
| 217 |
$query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto; |
231 |
$query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto; |
| 218 |
if($user ne "") { |
232 |
if($user) { |
| 219 |
$query .= " AND user = ? "; |
233 |
$query .= " AND user = ? "; |
| 220 |
push(@parameters,$user); |
234 |
push(@parameters,$user); |
| 221 |
} |
235 |
} |
| 222 |
- |
|
|