my $data = $sth->fetchrow_hashref;
$data->{$data->{'lang'}} = 1 if defined $data->{lang};
$data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} );
- $data->{timestamp} = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ;
+ $data->{publicationdate} = output_pref({ dt => dt_from_string( $data->{publicationdate} ), dateonly => 1 });
return $data;
}
my $dbh = C4::Context->dbh;
my $query = q{
SELECT opac_news.*, branches.branchname,
- timestamp AS newdate,
+ publicationdate AS newdate,
borrowers.title AS author_title,
borrowers.firstname AS author_firstname,
borrowers.surname AS author_surname
$query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)';
push @values,$branchcode;
}
- $query.= ' ORDER BY timestamp DESC ';
+ $query.= ' ORDER BY publicationdate DESC ';
#if ($limit) {
# $query.= 'LIMIT 0, ' . $limit;
#}
sub GetNewsToDisplay {
my ($lang,$branch) = @_;
my $dbh = C4::Context->dbh;
- # SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate
my $query = q{
- SELECT opac_news.*,timestamp AS newdate,
+ SELECT opac_news.*,publicationdate AS newdate,
borrowers.title AS author_title,
borrowers.firstname AS author_firstname,
borrowers.surname AS author_surname
expirationdate >= CURRENT_DATE()
OR expirationdate IS NULL
)
- AND DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
+ AND publicationdate <= CURDATE()
AND (opac_news.lang = '' OR opac_news.lang = ?)
AND (opac_news.branchcode IS NULL OR opac_news.branchcode = ?)
ORDER BY number
- }; # expirationdate field is NOT in ISO format?
- # timestamp has HH:mm:ss, CURRENT_DATE generates 00:00:00
- # by adding 1, that captures today correctly.
+ };
my $sth = $dbh->prepare($query);
$lang = $lang // q{};
$sth->execute($lang,$branch);
if ( $cgi->param('expirationdate') ) {
$expirationdate = output_pref({ dt => dt_from_string( scalar $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
}
-my $timestamp = output_pref({ dt => dt_from_string( scalar $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
+my $publicationdate= output_pref({ dt => dt_from_string( scalar $cgi->param('publicationdate') ), dateformat => 'iso', dateonly => 1 });
my $number = $cgi->param('number');
my $lang = $cgi->param('lang');
my $branchcode = $cgi->param('branch');
content => $content,
lang => $lang,
expirationdate => $expirationdate,
- timestamp => $timestamp,
+ publicationdate=> $publicationdate,
number => $number,
branchcode => $branchcode,
borrowernumber => $borrowernumber,
content => $content,
lang => $lang,
expirationdate => $expirationdate,
- timestamp => $timestamp,
+ publicationdate=> $publicationdate,
number => $number,
branchcode => $branchcode,
}