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

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



Revision: 1200
          http://svn.sourceforge.net/ledger-smb/?rev=1200&view=rev
Author:   tetragon
Date:     2007-05-15 19:53:40 -0700 (Tue, 15 May 2007)

Log Message:
-----------
Some if series -> if elsif conversions

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Locale.pm
    trunk/LedgerSMB.pm
    trunk/t/10-form.t

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2007-05-15 23:15:14 UTC (rev 1199)
+++ trunk/LedgerSMB/Form.pm	2007-05-16 02:53:40 UTC (rev 1200)
@@ -452,35 +452,30 @@
                 $amount =~ s/,$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1 000.00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1 000.00' ) {
                 $amount =~ s/\d{3,}?/$& /g;
                 $amount =~ s/\s$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq "1'000.00" ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq "1'000.00" ) {
                 $amount =~ s/\d{3,}?/$&'/g;
                 $amount =~ s/'$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1.000,00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1.000,00' ) {
                 $amount =~ s/\d{3,}?/$&./g;
                 $amount =~ s/\.$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= ",$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1000,00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1000,00' ) {
                 $amount = "$whole";
                 $amount .= ",$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1000.00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1000.00' ) {
                 $amount = "$whole";
                 $amount .= ".$dec" if ( $dec ne "" );
             }
@@ -538,11 +533,10 @@
         $amount =~ s/\.//g;
         $amount =~ s/,/./;
     }
