sub cust_bill_pkg {
my $self = shift;
- qsearch( 'cust_bill_pkg', { 'invnum' => $self->invnum } );
+ qsearch(
+ { 'table' => 'cust_bill_pkg',
+ 'hashref' => { 'invnum' => $self->invnum },
+ 'order_by' => 'ORDER BY billpkgnum',
+ }
+ );
}
=item cust_pkg
}
-=item generate_email PARAMHASH
+=item generate_email OPTION => VALUE ...
-PARAMHASH can contain the following:
+Options:
=over 4
-=item from => sender address, required
+=item from
+
+sender address, required
+
+=item tempate
+
+alternate template name, optional
-=item tempate => alternate template name, optional
+=item print_text
-=item print_text => text attachment arrayref, optional
+text attachment arrayref, optional
-=item subject => email subject, optional
+=item subject
+
+email subject, optional
=back
cid -
+unsquelch_cdr - overrides any per customer cdr squelching when true
+
=cut
sub print_generic {
'unitprices' => $conf->exists('invoice-unitprice'),
);
+ my $countrydefault = $conf->config('countrydefault') || 'US';
my $prefix = $cust_main->has_ship_address ? 'ship_' : '';
foreach ( qw( contact company address1 address2 city state zip country fax) ){
my $method = $prefix.$_;
$invoice_data{"ship_$_"} = _latex_escape($cust_main->$method);
}
+ $invoice_data{'ship_country'} = ''
+ if ( $invoice_data{'ship_country'} eq $countrydefault );
$invoice_data{'cid'} = $params{'cid'}
if $params{'cid'};
- my $countrydefault = $conf->config('countrydefault') || 'US';
if ( $cust_main->country eq $countrydefault ) {
$invoice_data{'country'} = '';
} else {
$options{'section'} = $section if $multisection;
$options{'format'} = $format;
$options{'escape_function'} = $escape_function;
+ $options{'format_function'} = sub { () }
+ unless $params{unsquelch_cdr} || $cust_main->squelch_cdr ne 'Y';
foreach my $line_item ( $self->_items_pkg(%options) ) {
my $detail = {
)
);
if ( $multisection ) {
- $adjust_section->{'pretotal'} = 'New charges total '.
- $total->{'total_amount'};
+ $adjust_section->{'pretotal'} = 'New charges total '. $other_money_char.
+ sprintf('%.2f', $self->charged );
}else{
push @total_items, $total;
}
my $format = $opt{format} || '';
my $escape_function = $opt{escape_function} || sub { shift };
+ my $format_function = $opt{format_function} || '';
my @b = ();
foreach my $cust_bill_pkg ( @$cust_bill_pkg ) {
my %details_opt = ( 'format' => $format,
'escape_function' => $escape_function,
+ 'format_function' => $format_function,
);
if ( $cust_bill_pkg->pkgnum > 0 ) {
my $description = $desc;
unless ( $conf->exists('disable_line_item_date_ranges') ) {
- $desc .= " (" . time2str("%x", $cust_bill_pkg->sdate).
- " - ". time2str("%x", $cust_bill_pkg->edate). ")";
+ $description .= " (" . time2str("%x", $cust_bill_pkg->sdate).
+ " - ". time2str("%x", $cust_bill_pkg->edate). ")";
}
#at least until cust_bill_pkg has "past" ranges in addition to
$cust_pkg->h_labels_short($self->_date);
#$cust_bill_pkg->edate,
#$cust_bill_pkg->sdate),
+ @d = () if $cust_bill_pkg->itemdesc;
push @d, $cust_bill_pkg->details(%details_opt);
push @b, {