summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB.pm2
-rw-r--r--LedgerSMB/AA.pm8
-rw-r--r--LedgerSMB/AM.pm2
-rw-r--r--LedgerSMB/CP.pm4
-rw-r--r--LedgerSMB/Form.pm50
-rw-r--r--LedgerSMB/IR.pm9
-rw-r--r--LedgerSMB/IS.pm5
-rw-r--r--LedgerSMB/OE.pm27
-rw-r--r--LedgerSMB/PriceMatrix.pm2
-rw-r--r--LedgerSMB/RC.pm20
-rw-r--r--LedgerSMB/RP.pm13
-rw-r--r--UPGRADE8
12 files changed, 115 insertions, 35 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 9f3ac71d..b4f8316a 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -438,7 +438,7 @@ sub call_procedure {
my @names = @{$sth->{NAME_lc}};
while ( my $ref = $sth->fetchrow_hashref('NAME_lc') ) {
for (0 .. $#names){
- if ($types[$_] eq 'NUMERIC'){
+ if ($types[$_] == 3){
$ref->{$names[$_]} = Math::BigFloat->new($ref->{$names[$_]});
}
}
diff --git a/LedgerSMB/AA.pm b/LedgerSMB/AA.pm
index dde35958..072e97d6 100644
--- a/LedgerSMB/AA.pm
+++ b/LedgerSMB/AA.pm
@@ -875,6 +875,7 @@ sub transactions {
$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 @@ sub get_name {
$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 @@ sub get_name {
$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 => \@ref);
+ my ($amount, $exch) = @ref;
$exch = 1 unless $exch;
$form->{creditremaining} -= $amount * $exch;
}
@@ -1099,6 +1102,7 @@ sub get_name {
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} } ) {
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 696b370b..3a5fae94 100644
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -382,7 +382,7 @@ sub save_gifi {
}
$sth = $dbh->prepare($query);
- $sth->execute(@queryargs) || $form->dberror;
+ $sth->execute(@queryargs) || $form->dberror($query);
$sth->finish;
$dbh->commit;
diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm
index 7c2d3b45..6dd6df43 100644
--- a/LedgerSMB/CP.pm
+++ b/LedgerSMB/CP.pm
@@ -499,7 +499,7 @@ sub post_payment {
$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 @@ sub post_payments {
$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;
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 955f6310..e19e3f43 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -585,6 +585,25 @@ sub round_amount {
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 = "";
@@ -1407,7 +1426,7 @@ sub add_date {
$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 );
@@ -1732,6 +1751,7 @@ sub get_exchangerate {
$sth->execute( $curr, $transdate );
($exchangerate) = $sth->fetchrow_array;
+ $exchangerate = Math::BigFloat->new($exchangerate);
}
$sth->finish;
@@ -2177,6 +2197,10 @@ sub create_links {
# get last customers or vendors
my ( $query, $sth );
+ if (!$self->{dbh}) {
+ $self->db_init($myconfig);
+ }
+
$dbh = $self->{dbh};
my %xkeyref = ();
@@ -2238,6 +2262,7 @@ sub create_links {
$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};
@@ -2713,19 +2738,19 @@ sub save_recurring {
$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} ) {
@@ -2756,10 +2781,10 @@ sub save_recurring {
# 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;
@@ -2775,15 +2800,8 @@ sub save_recurring {
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 $interval{$myconfig->{dbdriver}}|;
+ $query = qq|SELECT (date '$s{startdate}' + interval '$advance $s{unit}')|;
($nextdate) = $dbh->selectrow_array($query);
}
@@ -3262,7 +3280,7 @@ sub audittrail {
$sth->bind_param( $i++, $newtrail{$key}{$_} );
}
$sth->bind_param( $i++, $employee_id );
- $sth->execute || $self->dberror;
+ $sth->execute() || $self->dberror($query);
$sth->finish;
}
}
diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm
index 8523b870..714acf61 100644
--- a/LedgerSMB/IR.pm
+++ b/LedgerSMB/IR.pm
@@ -337,6 +337,7 @@ sub post_invoice {
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 @@ sub retrieve_invoice {
$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 @@ sub retrieve_invoice {
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 @@ sub retrieve_invoice {
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 @@ sub retrieve_item {
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 @@ sub exchangerate_defaults {
# 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=>\@array);
+ $form->{$var} = shift @array;
if ( !$form->{$var} ) {
$eth2->execute($var);
diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm
index 12e6941a..e3b8d03c 100644
--- a/LedgerSMB/IS.pm
+++ b/LedgerSMB/IS.pm
@@ -1516,6 +1516,7 @@ sub cogs {
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 @@ sub retrieve_invoice {
$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 @@ sub retrieve_invoice {
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 @@ sub retrieve_item {
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;
diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm
index b1256130..2d1e39ec 100644
--- a/LedgerSMB/OE.pm
+++ b/LedgerSMB/OE.pm
@@ -220,6 +220,7 @@ sub transactions {
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 @@ sub retrieve {
$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 @@ sub retrieve {
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 @@ sub exchangerate_defaults {
# 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=>\@exchangelist);
+ $form->{$var} = shift @array;
if ( !$form->{$var} ) {
$eth2->execute($var);
+ @exchangelist = $eth2->fetchrow_array;
+ $form->db_parse_numeric(sth=>$eth2, arrayref=>\@exchangelist);
- ( $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 @@ sub order_details {
$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=>\@qtylist);
+
+ ($qty) = @qtylist; $sth->fetchrow_array;
$sth->finish;
$form->{"qty_$i"} = 0 if $qty == 0;
@@ -1604,6 +1615,7 @@ sub assembly_details {
$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->{$_};
@@ -1774,7 +1786,9 @@ sub save_inventory {
$wth->execute( $form->{"id_$i"}, $warehouse_id )
|| $form->dberror;
- ($qty) = $wth->fetchrow_array;
+ @qtylist = $wth->fetchrow_array;
+ $form->db_parse_numeric(sth=>$wth, arrayref=>\@qtylist);
+ ($qty) = @qtylist;
$wth->finish;
if ( $ship > $qty ) {
@@ -2066,6 +2080,7 @@ sub get_inventory {
$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;
}
@@ -2153,6 +2168,7 @@ sub get_soparts {
$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} );
}
@@ -2188,6 +2204,7 @@ sub add_items_required {
$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} );
@@ -2204,6 +2221,7 @@ sub add_items_required {
$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->{$_};
}
@@ -2292,6 +2310,7 @@ sub generate_orders {
$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};
diff --git a/LedgerSMB/PriceMatrix.pm b/LedgerSMB/PriceMatrix.pm
index 68fa5b12..2c6cc332 100644
--- a/LedgerSMB/PriceMatrix.pm
+++ b/LedgerSMB/PriceMatrix.pm
@@ -122,6 +122,7 @@ sub price_matrix {
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 @@ sub price_matrix {
$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};
diff --git a/LedgerSMB/RC.pm b/LedgerSMB/RC.pm
index a7aa1d1f..6ffc16bf 100644
--- a/LedgerSMB/RC.pm
+++ b/LedgerSMB/RC.pm
@@ -53,6 +53,7 @@ sub getposlines {
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 @@ sub getposlines {
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 @@ sub getbalance {
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 @@ sub payment_transactions {
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=>\@balancelist);
+ ( $form->{beginningbalance} ) = @balancelist;
$query = qq|
SELECT sum(ac.amount)
@@ -173,7 +178,9 @@ sub payment_transactions {
$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=>\@balancelist);
+ ( $form->{fx_balance} ) = @balancelist;
$transdate = "";
if ( $form->{todate} ) {
@@ -190,7 +197,9 @@ sub payment_transactions {
$sth = $dbh->prepare($query);
$sth->execute( $form->{accno} );
- ( $form->{endingbalance} ) = $sth->fetchrow_array();
+ @balancelist = $sth->fetchrow_array();
+ $form->db_parse_numeric(sth=>$sth, arraylist=>\@balancelist);
+ ( $form->{endingbalance} ) = @balancelist;
# fx balance
$query = qq|
@@ -201,7 +210,9 @@ sub payment_transactions {
$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=>\@balancelist);
+ ( $form->{fx_endingbalance} ) = @balancelist;
$cleared = qq| AND ac.cleared = '0'| unless $form->{fromdate};
@@ -392,6 +403,7 @@ sub payment_transactions {
my $ref;
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+ $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
if ( $form->{summary} ) {
diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm
index 797488d0..0697675c 100644
--- a/LedgerSMB/RP.pm
+++ b/LedgerSMB/RP.pm
@@ -91,6 +91,7 @@ sub inventory_activity {
$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 @@ sub get_accounts {
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 @@ sub trial_balance {
$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 @@ sub trial_balance {
$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 @@ sub trial_balance {
# 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 @@ sub trial_balance {
|| $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=>\@drcrlist);
+ ($debit, $credit) = @drcrlist;
$ref->{debit} += $debit;
$ref->{credit} += $credit;
}
@@ -1758,6 +1765,7 @@ sub aging {
$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 @@ sub aging {
$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 @@ sub tax_report {
$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 @@ sub payments {
$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;
diff --git a/UPGRADE b/UPGRADE
index 1d7bcee6..db691f9d 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -53,8 +53,12 @@ and may not be required in all circumstances. These include:
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).