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

SF.net SVN: ledger-smb: [1160] trunk



Revision: 1160
          http://svn.sourceforge.net/ledger-smb/?rev=1160&view=rev
Author:   tetragon
Date:     2007-05-07 14:19:32 -0700 (Mon, 07 May 2007)

Log Message:
-----------
Scope fixing and a bugfix for $form->add_date

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/t/03-date-handling.t

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-05-07 20:59:36 UTC (rev 1159)
+++ trunk/LedgerSMB/Form.pm	2007-05-07 21:19:32 UTC (rev 1160)
@@ -1376,6 +1376,9 @@
 
     my $diff = 0;
     my $spc  = $myconfig->{dateformat};
+    my $yy;
+    my $mm;
+    my $dd;
     $spc =~ s/\w//g;
     $spc = substr( $spc, 0, 1 );
 
@@ -1399,7 +1402,7 @@
         else {
 
             # ISO
-            ( $yy, $mm, $dd ) =~ /(....)(..)(..)/;
+            ( $yy, $mm, $dd ) = ($date =~ /(....)(..)(..)/);
         }
 
         if ( $unit eq 'days' ) {

Modified: trunk/t/03-date-handling.t
===================================================================
--- trunk/t/03-date-handling.t	2007-05-07 20:59:36 UTC (rev 1159)
+++ trunk/t/03-date-handling.t	2007-05-07 21:19:32 UTC (rev 1160)
@@ -328,5 +328,7 @@
 	cmp_ok($form->add_date(\%myconfig, $start, 2, 'years'), 'eq',
 		$results, "add_date, $fmt, 2 years, 2000-01-29");
 }
+cmp_ok($form->add_date(\%myconfig, '20000129', 2, 'years'), 'eq',
+	'20020129', 'add_date, yyyymmdd, 2 years, 20000129');
 ok(!defined $form->add_date(\%myconfig),
 	'add_date, undef if no date');


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.