Lines 135-141
sub get_opac_new {
Link Here
|
135 |
my $data = $sth->fetchrow_hashref; |
135 |
my $data = $sth->fetchrow_hashref; |
136 |
$data->{$data->{'lang'}} = 1 if defined $data->{lang}; |
136 |
$data->{$data->{'lang'}} = 1 if defined $data->{lang}; |
137 |
$data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} ); |
137 |
$data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 }) if ( $data->{expirationdate} ); |
138 |
$data->{timestamp} = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ; |
138 |
$data->{publisheddate} = output_pref({ dt => dt_from_string( $data->{publisheddate} ), dateonly => 1 }) ; |
139 |
return $data; |
139 |
return $data; |
140 |
} |
140 |
} |
141 |
|
141 |
|
Lines 145-151
sub get_opac_news {
Link Here
|
145 |
my $dbh = C4::Context->dbh; |
145 |
my $dbh = C4::Context->dbh; |
146 |
my $query = q{ |
146 |
my $query = q{ |
147 |
SELECT opac_news.*, branches.branchname, |
147 |
SELECT opac_news.*, branches.branchname, |
148 |
timestamp AS newdate, |
148 |
publisheddate AS newdate, |
149 |
borrowers.title AS author_title, |
149 |
borrowers.title AS author_title, |
150 |
borrowers.firstname AS author_firstname, |
150 |
borrowers.firstname AS author_firstname, |
151 |
borrowers.surname AS author_surname |
151 |
borrowers.surname AS author_surname |
Lines 162-168
sub get_opac_news {
Link Here
|
162 |
$query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)'; |
162 |
$query .= ' AND (opac_news.branchcode IS NULL OR opac_news.branchcode=?)'; |
163 |
push @values,$branchcode; |
163 |
push @values,$branchcode; |
164 |
} |
164 |
} |
165 |
$query.= ' ORDER BY timestamp DESC '; |
165 |
$query.= ' ORDER BY publisheddate DESC '; |
166 |
#if ($limit) { |
166 |
#if ($limit) { |
167 |
# $query.= 'LIMIT 0, ' . $limit; |
167 |
# $query.= 'LIMIT 0, ' . $limit; |
168 |
#} |
168 |
#} |
Lines 193-199
sub GetNewsToDisplay {
Link Here
|
193 |
my $dbh = C4::Context->dbh; |
193 |
my $dbh = C4::Context->dbh; |
194 |
# SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate |
194 |
# SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate |
195 |
my $query = q{ |
195 |
my $query = q{ |
196 |
SELECT opac_news.*,timestamp AS newdate, |
196 |
SELECT opac_news.*,publisheddate AS newdate, |
197 |
borrowers.title AS author_title, |
197 |
borrowers.title AS author_title, |
198 |
borrowers.firstname AS author_firstname, |
198 |
borrowers.firstname AS author_firstname, |
199 |
borrowers.surname AS author_surname |
199 |
borrowers.surname AS author_surname |
Lines 204-210
sub GetNewsToDisplay {
Link Here
|
204 |
OR expirationdate IS NULL |
204 |
OR expirationdate IS NULL |
205 |
OR expirationdate = '00-00-0000' |
205 |
OR expirationdate = '00-00-0000' |
206 |
) |
206 |
) |
207 |
AND DATE(timestamp) < DATE_ADD(CURDATE(), INTERVAL 1 DAY) |
207 |
AND publisheddate < DATE_ADD(CURDATE(), INTERVAL 1 DAY) |
208 |
AND (lang = '' OR lang = ?) |
208 |
AND (lang = '' OR lang = ?) |
209 |
AND (opac_news.branchcode IS NULL OR opac_news.branchcode = ?) |
209 |
AND (opac_news.branchcode IS NULL OR opac_news.branchcode = ?) |
210 |
ORDER BY number |
210 |
ORDER BY number |
Lines 216-222
sub GetNewsToDisplay {
Link Here
|
216 |
$sth->execute($lang,$branch); |
216 |
$sth->execute($lang,$branch); |
217 |
my @results; |
217 |
my @results; |
218 |
while ( my $row = $sth->fetchrow_hashref ){ |
218 |
while ( my $row = $sth->fetchrow_hashref ){ |
219 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 }); |
219 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ) }); |
220 |
push @results, $row; |
220 |
push @results, $row; |
221 |
} |
221 |
} |
222 |
return \@results; |
222 |
return \@results; |