diff options
author | ivan <ivan> | 2009-08-04 00:19:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-08-04 00:19:23 +0000 |
commit | 32c4b823d2561ec9ed14fa446c11f15a68404d37 (patch) | |
tree | 697176c2119864a5cc0181af0bb8e7b0a4932c8b /FS | |
parent | 6e80cdbaa7fc1f5a8247d19aceeb652844352207 (diff) |
don't reset usage on package change when usage_rollover is on, it adds twice...
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_pkg.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 4724514c0..396ae07cc 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1188,13 +1188,14 @@ sub change { } #reset usage if changing pkgpart + # AND usage rollover is off (otherwise adds twice, now and at package bill) if ($self->pkgpart != $cust_pkg->pkgpart) { my $part_pkg = $cust_pkg->part_pkg; $error = $part_pkg->reset_usage($cust_pkg, $part_pkg->is_prepaid ? () : ( 'null' => 1 ) ) - if $part_pkg->can('reset_usage'); + if $part_pkg->can('reset_usage') && ! $part_pkg->option('usage_rollover'); if ($error) { $dbh->rollback if $oldAutoCommit; @@ -1835,6 +1836,19 @@ sub h_labels { map { [ $_->label(@_) ] } $self->h_cust_svc(@_); } +=item labels_short + +Like 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 labels_short { + shift->_labels_short( 'labels', @_ ); +} + =item h_labels_short END_TIMESTAMP [ START_TIMESTAMP ] Like h_labels, except returns a simple flat list, and shortens long @@ -1845,7 +1859,11 @@ individual services rather than individual items. =cut sub h_labels_short { - my $self = shift; + shift->_labels_short( 'h_labels', @_ ); +} + +sub _labels_short { + my( $self, $method ) = ( shift, shift ); my $conf = new FS::Conf; my $max_same_services = $conf->config('cust_bill-max_same_services') || 5; |