X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=tools%2Fkoha-news.pl;h=08b38c825113de252d207221b7e38021a4c5292e;hb=e0dfa633065a81f6ec2577ef583c8c60c41def00;hp=43dd9dd5b9698d1779b32136dca30372b4ae0c0b;hpb=8b0a28acedc90480b25cf7823269ddade10392ff;p=srvgit diff --git a/tools/koha-news.pl b/tools/koha-news.pl index 43dd9dd5b9..08b38c8251 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -29,7 +29,7 @@ use C4::Context; use C4::Dates qw(format_date_in_iso); use C4::Output; use C4::NewsChannels; -use C4::Languages; +use C4::Languages qw(getTranslatedLanguages); use Date::Calc qw/Date_to_Days Today/; my $cgi = new CGI; @@ -38,6 +38,7 @@ my $id = $cgi->param('id'); my $title = $cgi->param('title'); my $new = $cgi->param('new'); my $expirationdate = format_date_in_iso($cgi->param('expirationdate')); +my $timestamp = format_date_in_iso($cgi->param('timestamp')); my $number = $cgi->param('number'); my $lang = $cgi->param('lang'); @@ -49,7 +50,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( query => $cgi, type => "intranet", authnotrequired => 0, - flagsrequired => { tools => 1 }, + flagsrequired => { tools => 'edit_news' }, debug => 1, } ); @@ -60,8 +61,8 @@ my $tlangs = getTranslatedLanguages() ; foreach my $language ( @$tlangs ) { push @lang_list, { - language => $language->{'language_code'}, - selected => ( $new_detail->{lang} eq $language->{'language_code'} ? 1 : 0 ), + language => $language->{'rfc4646_subtag'}, + selected => ( $new_detail->{lang} eq $language->{'rfc4646_subtag'} ? 1 : 0 ), }; } @@ -83,11 +84,11 @@ if ( $op eq 'add_form' ) { } } elsif ( $op eq 'add' ) { - add_opac_new( $title, $new, $lang, $expirationdate, $number ); + add_opac_new( $title, $new, $lang, $expirationdate, $timestamp, $number ); print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); } elsif ( $op eq 'edit' ) { - upd_opac_new( $id, $title, $new, $lang, $expirationdate, $number ); + upd_opac_new( $id, $title, $new, $lang, $expirationdate, $timestamp ,$number ); print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl"); } elsif ( $op eq 'del' ) { @@ -102,10 +103,10 @@ else { 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; + $new->{'expired'} = 1; } } @@ -117,5 +118,6 @@ else { } $template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + dateformat => C4::Context->preference("dateformat"), ); output_html_with_http_headers $cgi, $cookie, $template->output;