-    if ( $numberformat eq '1 000.00' ) {
+    elsif ( $numberformat eq '1 000.00' ) {
         $amount =~ s/\s//g;
     }
-
-    if ( $numberformat eq "1'000.00" ) {
+    elsif ( $numberformat eq "1'000.00" ) {
         $amount =~ s/'//g;
     }
 
@@ -550,7 +544,7 @@
     if ( $amount =~ s/\((\d*\.?\d*)\)/$1/ ) {
         $amount = $1 * -1;
     }
-    if ( $amount =~ s/(\d*\.?\d*)\s?DR/$1/ ) {
+    elsif ( $amount =~ s/(\d*\.?\d*)\s?DR/$1/ ) {
         $amount = $1 * -1;
     }
     $amount =~ s/\s?CR//;
@@ -1348,12 +1342,10 @@
         if ( $myconfig->{dateformat} =~ /^yy/ ) {
             ( $yy, $mm, $dd ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^mm/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
             ( $mm, $dd, $yy ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^dd/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
             ( $dd, $mm, $yy ) = split /\D/, $date;
         }
 
@@ -1389,12 +1381,10 @@
             if ( $myconfig->{dateformat} =~ /^yy/ ) {
                 ( $yy, $mm, $dd ) = split /\D/, $date;
             }
-
-            if ( $myconfig->{dateformat} =~ /^mm/ ) {
+            elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
                 ( $mm, $dd, $yy ) = split /\D/, $date;
             }
-
-            if ( $myconfig->{dateformat} =~ /^dd/ ) {
+            elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
                 ( $dd, $mm, $yy ) = split /\D/, $date;
             }
 
@@ -1408,12 +1398,10 @@
         if ( $unit eq 'days' ) {
             $diff = $repeat * 86400;
         }
-
-        if ( $unit eq 'weeks' ) {
+        elsif ( $unit eq 'weeks' ) {
             $diff = $repeat * 604800;
         }
-
-        if ( $unit eq 'months' ) {
+        elsif ( $unit eq 'months' ) {
             $diff = $mm + $repeat;
 
             my $whole = int( $diff / 12 );
@@ -1424,8 +1412,7 @@
             $yy-- if $mm == 12;
             $diff = 0;
         }
-
-        if ( $unit eq 'years' ) {
+        elsif ( $unit eq 'years' ) {
             $yy += $repeat;
         }
 
@@ -1443,12 +1430,10 @@
             if ( $myconfig->{dateformat} =~ /^yy/ ) {
                 $date = "$yy$spc$mm$spc$dd";
             }
-
-            if ( $myconfig->{dateformat} =~ /^mm/ ) {
+            elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
                 $date = "$mm$spc$dd$spc$yy";
             }
-
-            if ( $myconfig->{dateformat} =~ /^dd/ ) {
+            elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
                 $date = "$dd$spc$mm$spc$yy";
             }
 
@@ -3054,13 +3039,13 @@
 
     my ( $self, $dateformat, $date ) = @_;
 
-    my @d = localtime;
     my $mm;
     my $dd;
     my $yy;
     my $rv;
 
     if ( !$date ) {
+        my @d = localtime;
         $dd = $d[3];
         $mm = ++$d[4];
         $yy = substr( $d[5], -2 );
@@ -3089,9 +3074,8 @@
             $rv = "$yy$mm$dd";
         }
     }
+    elsif ( $dateformat =~ /^mm/ ) {
 
-    if ( $dateformat =~ /^mm/ ) {
-
         if ($date) {
 
             if ( $date =~ /\D/ ) {
@@ -3111,9 +3095,8 @@
             $rv = "$mm$dd$yy";
         }
     }
+    elsif ( $dateformat =~ /^dd/ ) {
 
-    if ( $dateformat =~ /^dd/ ) {
-
         if ($date) {
 
             if ( $date =~ /\D/ ) {

Modified: trunk/LedgerSMB/Locale.pm
===================================================================
--- trunk/LedgerSMB/Locale.pm	2007-05-15 23:15:14 UTC (rev 1199)
+++ trunk/LedgerSMB/Locale.pm	2007-05-16 02:53:40 UTC (rev 1200)
@@ -113,12 +113,10 @@
         if ( $myconfig->{dateformat} =~ /^yy/ ) {
             ( $yy, $mm, $dd ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^mm/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
             ( $mm, $dd, $yy ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^dd/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
             ( $dd, $mm, $yy ) = split /\D/, $date;
         }
 

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-05-15 23:15:14 UTC (rev 1199)
+++ trunk/LedgerSMB.pm	2007-05-16 02:53:40 UTC (rev 1200)
@@ -301,35 +301,30 @@
                 $amount =~ s/,$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1 000.00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1 000.00' ) {
                 $amount =~ s/\d{3,}?/$& /g;
                 $amount =~ s/\s$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq "1'000.00" ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq "1'000.00" ) {
                 $amount =~ s/\d{3,}?/$&'/g;
                 $amount =~ s/'$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= "\.$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1.000,00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1.000,00' ) {
                 $amount =~ s/\d{3,}?/$&./g;
                 $amount =~ s/\.$//;
                 $amount = join '', reverse split //, $amount;
                 $amount .= ",$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1000,00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1000,00' ) {
                 $amount = "$whole";
                 $amount .= ",$dec" if ( $dec ne "" );
-            }
-
-            if ( $myconfig->{numberformat} eq '1000.00' ) {
+            } 
+	    elsif ( $myconfig->{numberformat} eq '1000.00' ) {
                 $amount = "$whole";
                 $amount .= ".$dec" if ( $dec ne "" );
             }
@@ -390,11 +385,10 @@
         $amount =~ s/\.//g;
         $amount =~ s/,/./;
     }
-    if ( $numberformat eq '1 000.00' ) {
+    elsif ( $numberformat eq '1 000.00' ) {
         $amount =~ s/\s//g;
     }
-
-    if ( $numberformat eq "1'000.00" ) {
+    elsif ( $numberformat eq "1'000.00" ) {
         $amount =~ s/'//g;
     }
 
@@ -402,7 +396,7 @@
     if ( $amount =~ s/\((\d*\.?\d*)\)/$1/ ) {
         $amount = $1 * -1;
     }
-    if ( $amount =~ s/(\d*\.?\d*)\s?DR/$1/ ) {
+    elsif ( $amount =~ s/(\d*\.?\d*)\s?DR/$1/ ) {
         $amount = $1 * -1;
     }
     $amount =~ s/\s?CR//;
@@ -486,12 +480,10 @@
         if ( $myconfig->{dateformat} =~ /^yy/ ) {
             ( $yy, $mm, $dd ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^mm/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
             ( $mm, $dd, $yy ) = split /\D/, $date;
         }
-
-        if ( $myconfig->{dateformat} =~ /^dd/ ) {
+        elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
             ( $dd, $mm, $yy ) = split /\D/, $date;
         }
 
@@ -581,7 +573,6 @@
     if ( !scalar @keys ) {
         @keys = keys %{$src};
     }
-    #for my $arg ( keys %$src ) {
     for my $arg ( @keys ) {
         my $dst_arg;
         if ($index) {

Modified: trunk/t/10-form.t
===================================================================
--- trunk/t/10-form.t	2007-05-15 23:15:14 UTC (rev 1199)
+++ trunk/t/10-form.t	2007-05-16 02:53:40 UTC (rev 1200)
@@ -411,3 +411,7 @@
 $form = new Form;
 @r = trap{$form->print_button({'pear' => {'key' => 'P', 'value' => 'Pears'}}, 'pear')};
 is($trap->stdout, "<button class=\"submit\" type=\"submit\" name=\"action\" value=\"pear\" accesskey=\"P\" title=\"Pears [Alt-P]\">Pears</button>\n", 'print_button');
+
+## $form->like checks
+$form = new Form;
+is($form->like('hello world'), '%hello world%', 'like');


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