From: ivan Date: Fri, 11 Sep 2009 15:51:38 +0000 (+0000) Subject: fix (hopefully the rest of the) fallout from rating CDRs to sub-penny amounts X-Git-Tag: root_of_svc_elec_features~867 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=539b6216a17a5423431d430022c4e0f9581a9d2f fix (hopefully the rest of the) fallout from rating CDRs to sub-penny amounts --- diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 9a7c4ce7a..52af77bf0 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -559,7 +559,7 @@ sub tables_hashref { 'billpkgnum', 'int', 'NULL', '', '', '', # should not be nullable 'pkgnum', 'int', 'NULL', '', '', '', # deprecated 'invnum', 'int', 'NULL', '', '', '', # deprecated - 'amount', @money_typen, '', '', + 'amount', 'decimal', 'NULL', '10,4', '', '', 'format', 'char', 'NULL', 1, '', '', 'classnum', 'int', 'NULL', '', '', '', 'phonenum', 'varchar', 'NULL', 15, '', '', diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index b6e852897..96f09c915 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -111,7 +111,7 @@ sub insert { return $error; } - if ( defined dbdef->table('cust_bill_pkg_detail') && $self->get('details') ) { + if ( $self->get('details') ) { foreach my $detail ( @{$self->get('details')} ) { my $cust_bill_pkg_detail = new FS::cust_bill_pkg_detail { 'billpkgnum' => $self->billpkgnum, @@ -124,18 +124,18 @@ sub insert { $error = $cust_bill_pkg_detail->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error inserting cust_bill_pkg_detail: $error"; } } } - if ( defined dbdef->table('cust_bill_pkg_display') && $self->get('display') ){ + if ( $self->get('display') ) { foreach my $cust_bill_pkg_display ( @{ $self->get('display') } ) { $cust_bill_pkg_display->billpkgnum($self->billpkgnum); $error = $cust_bill_pkg_display->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error inserting cust_bill_pkg_display: $error"; } } } @@ -146,7 +146,7 @@ sub insert { $error = $cust_tax_exempt_pkg->insert; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error inserting cust_tax_exempt_pkg: $error"; } } } @@ -160,7 +160,7 @@ sub insert { warn $error; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error inserting cust_bill_pkg_tax_location: $error"; } } } @@ -173,7 +173,7 @@ sub insert { warn $error; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error inserting cust_bill_pkg_tax_rate_location: $error"; } } } @@ -185,7 +185,7 @@ sub insert { warn $error; if ( $error ) { $dbh->rollback if $oldAutoCommit; - return $error; + return "error replacing cust_tax_adjustment: $error"; } } diff --git a/FS/FS/cust_bill_pkg_detail.pm b/FS/FS/cust_bill_pkg_detail.pm index 008f3ff77..886944138 100644 --- a/FS/FS/cust_bill_pkg_detail.pm +++ b/FS/FS/cust_bill_pkg_detail.pm @@ -118,7 +118,8 @@ sub check { $self->ut_numbern('detailnum') || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum') - || $self->ut_moneyn('amount') + #|| $self->ut_moneyn('amount') + || $self->ut_float('amount') || $self->ut_enum('format', [ '', 'C' ] ) || $self->ut_text('detail') || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum')