summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB.pm1
-rw-r--r--LedgerSMB/Form.pm5
-rw-r--r--t/01-load.t3
3 files changed, 6 insertions, 3 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 083ecb8a..6f32167d 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -528,6 +528,7 @@ sub round_amount {
else {
$amount = Math::BigFloat->new($amount)->ffround( -( $places - 1 ) );
}
+ $amount->precision(undef);
return $amount;
}
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 723e86bf..6566b80a 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -1350,6 +1350,9 @@ sub update_balance {
my ( $self, $dbh, $table, $field, $where, $value ) = @_;
+
+ $table = $dbh->quote_identifier($table);
+ $field = $dbh->quote_identifier($field);
# if we have a value, go do it
if ($value) {
@@ -1357,7 +1360,7 @@ sub update_balance {
my $query = "SELECT $field FROM $table WHERE $where FOR UPDATE";
my ($balance) = $dbh->selectrow_array($query);
- $balance += $value;
+ $balance = $dbh->quote($balance + $value);
# update balance
$query = "UPDATE $table SET $field = $balance WHERE $where";
diff --git a/t/01-load.t b/t/01-load.t
index 7a0aaf62..eca72e87 100644
--- a/t/01-load.t
+++ b/t/01-load.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 35;
+use Test::More tests => 34;
use_ok('LedgerSMB');
use_ok('LedgerSMB::AA');
@@ -17,7 +17,6 @@ use_ok('LedgerSMB::HR');
use_ok('LedgerSMB::IC');
use_ok('LedgerSMB::IR');
use_ok('LedgerSMB::IS');
-use_ok('LedgerSMB::Menufile');
use_ok('LedgerSMB::JC');
use_ok('LedgerSMB::Locale');
use_ok('LedgerSMB::Log');