summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/CT.pm3
-rwxr-xr-xLedgerSMB/Form.pm4
-rwxr-xr-xbin/io.pl2
-rwxr-xr-xsql/Pg-tables.sql2
-rw-r--r--sql/Pg-upgrade-2.6.18-2.6.19.sql2
5 files changed, 9 insertions, 4 deletions
diff --git a/LedgerSMB/CT.pm b/LedgerSMB/CT.pm
index 6154748b..8662e657 100755
--- a/LedgerSMB/CT.pm
+++ b/LedgerSMB/CT.pm
@@ -208,6 +208,9 @@ sub save_customer {
$form->{terms} *= 1;
$form->{taxincluded} *= 1;
$form->{creditlimit} = $form->parse_amount($myconfig, $form->{creditlimit});
+ if (!$form->{creditlimit}){
+ $form->{creditlimit} = 0;
+ }
if ($form->{id}) {
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 94a96dc0..a917943e 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -490,6 +490,10 @@ sub parse_amount {
my ($self, $myconfig, $amount) = @_;
+ if ($amount eq '') {
+ return undef;
+ }
+
if (UNIVERSAL::isa($amount, 'Math::BigFloat')){ # Amount may not be an object
return $amount;
}
diff --git a/bin/io.pl b/bin/io.pl
index 8243272f..fb657484 100755
--- a/bin/io.pl
+++ b/bin/io.pl
@@ -120,7 +120,7 @@ sub display_row {
}
- push @column_index, qw(unit sellprice discount linetotal);
+ push @column_index, qw(unit onhand sellprice discount linetotal);
my $colspan = $#column_index + 1;
diff --git a/sql/Pg-tables.sql b/sql/Pg-tables.sql
index 32dffb9a..59e60248 100755
--- a/sql/Pg-tables.sql
+++ b/sql/Pg-tables.sql
@@ -78,7 +78,7 @@ CREATE TABLE defaults (
);
--
CREATE TABLE acc_trans (
- trans_id int REFERENCES transactions(id),
+ trans_id int,
chart_id int NOT NULL REFERENCES chart (id),
amount NUMERIC,
transdate date DEFAULT current_date,
diff --git a/sql/Pg-upgrade-2.6.18-2.6.19.sql b/sql/Pg-upgrade-2.6.18-2.6.19.sql
index d8e304f3..b60aadac 100644
--- a/sql/Pg-upgrade-2.6.18-2.6.19.sql
+++ b/sql/Pg-upgrade-2.6.18-2.6.19.sql
@@ -1,5 +1,3 @@
-ALTER TABLE acc_trans ADD FOREIGN KEY (trans_id) REFERENCES transactions (id);
-
ALTER TABLE ap ADD PRIMARY KEY (id);
ALTER TABLE ar ADD PRIMARY KEY (id);