[Koha-cvs] koha/C4 Date.pm [rel_2_2]

Henri-Damien LAURENT laurenthdl at alinto.com
Mon Apr 2 15:57:49 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_2_2
Changes by:	Henri-Damien LAURENT <hdl>	07/04/02 13:57:49

Modified files:
	C4             : Date.pm 

Log message:
	Adding a check if date is already iso in format_date_in_iso

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Date.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.13.4.5&r2=1.13.4.6

Patches:
Index: Date.pm
===================================================================
RCS file: /sources/koha/koha/C4/Date.pm,v
retrieving revision 1.13.4.5
retrieving revision 1.13.4.6
diff -u -b -r1.13.4.5 -r1.13.4.6
--- Date.pm	8 Feb 2007 09:54:46 -0000	1.13.4.5
+++ Date.pm	2 Apr 2007 13:57:49 -0000	1.13.4.6
@@ -100,7 +100,9 @@
         {
                 return "";
         }
-                
+        if (check_whether_iso($olddate)){
+          return $olddate;
+        } else {
         my $dateformat = get_date_format();
         my ($year,$month,$day);
         my @date;
@@ -142,5 +144,14 @@
 	$newdate = sprintf("%04d-%02d-%02d",$date[0],$date[1],$date[2]);
 
 	return $newdate;
+        }
 }
+sub check_whether_iso
+{
+    my $olddate = shift;
+    my @olddate= split /\-/,$olddate ;
+	return 1 if (length($olddate[0])==4 && length($olddate[1])<=2 && length($olddate[2])<=2);
+	return 0;
+}
+
 1;





More information about the Koha-cvs mailing list