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

SF.net SVN: ledger-smb: [1161] branches/1.2



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

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

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

Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm	2007-05-07 21:19:32 UTC (rev 1160)
+++ branches/1.2/LedgerSMB/Form.pm	2007-05-07 21:22:11 UTC (rev 1161)
@@ -1383,6 +1383,9 @@
 
     my $diff = 0;
     my $spc  = $myconfig->{dateformat};
+    my $yy;
+    my $mm;
+    my $dd;
     $spc =~ s/\w//g;
     $spc = substr( $spc, 0, 1 );
 
@@ -1406,7 +1409,7 @@
         else {
 
             # ISO
-            ( $yy, $mm, $dd ) =~ /(....)(..)(..)/;
+            ( $yy, $mm, $dd ) = ($date =~ /(....)(..)(..)/);
         }
 
         if ( $unit eq 'days' ) {
@@ -1423,7 +1426,7 @@
             my $whole = int( $diff / 12 );
             $yy += $whole;
 
-            $mm   = ( $diff % 12 );
+            $mm = ( $diff % 12 );
             $mm = '12' if $mm == 0;
             $yy-- if $mm == 12;
             $diff = 0;

Modified: branches/1.2/t/03-date-handling.t
===================================================================
--- branches/1.2/t/03-date-handling.t	2007-05-07 21:19:32 UTC (rev 1160)
+++ branches/1.2/t/03-date-handling.t	2007-05-07 21:22:11 UTC (rev 1161)
@@ -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.