Signed-off-by: Joshua Ferraro <jmf@liblime.com>
use strict;\r
\r
use C4::Context;\r
use strict;\r
\r
use C4::Context;\r
+use C4::Dates qw(DHTMLcalendar format_date);\r
\r
use vars qw($VERSION @ISA @EXPORT);\r
\r
\r
use vars qw($VERSION @ISA @EXPORT);\r
\r
&news_channels &get_new_channel &del_channels &add_channel &update_channel\r
&news_channels_categories &get_new_channel_category &del_channels_categories\r
&add_channel_category &update_channel_category &news_channels_by_category\r
&news_channels &get_new_channel &del_channels &add_channel &update_channel\r
&news_channels_categories &get_new_channel_category &del_channels_categories\r
&add_channel_category &update_channel_category &news_channels_by_category\r
-&add_opac_new &upd_opac_new &del_opac_new &get_opac_new &get_opac_news\r
+ &add_opac_new &upd_opac_new &del_opac_new &get_opac_new &get_opac_news\r
&add_opac_electronic &upd_opac_electronic &del_opac_electronic &get_opac_electronic &get_opac_electronics\r
);\r
\r
&add_opac_electronic &upd_opac_electronic &del_opac_electronic &get_opac_electronic &get_opac_electronics\r
);\r
\r
my $count = 0;\r
while (my $row = $sth->fetchrow_hashref) {\r
if ((($limit) && ($count < $limit)) || (!$limit)) {\r
my $count = 0;\r
while (my $row = $sth->fetchrow_hashref) {\r
if ((($limit) && ($count < $limit)) || (!$limit)) {\r
+ # format the dates in the user's requested format defined in sysprefs\r
$row->{'newdate'} = format_date($row->{'newdate'});\r
$row->{'expirationdate'} = format_date($row->{'expirationdate'});\r
push @opac_news, $row;\r
$row->{'newdate'} = format_date($row->{'newdate'});\r
$row->{'expirationdate'} = format_date($row->{'expirationdate'});\r
push @opac_news, $row;\r
sub GetNewsToDisplay {\r
my $lang = shift;\r
my $dbh = C4::Context->dbh;\r
sub GetNewsToDisplay {\r
my $lang = shift;\r
my $dbh = C4::Context->dbh;\r
+ my $dateformat = C4::Dates->DHTMLcalendar;\r
- SELECT *,DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate\r
+ SELECT *,DATE_FORMAT(timestamp, '$dateformat') AS newdate\r
FROM opac_news\r
WHERE (\r
expirationdate > CURRENT_DATE()\r
FROM opac_news\r
WHERE (\r
expirationdate > CURRENT_DATE()\r
sub get_opac_electronics {\r
my ($section, $lang) = @_;\r
my $dbh = C4::Context->dbh;\r
sub get_opac_electronics {\r
my ($section, $lang) = @_;\r
my $dbh = C4::Context->dbh;\r
- my $query = "SELECT *, DATE_FORMAT(timestamp, '%d/%m/%Y') AS newdate FROM opac_electronic";\r
+ my $dateformat = C4::Dates->DHTMLcalendar;\r
+ my $query = "SELECT *, DATE_FORMAT(timestamp, '$dateformat') AS newdate FROM opac_electronic";\r
if ($lang) {\r
$query.= " WHERE lang = '" .$lang ."' ";\r
}\r
if ($lang) {\r
$query.= " WHERE lang = '" .$lang ."' ";\r
}\r
foreach my $new ( @$opac_news ) {
next unless $new->{'expirationdate'};
foreach my $new ( @$opac_news ) {
next unless $new->{'expirationdate'};
- $new->{'expirationdate'}=format_date_in_iso($new->{'expirationdate'});
+ #$new->{'expirationdate'}=format_date_in_iso($new->{'expirationdate'});
my @date = split (/-/,$new->{'expirationdate'});
if ($date[0]*$date[1]*$date[2]>0 && Date_to_Days( @date ) < Date_to_Days(&Today) ){
$new->{'hasexpirated'} = 1;
my @date = split (/-/,$new->{'expirationdate'});
if ($date[0]*$date[1]*$date[2]>0 && Date_to_Days( @date ) < Date_to_Days(&Today) ){
$new->{'hasexpirated'} = 1;