[freeside-commits] freeside/FS/FS cust_pkg.pm,1.135,1.136

Ivan,,, ivan at wavetail.420.am
Mon Aug 3 17:19:25 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv30056

Modified Files:
	cust_pkg.pm 
Log Message:
don't reset usage on package change when usage_rollover is on, it adds twice...

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- cust_pkg.pm	30 Jul 2009 06:42:31 -0000	1.135
+++ cust_pkg.pm	4 Aug 2009 00:19:23 -0000	1.136
@@ -1188,13 +1188,14 @@
   }
 
   #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 @@
   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 @@
 =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;



More information about the freeside-commits mailing list