use FS::cust_bill;
use FS::cust_bill_pkg_detail;
use FS::cust_bill_pkg_display;
+use FS::cust_bill_pkg_discount;
use FS::cust_bill_pay_pkg;
use FS::cust_credit_bill_pkg;
use FS::cust_tax_exempt_pkg;
'amount' => (ref($detail) ? $detail->[2] : '' ),
'classnum' => (ref($detail) ? $detail->[3] : '' ),
'phonenum' => (ref($detail) ? $detail->[4] : '' ),
- 'duration' => (ref($detail) ? $detail->[5] : '' ),
- 'regionname' => (ref($detail) ? $detail->[6] : '' ),
+ 'accountcode' => (ref($detail) ? $detail->[5] : '' ),
+ 'duration' => (ref($detail) ? $detail->[6] : '' ),
+ 'regionname' => (ref($detail) ? $detail->[7] : '' ),
};
$error = $cust_bill_pkg_detail->insert;
if ( $error ) {
#qsearch ( 'cust_bill_pkg_detail', { 'lineitemnum' => $self->lineitemnum });
}
+=item details_header [ OPTION => VALUE ... ]
+
+Returns a list representing an invoice line item detail header, if any.
+This relies on the behavior of voip_cdr in that it expects the header
+to be the first CSV formatted detail (as is expected by invoice generation
+routines). Returns the empty list otherwise.
+
+=cut
+
+sub details_header {
+ my $self = shift;
+ return '' unless defined dbdef->table('cust_bill_pkg_detail');
+
+ eval "use Text::CSV_XS;";
+ die $@ if $@;
+ my $csv = new Text::CSV_XS;
+
+ my @detail =
+ qsearch ({ 'table' => 'cust_bill_pkg_detail',
+ 'hashref' => { 'billpkgnum' => $self->billpkgnum,
+ 'format' => 'C',
+ },
+ 'order_by' => 'ORDER BY detailnum LIMIT 1',
+ });
+ return() unless scalar(@detail);
+ $csv->parse($detail[0]->detail) or return ();
+ $csv->fields;
+}
+
=item desc
Returns a description for this line item. For typical line items, this is the
}
+=item cust_bill_pkg_discount
+
+Returns the list of associated cust_bill_pkg_discount objects.
+
+=cut
+
+sub cust_bill_pkg_discount {
+ my $self = shift;
+ qsearch ( 'cust_bill_pkg_discount', { 'billpkgnum' => $self->billpkgnum } );
+}
+
=back
=head1 BUGS