koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/tools koha-news.pl [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha/tools koha-news.pl [rel_3_0]
Date: Wed, 10 Jan 2007 14:14:32 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        07/01/10 14:14:32

Modified files:
        tools          : koha-news.pl 

Log message:
        the expirated news has a special css class now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/tools/koha-news.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.5&r2=1.1.2.6

Patches:
Index: koha-news.pl
===================================================================
RCS file: /sources/koha/koha/tools/koha-news.pl,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- koha-news.pl        10 Jan 2007 10:52:58 -0000      1.1.2.5
+++ koha-news.pl        10 Jan 2007 14:14:32 -0000      1.1.2.6
@@ -29,6 +29,7 @@
 use C4::Output;
 use C4::Interface::CGI::Output;
 use C4::NewsChannels;
+use Date::Calc qw/Date_to_Days Today/;
 
 my $cgi = new CGI;
 
@@ -36,10 +37,9 @@
 my $title          = $cgi->param('title');
 my $new            = $cgi->param('new');
 my $expirationdate = $cgi->param('expirationdate');
-my $order      = $cgi->param('order') || 0;
+my $number         = $cgi->param('number');
 my $lang           = $cgi->param('lang');
 
-
 my $new_detail = get_opac_new($id);
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -82,12 +82,11 @@
     }
 }
 elsif ( $op eq 'add' ) {
-
-    add_opac_new( $title, $new, $lang, $expirationdate, $order );
+    add_opac_new( $title, $new, $lang, $expirationdate, $number );
     print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
 }
 elsif ( $op eq 'edit' ) {
-    upd_opac_new( $id, $title, $new, $lang, $expirationdate, $order );
+    upd_opac_new( $id, $title, $new, $lang, $expirationdate, $number );
     print $cgi->redirect("/cgi-bin/koha/tools/koha-news.pl");
 }
 elsif ( $op eq 'del' ) {
@@ -100,6 +99,14 @@
 
     my ( $opac_news_count, $opac_news ) = &get_opac_news( undef, $lang );
     
+    foreach my $new ( @$opac_news ) {
+        next unless $new->{'expirationdate'};
+        next if $new->{'expirationdate'} eq '0000-00-00';
+        if (Date_to_Days( split "-" ,$new->{'expirationdate'} ) < 
Date_to_Days(&Today) ){
+            $new->{'hasexpirated'} = 1;
+        }
+    }
+    
     $template->param(
         $lang           => 1,
         opac_news       => $opac_news,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]