diff --git a/Sam/commands/list.pm b/Sam/commands/list.pm index a01826d889f5380a7d11b1f3d39821a50659e389..d90ee1143758d73fa362e27d5cd2f09329fda822 100644 --- a/Sam/commands/list.pm +++ b/Sam/commands/list.pm @@ -13,16 +13,16 @@ sub exec { my $sth; if ($chan->[0] =~ /^#/) { - $sth = $dbh->prepare_cached('SELECT id, title, date, place, description, link + $sth = $dbh->prepare_cached('SELECT id, title, DATE_FORMAT(date, "%d/%m/%Y"), place, description, link FROM sam - WHERE date > ? + WHERE date > NOW() ORDER BY date LIMIT 2' ); } else { - $sth = $dbh->prepare_cached('SELECT id, title, date, place, description, link + $sth = $dbh->prepare_cached('SELECT id, title, DATE_FORMAT(date, "%d/%m/%Y"), place, description, link FROM sam - WHERE date > ? + WHERE date > NOW() ORDER BY date' ); } @@ -32,7 +32,7 @@ sub exec { return; } - $sth->execute(scalar time) + $sth->execute() or $log->error("Couldn't finish transaction: " . $dbh->errstr); if (!$sth->rows) { @@ -41,12 +41,7 @@ sub exec { } while ($row = $sth->fetch) { - my (undef, undef, undef, $day, $month, $year, undef, undef, undef) = - localtime($row->[2]); - $month++; - $year += 1900; - - $msg = "[".$row->[0]."] ".$row->[1]." le $day/$month/$year"; + $msg = "[".$row->[0]."] ".$row->[1]." le ".$row->[2]; $msg .= " @ ".$row->[3] if ($row->[3]); $msg .= " : ".$row->[4] if ($row->[4]); $msg .= " <".$row->[5].">" if ($row->[5]);