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

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



Revision: 1145
          http://svn.sourceforge.net/ledger-smb/?rev=1145&view=rev
Author:   einhverfr
Date:     2007-05-06 23:02:01 -0700 (Sun, 06 May 2007)

Log Message:
-----------
Applying patch to bugs 1699718 and 1713439

Modified Paths:
--------------
    branches/1.2/LedgerSMB/AA.pm
    branches/1.2/LedgerSMB/AM.pm
    branches/1.2/LedgerSMB/CP.pm
    branches/1.2/LedgerSMB/Form.pm
    branches/1.2/LedgerSMB/IR.pm
    branches/1.2/LedgerSMB/IS.pm
    branches/1.2/LedgerSMB/OE.pm
    branches/1.2/LedgerSMB/PriceMatrix.pm
    branches/1.2/LedgerSMB/RC.pm
    branches/1.2/LedgerSMB/RP.pm
    branches/1.2/UPGRADE

Modified: branches/1.2/LedgerSMB/AA.pm
===================================================================
--- branches/1.2/LedgerSMB/AA.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/AA.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -875,6 +875,7 @@
     $sth->execute(@paidargs) || $form->dberror($query);
 
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+	$form->db_parse_numeric(sth => $sth, hashref => $ref);
         $ref->{exchangerate} = 1 unless $ref->{exchangerate};
 
         if ( $ref->{linetotal} <= 0 ) {
@@ -963,7 +964,7 @@
     $sth->execute(@queryargs) || $form->dberror($query);
 
     $ref = $sth->fetchrow_hashref(NAME_lc);
-
+    $form->db_parse_numeric(sth => $sth, hashref => $ref);
     if ( $form->{id} ) {
         for (qw(currency employee employee_id intnotes)) {
             delete $ref->{$_};
@@ -1028,7 +1029,9 @@
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{"$form->{vc}_id"} ) || $form->dberror($query);
 
-    while ( my ( $amount, $exch ) = $sth->fetchrow_array ) {
+    while ( my @ref = $sth->fetchrow_array ) {
+        $form->db_parse_numeric(sth => $sth, arrayref => ..hidden..);
+        my ($amount, $exch) = @ref;
         $exch = 1 unless $exch;
         $form->{creditremaining} -= $amount * $exch;
     }
@@ -1099,6 +1102,7 @@
     my %a = ();
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth => $sth, hashref => $hashref);
 
         if ( $tax{ $ref->{accno} } ) {
             if ( not exists $a{ $ref->{accno} } ) {

Modified: branches/1.2/LedgerSMB/AM.pm
===================================================================
--- branches/1.2/LedgerSMB/AM.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/AM.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -382,7 +382,7 @@
     }
 
     $sth = $dbh->prepare($query);
-    $sth->execute(@queryargs) || $form->dberror;
+    $sth->execute(@queryargs) || $form->dberror($query);
     $sth->finish;
     $dbh->commit;
 

Modified: branches/1.2/LedgerSMB/CP.pm
===================================================================
--- branches/1.2/LedgerSMB/CP.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/CP.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -499,7 +499,7 @@
             $form->{"paid_$i"} =
               $form->round_amount( $form->{"paid_$i"} * $exchangerate, 2 );
 
-            $pth->execute( $form->{"id_$i"} ) || $form->dberror;
+            $pth->execute( $form->{"id_$i"} ) || $form->dberror($pth->statement);
             ($amount) = $pth->fetchrow_array;
             $pth->finish;
 
@@ -774,7 +774,7 @@
 
             $paid = $form->round_amount( $paid * $exchangerate, 2 );
 
-            $pth->execute( $form->{"id_$i"} ) || $form->dberror;
+            $pth->execute( $form->{"id_$i"} ) || $form->dberror($pth->statement);
             ($amount) = $pth->fetchrow_array;
             $pth->finish;
 

Modified: branches/1.2/LedgerSMB/Form.pm
===================================================================
--- branches/1.2/LedgerSMB/Form.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/Form.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -581,6 +581,25 @@
     return $amount;
 }
 
+sub db_parse_numeric {
+    my $self = shift;
+    my %args = @_;
+    my ($sth, $arrayref, $hashref) = ($args{sth}, $args{arrayref}, 
+          $args{hashref});
+    my @types = @{$sth->{TYPE}};
+    my @names = @{$sth->{NAME_lc}};
+    for (0 .. $#names){
+        if ($types[$_] == 3){
+            $arrayref[$_] = Math::BigFloat->new($arrayref[$_]) 
+              if defined $arrayref;
+            $hashref->{$names[$_]} = Math::BigFloat->new($hashref->{$names[$_]})
+              if defined $hashref;
+        }
+
+    }
+    return ($hashref || $arrayref);
+}
+
 sub callproc {
     my $procname = shift @_;
     my $argstr   = "";
@@ -1414,7 +1433,7 @@
 
         $mm--;
 
-        @t = localtime( timelocal( 0, 0, 0, $dd, $mm, $yy ) + $diff );
+        @t = localtime( Time::Local::timelocal( 0, 0, 0, $dd, $mm, $yy ) + $diff );
 
         $t[4]++;
         $mm = substr( "0$t[4]", -2 );
@@ -1739,6 +1758,7 @@
         $sth->execute( $curr, $transdate );
 
         ($exchangerate) = $sth->fetchrow_array;
+	$exchangerate = Math::BigFloat->new($exchangerate);
     }
 
     $sth->finish;
@@ -2184,6 +2204,10 @@
     # get last customers or vendors
     my ( $query, $sth );
 
+    if (!$self->{dbh}) {
+        $self->db_init($myconfig);
+    }
+
     $dbh = $self->{dbh};
 
     my %xkeyref = ();
@@ -2245,6 +2269,7 @@
         $sth->execute( $self->{id} ) || $self->dberror($query);
 
         $ref = $sth->fetchrow_hashref(NAME_lc);
+        $self->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
         foreach $key ( keys %$ref ) {
             $self->{$key} = $ref->{$key};
@@ -2720,19 +2745,19 @@
     $query = qq|DELETE FROM recurring
 				 WHERE id = ?|;
 
-    $sth = $dbh->prepare($query);
+    $sth = $dbh->prepare($query) || $self->dberror($query);
     $sth->execute( $self->{id} ) || $self->dberror($query);
 
     $query = qq|DELETE FROM recurringemail
 				 WHERE id = ?|;
 
-    $sth = $dbh->prepare($query);
+    $sth = $dbh->prepare($query) || $self->dberror($query);
     $sth->execute( $self->{id} ) || $self->dberror($query);
 
     $query = qq|DELETE FROM recurringprint
 				 WHERE id = ?|;
 
-    $sth = $dbh->prepare($query);
+    $sth = $dbh->prepare($query) || $self->dberror($query);
     $sth->execute( $self->{id} ) || $self->dberror($query);
 
     if ( $self->{recurring} ) {
@@ -2763,10 +2788,10 @@
 
         # calculate nextdate
         $query = qq|
-			SELECT current_date - date ? AS a,
-				date ? - current_date AS b|;
+			SELECT current_date - ?::date AS a,
+				?::date - current_date AS b|;
 
-        $sth = $dbh->prepare($query);
+        $sth = $dbh->prepare($query) || $self->dberror($query);
         $sth->execute( $s{startdate}, $enddate );
         my ( $a, $b ) = $sth->fetchrow_array;
 
@@ -2782,16 +2807,9 @@
         my $nextdate = $enddate;
         if ( $advance > 0 ) {
             if ( $advance < ( $s{repeat} * $s{howmany} ) ) {
-                %interval = (
-                    'Pg' =>
-                      "(date '$s{startdate}' + interval '$advance $s{unit}')",
-                    'DB2' => qq|(date ('$s{startdate}') + "$advance $s{unit}")|,
-                );
 
-                $interval{Oracle} = $interval{PgPP} = $interval{Pg};
+                $query = qq|SELECT (date '$s{startdate}' + interval '$advance $s{unit}')|;
 
-                $query = qq|SELECT $interval{$myconfig->{dbdriver}}|;
-
                 ($nextdate) = $dbh->selectrow_array($query);
             }
 
@@ -3269,7 +3287,7 @@
                         $sth->bind_param( $i++, $newtrail{$key}{$_} );
                     }
                     $sth->bind_param( $i++, $employee_id );
-                    $sth->execute || $self->dberror;
+                    $sth->execute() || $self->dberror($query);
                     $sth->finish;
                 }
             }

Modified: branches/1.2/LedgerSMB/IR.pm
===================================================================
--- branches/1.2/LedgerSMB/IR.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/IR.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -337,6 +337,7 @@
                 my $totalqty = $form->{"qty_$i"};
 
                 while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+                    $form->db_parse_numeric(sth=>$sth, hashref => $ref);
 
                     my $qty = $ref->{qty} + $ref->{allocated};
 
@@ -1034,6 +1035,7 @@
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
         $ref = $sth->fetchrow_hashref(NAME_lc);
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         for ( keys %$ref ) {
             $form->{$_} = $ref->{$_};
         }
@@ -1093,6 +1095,7 @@
         my $ptref;
 
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
             my ($dec) = ( $ref->{fxsellprice} =~ /\.(\d+)/ );
             $dec = length $dec;
@@ -1103,6 +1106,7 @@
             my $taxrate = 0;
 
             while ( $ptref = $tth->fetchrow_hashref(NAME_lc) ) {
+                $form->db_parse_numeric(sth => $tth, hashref => $ptref);
                 $ref->{taxaccounts} .= "$ptref->{accno} ";
                 $taxrate += $form->{"$ptref->{accno}_rate"};
             }
@@ -1215,6 +1219,7 @@
     my $ptref;
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
         my ($dec) = ( $ref->{sellprice} =~ /\.(\d+)/ );
         $dec = length $dec;
@@ -1277,7 +1282,9 @@
     # get exchange rates for transdate or max
     foreach $var ( split /:/, substr( $form->{currencies}, 4 ) ) {
         $eth1->execute( $var, $form->{transdate} );
-        ( $form->{$var} ) = $eth1->fetchrow_array;
+        @array = $eth1->fetchrow_array;
+	$form->db_parse_numeric(sth=> $eth1, arrayref=>..hidden..);
+        $form->{$var} = shift @array;
         if ( !$form->{$var} ) {
             $eth2->execute($var);
 

Modified: branches/1.2/LedgerSMB/IS.pm
===================================================================
--- branches/1.2/LedgerSMB/IS.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/IS.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -1516,6 +1516,7 @@
     my $qty;
 
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+	$form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         if ( ( $qty = ( ( $ref->{qty} * -1 ) - $ref->{allocated} ) ) >
             $totalqty )
         {
@@ -1751,6 +1752,7 @@
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
         $ref = $sth->fetchrow_hashref(NAME_lc);
+        $form->db_parse_numeric(sth=> $sth, hashref=>$ref_);
         for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
         $sth->finish;
 
@@ -1808,7 +1810,7 @@
         my $ptref;
 
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
-
+            $form->db_parse_numeric(sth=>$sth, hashref => $ref);
             my ($dec) = ( $ref->{fxsellprice} =~ /\.(\d+)/ );
             $dec = length $dec;
             my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
@@ -1935,6 +1937,7 @@
     my $transdate = $form->datetonum( $myconfig, $form->{transdate} );
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth => $sth, hashref => $ref);
 
         my ($dec) = ( $ref->{sellprice} =~ /\.(\d+)/ );
         $dec = length $dec;

Modified: branches/1.2/LedgerSMB/OE.pm
===================================================================
--- branches/1.2/LedgerSMB/OE.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/OE.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -220,6 +220,7 @@
 
     my %oid = ();
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+	$form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $ref->{exchangerate} = 1 unless $ref->{exchangerate};
         if ( $ref->{id} != $oid{id}{ $ref->{id} } ) {
             push @{ $form->{OE} }, $ref;
@@ -774,6 +775,7 @@
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
         $ref = $sth->fetchrow_hashref(NAME_lc);
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
         $sth->finish;
 
@@ -848,6 +850,7 @@
         my $listprice;
 
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
             ($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ );
             $decimalplaces = length $decimalplaces;
@@ -941,11 +944,16 @@
     # get exchange rates for transdate or max
     foreach $var ( split /:/, substr( $form->{currencies}, 4 ) ) {
         $eth1->execute( $var, $form->{transdate} );
-        ( $form->{$var} ) = $eth1->fetchrow_array;
+        my @exchangelist;
+        @exchangelist = $eth1->fetchrow_array;
+        $form->db_parse_numeric(sth=>$eth1, arrayref=>..hidden..);
+        $form->{$var} = shift @array;
         if ( !$form->{$var} ) {
             $eth2->execute($var);
+            @exchangelist = $eth2->fetchrow_array;
+            $form->db_parse_numeric(sth=>$eth2, arrayref=>..hidden..);
 
-            ( $form->{$var} ) = $eth2->fetchrow_array;
+            ( $form->{$var} ) = @exchangelist; 
             ( $null, $form->{$var} ) = split / /, $form->{$var};
             $form->{$var} = 1 unless $form->{$var};
             $eth2->finish;
@@ -1116,7 +1124,10 @@
             $sth->execute( $form->{"id_$i"}, $form->{warehouse_id} )
               || $form->dberror;
 
-            ($qty) = $sth->fetchrow_array;
+            my @qtylist = $sth->fetchrow_array;
+            $form->db_parse_numeric(sth=>$sth, arrayref=>..hidden..);
+
+            ($qty) = @qtylist; $sth->fetchrow_array;
             $sth->finish;
 
             $form->{"qty_$i"} = 0 if $qty == 0;
@@ -1604,6 +1615,7 @@
     $sth->execute($id) || $form->dberror($query);
 
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
         for (qw(partnumber description partsgroup)) {
             $form->{"a_$_"} = $ref->{$_};
@@ -1773,7 +1785,9 @@
             $wth->execute( $form->{"id_$i"}, $warehouse_id )
               || $form->dberror;
 
-            ($qty) = $wth->fetchrow_array;
+            @qtylist = $wth->fetchrow_array;
+            $form->db_parse_numeric(sth=>$wth, arrayref=>..hidden..);
+            ($qty) = @qtylist;
             $wth->finish;
 
             if ( $ship > $qty ) {
@@ -2065,6 +2079,7 @@
     $sth->execute || $form->dberror($query);
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $ref->{qty} = $ref->{onhand} - $ref->{qty};
         push @{ $form->{all_inventory} }, $ref if $ref->{qty} > 0;
     }
@@ -2152,6 +2167,7 @@
             $sth->execute( $form->{"ndx_$i"} );
 
             while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+                $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
                 &add_items_required( "", $dbh, $form, $ref->{id},
                     $ref->{required}, $ref->{assembly} );
             }
@@ -2187,6 +2203,7 @@
         $sth->execute || $form->dberror($query);
 
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=> $sth, hashref=> $ref);
             &add_items_required( "", $dbh, $form, $ref->{id},
                 $required * $ref->{qty},
                 $ref->{assembly} );
@@ -2203,6 +2220,7 @@
         $sth = $dbh->prepare($query);
         $sth->execute($parts_id) || $form->dberror($query);
         $ref = $sth->fetchrow_hashref(NAME_lc);
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         for ( keys %$ref ) {
             $form->{orderitems}{$parts_id}{$_} = $ref->{$_};
         }
@@ -2291,6 +2309,7 @@
         $sth = $dbh->prepare($query);
         $sth->execute($vendor_id) || $form->dberror($query);
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=>$sth, hashref=> $ref);
             $curr                 = $ref->{curr};
             $taxincluded          = $ref->{taxincluded};
             $tax{ $ref->{accno} } = $ref->{rate};

Modified: branches/1.2/LedgerSMB/PriceMatrix.pm
===================================================================
--- branches/1.2/LedgerSMB/PriceMatrix.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/PriceMatrix.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -122,6 +122,7 @@
 
         while ( $mref = $pmh->fetchrow_hashref(NAME_lc) ) {
 
+            $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
             # check date
             if ( $mref->{validfrom} ) {
                 next
@@ -193,6 +194,7 @@
         $pmh->execute( $ref->{id} );
 
         $mref = $pmh->fetchrow_hashref(NAME_lc);
+        $form->db_parse_numeric(sth=>$sth, hashref=>$mref);
 
         if ( $mref->{partnumber} ne "" ) {
             $ref->{partnumber} = $mref->{partnumber};

Modified: branches/1.2/LedgerSMB/RC.pm
===================================================================
--- branches/1.2/LedgerSMB/RC.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/RC.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -53,6 +53,7 @@
     my $sth = $dbh->prepare($query);
     $sth->execute( $pos_config{till_accno} ) || $form->dberror($query);
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         push @{ $form->{TB} }, $ref;
     }
     $sth->finish;
@@ -64,6 +65,7 @@
     my $sth = $dbh->prepare($query);
     $sth->execute( $pos_config{till_accno} ) || $form->dberror($query);
     my $ref = $sth->fetchrow_hashref(NAME_lc);
+    $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
     $form->{sum} = $ref->{sum};
     $sth->finish;
 }
@@ -101,6 +103,7 @@
     my $sth = $dbh->prepare($query);
     $sth->execute( $form->{accno} ) || $form->dberror($query);
     my $ref = $sth->fetchrow_hashref(NAME_lc);
+    $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
     $form->{balance} = $ref->{balance};
 }
 
@@ -162,7 +165,9 @@
 		 WHERE ch.accno = ? $transdate $cleared |;
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{accno} );
-    ( $form->{beginningbalance} ) = $sth->fetchrow_array();
+    my @balancelist = $sth->fetchrow_array();
+    $form->db_parse_numeric(sth=>$sth, arraylist=>..hidden..);
+    ( $form->{beginningbalance} ) = @balancelist;
 
     $query = qq|
 		SELECT sum(ac.amount)
@@ -173,7 +178,9 @@
 
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{accno} );
-    ( $form->{fx_balance} ) = $sth->fetchrow_array();
+    @balancelist = $sth->fetchrow_array();
+    $form->db_parse_numeric(sth=>$sth, arraylist=>..hidden..);
+    ( $form->{fx_balance} ) = @balancelist;
 
     $transdate = "";
     if ( $form->{todate} ) {
@@ -190,7 +197,9 @@
 
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{accno} );
-    ( $form->{endingbalance} ) = $sth->fetchrow_array();
+    @balancelist = $sth->fetchrow_array();
+    $form->db_parse_numeric(sth=>$sth, arraylist=>..hidden..);
+    ( $form->{endingbalance} ) = @balancelist;
 
     # fx balance
     $query = qq|
@@ -201,7 +210,9 @@
 
     $sth = $dbh->prepare($query);
     $sth->execute( $form->{accno} );
-    ( $form->{fx_endingbalance} ) = $sth->fetchrow_array();
+    @balancelist = $sth->fetchrow_array();
+    $form->db_parse_numeric(sth=>$sth, arraylist=>..hidden..);
+    ( $form->{fx_endingbalance} ) = @balancelist;
 
     $cleared = qq| AND ac.cleared = '0'| unless $form->{fromdate};
 
@@ -392,6 +403,7 @@
     my $ref;
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
         if ( $form->{summary} ) {
 

Modified: branches/1.2/LedgerSMB/RP.pm
===================================================================
--- branches/1.2/LedgerSMB/RP.pm	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/LedgerSMB/RP.pm	2007-05-07 06:02:01 UTC (rev 1145)
@@ -91,6 +91,7 @@
     $sth->execute() || $form->dberror($query);
     @cols = qw(description sold revenue partnumber received expense);
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $ref->{net_income} = $ref->{revenue} - $ref->{expense};
         map { $ref->{$_} =~ s/^\s*// } @cols;
         map { $ref->{$_} =~ s/\s*$// } @cols;
@@ -1224,6 +1225,7 @@
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
 
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         # get last heading account
         @accno = grep { $_ le "$ref->{accno}" } @headingaccounts;
         $accno = pop @accno;
@@ -1347,6 +1349,7 @@
         $sth->execute || $form->dberror($query);
 
         while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
             $ref->{amount} = $form->round_amount( $ref->{amount}, 2 );
             $balance{ $ref->{accno} } = $ref->{amount};
 
@@ -1381,6 +1384,7 @@
     $sth->execute || $form->dberror($query);
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $trb{ $ref->{accno} }{description} = $ref->{description};
         $trb{ $ref->{accno} }{charttype}   = 'H';
         $trb{ $ref->{accno} }{category}    = $ref->{category};
@@ -1472,6 +1476,7 @@
 
     # calculate debit and credit for the period
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $trb{ $ref->{accno} }{description} = $ref->{description};
         $trb{ $ref->{accno} }{charttype}   = 'A';
         $trb{ $ref->{accno} }{category}    = $ref->{category};
@@ -1511,7 +1516,9 @@
                   || $form->dberror($query);
 
                 ( $debit, $credit ) = ( 0, 0 );
-                while ( ( $debit, $credit ) = $drcr->fetchrow_array ) {
+                while ( my @drcrlist = $drcr->fetchrow_array ) {
+                    $form->db_parse_numeric(sth=>$drcr, arrayref=>..hidden..);
+                    ($debit, $credit) = @drcrlist;
                     $ref->{debit}  += $debit;
                     $ref->{credit} += $credit;
                 }
@@ -1758,6 +1765,7 @@
                 $sth->execute(@var);
 
                 while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+		    $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
                     $ref->{module} =
                       ( $ref->{invoice} )
                       ? $invoice
@@ -1780,6 +1788,7 @@
     $sth->execute || $form->dberror($query);
 
     while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         push @{ $form->{all_language} }, $ref;
     }
     $sth->finish;
@@ -2197,6 +2206,7 @@
     $sth->execute || $form->dberror($query);
 
     while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+        $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
         $ref->{tax} = $form->round_amount( $ref->{tax}, 2 );
         if ( $form->{report} =~ /nontaxable/ ) {
             push @{ $form->{TR} }, $ref if $ref->{netamount};
@@ -2368,6 +2378,7 @@
         $sth->execute || $form->dberror($query);
 
         while ( my $pr = $sth->fetchrow_hashref(NAME_lc) ) {
+            $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
             push @{ $form->{ $ref->{id} } }, $pr;
         }
         $sth->finish;

Modified: branches/1.2/UPGRADE
===================================================================
--- branches/1.2/UPGRADE	2007-05-07 04:57:35 UTC (rev 1144)
+++ branches/1.2/UPGRADE	2007-05-07 06:02:01 UTC (rev 1145)
@@ -56,8 +56,12 @@
 
   a) cd to the sql/legacy/ directory of the new ledger directory
   b) run "psql" with appropriate options to connect to your database.
-  c) Note the db version by running the following query:
-     "SELECT version FROM defaults;"
+  c) Note the db schema version by running the following query:
+     "SELECT value from defaults where setting_key = 'version';" (1.2.0 or 
+     later)
+       or
+     "SELECT version FROM defaults;" (SQL-Ledger 2.6.x or LedgerSMB 1.1.x 
+     or earlier)
   d) Run the SQL upgrade scripts in order starting with the one whose name
      begins with "Pg-upgrade-[version]" (each of these scripts will upgrade to
      the next database version which is also identified in the file name).


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