Coverage fixes for date and last modified macros.

Refactor LastModified macro to use placeholders and remove an unused conditional.
This commit is contained in:
Colin Kuskie 2006-09-14 22:22:35 +00:00
parent a5049f8149
commit a1bf6a2b21
3 changed files with 58 additions and 17 deletions

View file

@ -44,12 +44,12 @@ sub process {
my ($label, $format, $time);
($label, $format) = @_;
$format = '%z' if ($format eq "");
($time) = $session->dbSlave->quickArray("SELECT max(revisionDate) FROM assetData where assetId=".$session->db->quote($session->asset->getId));
($time) = $session->dbSlave->quickArray("SELECT max(revisionDate) FROM assetData where assetId=?",[$session->asset->getId]);
if ($time) {
return $label.$session->datetime->epochToHuman($time,$format);
}
my $i18n = WebGUI::International->new($session,'Macro_LastModified');
return $i18n->get('never') if $time eq 0;
return $label.$session->datetime->epochToHuman($time,$format) if ($time);
return $i18n->get('never');
}
1;