bug 2291: sort branches and letter types
[koha-ffzg.git] / tools / koha-news.pl
index e81a808..3730c10 100755 (executable)
@@ -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;
@@ -49,7 +49,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 +60,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 ),
       };
 }
 
@@ -105,7 +105,7 @@ else {
                #$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 +117,6 @@ else {
 }
 $template->param(
                                DHTMLcalendar_dateformat =>  C4::Dates->DHTMLcalendar(),
+                               dateformat    => C4::Context->preference("dateformat"),
                );
 output_html_with_http_headers $cgi, $cookie, $template->output;