X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fquotation_pkg.pm;h=1e5a0da5169b73a7b2284728a2819f6140aede65;hb=9db332d80967969856c5b5fe8b6ac91304734b04;hp=49d0d9a5cffe5800a9e0e44cdde1ac1f9b28a895;hpb=3888fd6d1902f93c19d62df186e04617357f58c5;p=freeside.git diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm index 49d0d9a5c..1e5a0da51 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; @@ -393,16 +380,27 @@ sub delete_details { } -=item set_details [ DETAIL, DETAIL, ... ] +=item set_details PARAM -Sets quotation details for this package (see L). +Sets new quotation details for this package (see L), +removing existing details. + +Recognizes the following parameters: + +details - arrayref of strings, one for each new detail + +copy_on_order - if true, sets copy_on_order flag on new details If there is an error, returns the error, otherwise returns false. =cut sub set_details { - my( $self, @details ) = @_; + my $self = shift; + my %opt = @_; + + $opt{'details'} ||= []; + my @details = @{$opt{'details'}}; my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; @@ -416,8 +414,9 @@ 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, + 'copy_on_order' => $opt{'copy_on_order'} ? 'Y' : '', }; $error = $quotation_pkg_detail->insert; if ( $error ) { @@ -431,6 +430,10 @@ sub set_details { } +sub details_header { + return (); +} + =item cust_bill_pkg_display [ type => TYPE ] =cut