This commit was manufactured by cvs2svn to create tag 'freeside_2_1_1'.
[freeside.git] / FS / FS / part_pkg / bulk.pm
index b28fd30..69fe98e 100644 (file)
@@ -7,7 +7,7 @@ use FS::part_pkg::flat;
 
 @ISA = qw(FS::part_pkg::flat);
 
-$DEBUG = 0;
+$DEBUG = 1;
 $me = '[FS::part_pkg::bulk]';
 
 %info = (
@@ -29,17 +29,9 @@ $me = '[FS::part_pkg::bulk]';
                                    ' of service at cancellation',
                          'type' => 'checkbox',
                        },
-    'summarize_svcs'=> { 'name' => 'Show a count of services on the invoice, '.
-                                   'instead of a detailed list',
-                         'type' => 'checkbox',
-                       },
-    'no_prorate'    => { 'name' => 'Don\'t prorate recurring fees on services '.
-                                   'active for a partial month',
-                         'type' => 'checkbox',
-                       },
   },
   'fieldorder' => [ 'setup_fee', 'recur_fee', 'svc_setup_fee', 'svc_recur_fee',
-                    'unused_credit', 'summarize_svcs', 'no_prorate' ],
+                    'unused_credit', ],
   'weight' => 50,
 );
 
@@ -58,11 +50,6 @@ sub calc_recur {
     unless $$sdate > $last_bill;
 
   my $total_svc_charge = 0;
-  my %n_setup = ();
-  my %n_recur = ();
-  my %part_svc_label = ();
-
-  my $summarize = $self->option('summarize_svcs',1);
 
   warn "$me billing for bulk services from ". time2str('%x', $last_bill).
                                       " to ". time2str('%x', $$sdate). "\n"
@@ -74,7 +61,6 @@ sub calc_recur {
     my @label = $h_cust_svc->label_long( $$sdate, $last_bill );
     die "fatal: no historical label found, wtf?" unless scalar(@label); #?
     my $svc_details = $label[0]. ': '. $label[1]. ': ';
-    $part_svc_label{$h_cust_svc->svcpart} ||= $label[0];
 
     my $svc_charge = 0;
 
@@ -84,21 +70,14 @@ sub calc_recur {
     } elsif ( $svc_setup_fee ) {
       $svc_charge += $svc_setup_fee;
       $svc_details .= $money_char. sprintf('%.2f setup, ', $svc_setup_fee);
-      $n_setup{$h_cust_svc->svcpart}++;
     }
 
     my $svc_end = $h_cust_svc->date_deleted;
     $svc_end = ( !$svc_end || $svc_end > $$sdate ) ? $$sdate : $svc_end;
 
-    my $recur_charge;
-    if ( $self->option('no_prorate',1) ) {
-      $recur_charge = $self->option('svc_recur_fee');
-    }
-    else {
-      $recur_charge = $self->option('svc_recur_fee') 
-                                     * ( $svc_end - $svc_start )
+    my $recur_charge =
+      $self->option('svc_recur_fee') * ( $svc_end - $svc_start )
                                      / ( $$sdate  - $last_bill );
-    }
 
     $svc_details .= $money_char. sprintf('%.2f', $recur_charge ).
                     ' ('.  time2str('%x', $svc_start).
@@ -106,21 +85,11 @@ sub calc_recur {
       if $recur_charge;
 
     $svc_charge += $recur_charge;
-    $n_recur{$h_cust_svc->svcpart}++;
-    push @$details, $svc_details if !$summarize;
+
+    push @$details, $svc_details;
     $total_svc_charge += $svc_charge;
 
   }
-  if ( $summarize ) {
-    foreach my $svcpart (keys %part_svc_label) {
-      push @$details, sprintf('Setup fee: %d @ '.$money_char.'%.2f',
-        $n_setup{$svcpart}, $svc_setup_fee )
-        if $svc_setup_fee and $n_setup{$svcpart};
-      push @$details, sprintf('%d services @ '.$money_char.'%.2f',
-        $n_recur{$svcpart}, $self->option('svc_recur_fee') )
-        if $n_recur{$svcpart};
-    }
-  }
 
   sprintf('%.2f', $self->base_recur($cust_pkg) + $total_svc_charge );
 }