summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-07-14 22:21:58 +0000
committerivan <ivan>2011-07-14 22:21:58 +0000
commit529764ae84fd653e2807e29247faaccdfcb53d33 (patch)
treed9c65a55943a9414caf0c0e9636a76e88d4f0cbe
parent06a1de4f0969dbbe1a689c1185393e664cdb907f (diff)
add cust_bill-latex_lineitem_maxlength conf, RT#13634
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cust_bill.pm26
2 files changed, 23 insertions, 10 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4ff3aa77a..f3826c9d8 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4438,6 +4438,13 @@ and customer address. Include units.',
},
{
+ 'key' => 'cust_bill-latex_lineitem_maxlength',
+ 'section' => 'invoicing',
+ 'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin. Defaults to 50. ',
+ 'type' => 'text',
+ },
+
+ {
'key' => 'cust_main-status_module',
'section' => 'UI',
'description' => 'Which module to use for customer status display. The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive. The "Recurring" module considers those customers Cancelled. Similarly for customers with suspended recurring packages but one-time charges.', #other differences?
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 25f9c495a..6e4eba426 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -3997,6 +3997,8 @@ sub _items_extra_usage_sections {
my %classnums = ();
my %lines = ();
+ my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50;
+
my %usage_class = map { $_->classnum => $_ } qsearch( 'usage_class', {} );
foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {
next unless $cust_bill_pkg->pkgnum > 0;
@@ -4016,8 +4018,8 @@ sub _items_extra_usage_sections {
my $desc = $detail->regionname;
my $description = $desc;
- $description = substr($desc, 0, 50). '...'
- if $format eq 'latex' && length($desc) > 50;
+ $description = substr($desc, 0, $maxlength). '...'
+ if $format eq 'latex' && length($desc) > $maxlength;
$lines{$section}{$desc} ||= {
description => &{$escape}($description),
@@ -4230,6 +4232,8 @@ sub _items_svc_phone_sections {
my %classnums = ();
my %lines = ();
+ my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50;
+
my %usage_class = map { $_->classnum => $_ } qsearch( 'usage_class', {} );
$usage_class{''} ||= new FS::usage_class { 'classname' => '', 'weight' => 0 };
@@ -4259,8 +4263,8 @@ sub _items_svc_phone_sections {
my $desc = $detail->regionname;
my $description = $desc;
- $description = substr($desc, 0, 50). '...'
- if $format eq 'latex' && length($desc) > 50;
+ $description = substr($desc, 0, $maxlength). '...'
+ if $format eq 'latex' && length($desc) > $maxlength;
$lines{$phonenum}{$desc} ||= {
description => &{$escape}($description),
@@ -4572,6 +4576,8 @@ sub _items_cust_bill_pkg {
my $multisection = $opt{multisection} || '';
my $discount_show_always = 0;
+ my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50;
+
my @b = ();
my ($s, $r, $u) = ( undef, undef, undef );
foreach my $cust_bill_pkg ( @$cust_bill_pkgs )
@@ -4597,8 +4603,8 @@ sub _items_cust_bill_pkg {
my $type = $display->type;
my $desc = $cust_bill_pkg->desc;
- $desc = substr($desc, 0, 50). '...'
- if $format eq 'latex' && length($desc) > 50;
+ $desc = substr($desc, 0, $maxlength). '...'
+ if $format eq 'latex' && length($desc) > $maxlength;
my %details_opt = ( 'format' => $format,
'escape_function' => $escape_function,
@@ -4639,8 +4645,8 @@ sub _items_cust_bill_pkg {
if ( $multilocation ) {
my $loc = $cust_pkg->location_label;
- $loc = substr($loc, 0, 50). '...'
- if $format eq 'latex' && length($loc) > 50;
+ $loc = substr($loc, 0, $maxlength). '...'
+ if $format eq 'latex' && length($loc) > $maxlength;
push @d, &{$escape_function}($loc);
}
@@ -4720,8 +4726,8 @@ sub _items_cust_bill_pkg {
if ( $multilocation ) {
my $loc = $cust_pkg->location_label;
- $loc = substr($loc, 0, 50). '...'
- if $format eq 'latex' && length($loc) > 50;
+ $loc = substr($loc, 0, $maxlength). '...'
+ if $format eq 'latex' && length($loc) > $maxlength;
push @d, &{$escape_function}($loc);
}