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

SF.net SVN: ledger-smb:[5798] branches/1.3



Revision: 5798
          http://sourceforge.net/p/ledger-smb/code/5798
Author:   einhverfr
Date:     2013-05-16 08:25:55 +0000 (Thu, 16 May 2013)
Log Message:
-----------
Correcting ordering and selection of departments, bug 810

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/LedgerSMB/Setting.pm

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2013-05-16 07:59:28 UTC (rev 5797)
+++ branches/1.3/Changelog	2013-05-16 08:25:55 UTC (rev 5798)
@@ -2,6 +2,9 @@
 Initial Release:  Monday, Oct 12 2011
 Supported Presently
 
+Changelog for 1.3.33
+* Fixed <?lsmb YYMMMDD ?> interpolation in settings (Chris T)
+
 Changelog for 1.3.32
 * Fixed em-dash handling for pdfs (Chris T)
 * Fixed multiple blank line handling for pdfs (Chris T)

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2013-05-16 07:59:28 UTC (rev 5797)
+++ branches/1.3/LedgerSMB/Form.pm	2013-05-16 08:25:55 UTC (rev 5798)
@@ -2372,13 +2372,8 @@
     my $query = qq|SELECT id, description
 					 FROM department
 					WHERE $where
-				 ORDER BY id|;
+				 ORDER BY description|;
 
-#temporary
- $query = qq|SELECT id, description
-					 FROM department
-				 ORDER BY id|;
-#end
 
     my $sth = $dbh->prepare($query);
     $sth->execute || $self->dberror($query);
@@ -3572,22 +3567,17 @@
             }
 
             if ( $param =~ /<\?lsmb (yy|mm|dd)/i ) {
-                my $test_param = $1;
 		# SC: XXX Does this even work anymore?
                 my $p = $param;
-                $p =~ s/(<|>|%)//g;
-                my $spc = $p;
-                $spc =~ s/\w//g;
-                $spc = substr( $spc, 0, 1 );
+                $p =~ s/lsmb//;
+                $p =~ s/[^YyMmDd]//g;
                 my %d = ( yy => 1, mm => 2, dd => 3 );
-                my @p = ();
+                my $str = $p;
 
                 my @a = $self->split_date( $myconfig->{dateformat},
                     $self->{transdate} );
-                for my $k( sort keys %d ) { push @p, $a[ $d{$k} ] 
-                                 if ( $param =~ /$k/i ) }
-                $str = join $spc, @p;
-                $var =~ s/<\?lsmb $test_param \?>/$str/i;
+                for my $k( keys %d ) { $str =~ s/$k/$a[ $d{$k} ]/i}
+                $var =~ s/\Q$param\E/$str/i;
             }
 
             if ( $param =~ /<\?lsmb curr/i ) {
@@ -3607,7 +3597,7 @@
 
     $self->{dbh}->commit if !defined $nocommit;
 
-    $var;
+    return $var;
 }
 
 =item $form->db_prepare_vars(var1, var2, ..., varI<n>)
@@ -3656,6 +3646,7 @@
         $mm = substr( "0$mm", -2 );
         $dd = substr( "0$dd", -2 );
     }
+    $dateformat = 'yyyy-mm-dd' if $date =~ /\d{4}\D\d{2}\D\d{2}/;
 
     if ( $dateformat =~ /^yy/ ) {
 

Modified: branches/1.3/LedgerSMB/Setting.pm
===================================================================
--- branches/1.3/LedgerSMB/Setting.pm	2013-05-16 07:59:28 UTC (rev 5797)
+++ branches/1.3/LedgerSMB/Setting.pm	2013-05-16 08:25:55 UTC (rev 5798)
@@ -138,20 +138,17 @@
             }
 
             if ( $param =~ /<\?lsmb (yy|mm|dd)/i ) {
-
+		# SC: XXX Does this even work anymore?
                 my $p = $param;
-                $p =~ s/(<|>|%)//g;
-                my $spc = $p;
-                $spc =~ s/\w//g;
-                $spc = substr( $spc, 0, 1 );
+                $p =~ s/lsmb//;
+                $p =~ s/[^YyMmDd]//g;
                 my %d = ( yy => 1, mm => 2, dd => 3 );
-                my @p = ();
+                my $str = $p;
 
                 my @a = $self->split_date( $myconfig->{dateformat},
                     $self->{transdate} );
-                for ( sort keys %d ) { push @p, $a[ $d{$_} ] if ( $p =~ /$_/ ) }
-                $str = join $spc, @p;
-                $var =~ s/$param/$str/;
+                for my $k( keys %d ) { $str =~ s/$k/$a[ $d{$k} ]/i}
+                $var =~ s/\Q$param\E/$str/i;
             }
 
             if ( $param =~ /<\?lsmb curr/i ) {

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