diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-11-09 17:05:36 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-11-09 17:05:36 -0600 |
commit | 96b69dd1aa5c8045b5a4297ecea510d60f575251 (patch) | |
tree | fbe98f788ff92323990e7f778df466c8b0529985 /FS/FS | |
parent | b3c70d709fd646ef355d49a4e87151c99ee413e9 (diff) |
RT#34960: Quotations [changed billpkgnum to quotationpkgnum]
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Schema.pm | 4 | ||||
-rw-r--r-- | FS/FS/TemplateItem_Mixin.pm | 7 | ||||
-rw-r--r-- | FS/FS/quotation_pkg.pm | 23 | ||||
-rw-r--r-- | FS/FS/quotation_pkg_detail.pm | 7 |
4 files changed, 16 insertions, 25 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 6b5d6586c..7880cc10c 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1973,7 +1973,7 @@ sub tables_hashref { 'quotation_pkg_detail' => { 'columns' => [ 'detailnum', 'serial', '', '', '', '', - 'billpkgnum', 'int', '', '', '', '', # actually links to quotationpkgnum + 'quotationpkgnum', 'int', '', '', '', '', 'format', 'char', 'NULL', 1, '', '', # not used for anything 'detail', 'varchar', '', 255, '', '', ], @@ -1981,7 +1981,7 @@ sub tables_hashref { 'unique' => [], 'index' => [ [ 'billpkgnum' ] ], 'foreign_keys' => [ - { columns => [ 'billpkgnum' ], + { columns => [ 'quotationpkgnum' ], table => 'quotation_pkg', references => [ 'quotationpkgnum' ], }, diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm index dcd7ab3fb..248da3cae 100644 --- a/FS/FS/TemplateItem_Mixin.pm +++ b/FS/FS/TemplateItem_Mixin.pm @@ -175,6 +175,7 @@ sub details { my $escape_function = $opt{escape_function} || sub { shift }; my $csv = new Text::CSV_XS; + my $key = $self->primary_key; if ( $opt{format_function} ) { @@ -189,14 +190,14 @@ sub details { ) } qsearch ({ 'table' => $self->detail_table, - 'hashref' => { 'billpkgnum' => $self->billpkgnum }, + 'hashref' => { $key => $self->get($key) }, 'order_by' => 'ORDER BY detailnum', }); } elsif ( $opt{'no_usage'} ) { my $sql = "SELECT detail FROM ". $self->detail_table. - " WHERE billpkgnum = ". $self->billpkgnum. + " WHERE " . $key . " = ". $self->get($key). " AND ( format IS NULL OR format != 'C' ) ". " ORDER BY detailnum"; my $sth = dbh->prepare($sql) or die dbh->errstr; @@ -251,7 +252,7 @@ sub details { } my $sql = "SELECT format, detail FROM ". $self->detail_table. - " WHERE billpkgnum = ". $self->billpkgnum. + " WHERE " . $key . " = ". $self->get($key). " ORDER BY detailnum"; my $sth = dbh->prepare($sql) or die dbh->errstr; $sth->execute or die $sth->errstr; diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm index 49d0d9a5c..e264209ef 100644 --- a/FS/FS/quotation_pkg.pm +++ b/FS/FS/quotation_pkg.pm @@ -101,21 +101,8 @@ sub display_table { 'quotation_pkg'; } # # (for invoice display order) sub discount_table { 'quotation_pkg_discount'; } - -# detail table uses non-quotation fieldnames, see billpkgnum below sub detail_table { 'quotation_pkg_detail'; } -=item billpkgnum - -Sets/returns quotationpkgnum, for ease of integration with TemplateItem_Mixin::details - -=cut - -sub billpkgnum { - my $self = shift; - $self->quotationpkgnum(@_); -} - =item insert Adds this record to the database. If there is an error, returns the error, @@ -380,7 +367,7 @@ sub delete_details { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - foreach my $detail ( qsearch('quotation_pkg_detail',{ 'billpkgnum' => $self->quotationpkgnum }) ) { + foreach my $detail ( qsearch('quotation_pkg_detail',{ 'quotationpkgnum' => $self->quotationpkgnum }) ) { my $error = $detail->delete; if ( $error ) { $dbh->rollback if $oldAutoCommit; @@ -416,8 +403,8 @@ sub set_details { foreach my $detail ( @details ) { my $quotation_pkg_detail = new FS::quotation_pkg_detail { - 'billpkgnum' => $self->quotationpkgnum, - 'detail' => $detail, + 'quotationpkgnum' => $self->quotationpkgnum, + 'detail' => $detail, }; $error = $quotation_pkg_detail->insert; if ( $error ) { @@ -431,6 +418,10 @@ sub set_details { } +sub details_header { + return (); +} + =item cust_bill_pkg_display [ type => TYPE ] =cut diff --git a/FS/FS/quotation_pkg_detail.pm b/FS/FS/quotation_pkg_detail.pm index be3d81529..ce13589f0 100644 --- a/FS/FS/quotation_pkg_detail.pm +++ b/FS/FS/quotation_pkg_detail.pm @@ -34,10 +34,9 @@ currently supported: primary key -=item billpkgnum +=item quotationpkgnum -named thusly for quick compatability with L<FS::TemplateItem_Mixin>, -actually the quotationpkgnum for the relevant L<FS::quotation_pkg> +for the relevant L<FS::quotation_pkg> =item detail @@ -108,7 +107,7 @@ sub check { my $error = $self->ut_numbern('detailnum') - || $self->ut_foreign_key('billpkgnum', 'quotation_pkg', 'quotationpkgnum') + || $self->ut_foreign_key('quotationpkgnum', 'quotation_pkg', 'quotationpkgnum') || $self->ut_text('detail') ; return $error if $error; |