koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/intranet/modules/C4 Date.pm [rel_TG]


From: Tumer Garip
Subject: [Koha-cvs] koha/intranet/modules/C4 Date.pm [rel_TG]
Date: Mon, 12 Mar 2007 15:04:06 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_TG
Changes by:     Tumer Garip <tgarip1957>        07/03/12 15:04:06

Modified files:
        intranet/modules/C4: Date.pm 

Log message:
        bug fixing the new Date::Calc

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/modules/C4/Date.pm?cvsroot=koha&only_with_tag=rel_TG&r1=1.1.2.2&r2=1.1.2.3

Patches:
Index: Date.pm
===================================================================
RCS file: /sources/koha/koha/intranet/modules/C4/Attic/Date.pm,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- Date.pm     11 Mar 2007 20:03:27 -0000      1.1.2.2
+++ Date.pm     12 Mar 2007 15:04:06 -0000      1.1.2.3
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Date.pm,v 1.1.2.2 2007/03/11 20:03:27 tgarip1957 Exp $
+# $Id: Date.pm,v 1.1.2.3 2007/03/12 15:04:06 tgarip1957 Exp $
 ##changed to use Date::Calc
 package C4::Date;
 
@@ -29,7 +29,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
-$VERSION = do { my @v = '$Revision: 1.1.2.2 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.1.2.3 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw(Exporter);
 
@@ -195,19 +195,23 @@
 return sprintf("%04d-%02d-%02d",$year,$month,$day);
 }
 
-###Utility functions for serials management
+###Utility functions 
 sub DATE_diff {
 ## returns 1 if date1>date2 0 if date1==date2 -1 if date1<date2
 my ($date1,$date2)address@hidden;
 my ($year1,$month1,$day1)=Parse_Date($date1);
+($year1,$month1,$day1)=split /-|\/|\.|:/,$date1 unless ($year1 && $month1);
 my ($year2,$month2,$day2)=Parse_Date($date2);
-return Delta_Days($year1,$month1,$day1, $year2,$month2,$day2) 
+($year2,$month2,$day2)=split /-|\/|\.|:/,$date2 unless ($year2 && $month2);
+my $dif= Delta_Days( $year2,$month2,$day2,$year1,$month1,$day1) ;
+return $dif;
 }
 
 sub DATE_Add {
 ## $amount in days
 my ($date,$amount)address@hidden;
 my ($year,$month,$day)=Parse_Date($date);
+($year,$month,$day)=split /-|\/|\.|:/,$date unless ($year && $month);
 ($year,$month,$day) = Add_Delta_Days($year,$month,$day, $amount);
 return sprintf("%04d-%02d-%02d",$year,$month,$day);
 }




reply via email to

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