diff options
author | ivan <ivan> | 2008-09-12 07:58:35 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-09-12 07:58:35 +0000 |
commit | f2f92e37e95cd9349d57c57f672e4aae7dc1be6b (patch) | |
tree | 441337130f88cb7c8dbb2899edd54a315334e0bf | |
parent | fcf8d4c171e4e61ce02bd35e444b99a238a94c37 (diff) |
make the max # of indivudal services printed on invoices configurable. RT#3904
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 12 |
2 files changed, 15 insertions, 4 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 536ad6ffd..3991c03e0 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2380,6 +2380,13 @@ worry that config_items is freeside-specific and icky. 'type' => 'text', }, + { + 'key' => 'cust_bill-max_same_services', + 'section' => 'billing', + 'description' => 'Maximum number of the same service to list individually on invoices before condensing to a single line listing the number of services. Defaults to 5.', + 'type' => 'text', + }, + ); 1; diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index cbec585e4..606cb5407 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1361,15 +1361,19 @@ sub h_labels { =item h_labels_short END_TIMESTAMP [ START_TIMESTAMP ] -Like h_labels, except returns a simple flat list, and shortens long -(currently >5) lists of identical services to one line that lists the service -label and the number of individual services rather than individual items. +Like h_labels, except returns a simple flat list, and shortens long +(currently >5 or the cust_bill-max_same_services configuration value) lists of +identical services to one line that lists the service label and the number of +individual services rather than individual items. =cut sub h_labels_short { my $self = shift; + my $conf = new FS::Conf; + my $max_same_services = $conf->config('cust_bill-max_same_services') || 5; + my %labels; #tie %labels, 'Tie::IxHash'; push @{ $labels{$_->[0]} }, $_->[1] @@ -1378,7 +1382,7 @@ sub h_labels_short { foreach my $label ( keys %labels ) { my @values = @{ $labels{$label} }; my $num = scalar(@values); - if ( $num > 5 ) { + if ( $num > $max_same_services ) { push @labels, "$label ($num)"; } else { push @labels, map { "$label: $_" } @values; |