fix ACL upgrade, RT#17056
[freeside.git] / FS / FS / cust_bill.pm
index 945771e..a76170a 100644 (file)
@@ -2006,7 +2006,7 @@ sub print_csv {
     );
 
   } elsif ( lc($opt{'format'}) eq 'oneline' ) { #name?
-   
+  
     my ($previous_balance) = $self->previous; 
     my $totaldue = sprintf('%.2f', $self->owed + $previous_balance);
     my @items = map {
@@ -2017,6 +2017,7 @@ sub print_csv {
 
     $csv->combine(
       $cust_main->agentnum,
+      $cust_main->agent->agent,
       $self->custnum,
       $cust_main->first,
       $cust_main->last,
@@ -4886,6 +4887,8 @@ sub _items_cust_bill_pkg {
 
   my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50;
 
+  my $cust_main = $self->cust_main;#for per-agent cust_bill-line_item-ate_style
+
   my @b = ();
   my ($s, $r, $u) = ( undef, undef, undef );
   foreach my $cust_bill_pkg ( @$cust_bill_pkgs )
@@ -5021,14 +5024,24 @@ sub _items_cust_bill_pkg {
           my $description = ($is_summary && $type && $type eq 'U')
                             ? "Usage charges" : $desc;
 
+          #pry be a bit more efficient to look some of this conf stuff up
+          # outside the loop
           unless (
             $conf->exists('disable_line_item_date_ranges')
               || $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1)
           ) {
             my $time_period;
-            my $date_style = $conf->config('cust_bill-line_item-date_style');
+            my $date_style = $conf->config( 'cust_bill-line_item-date_style',
+                                            $cust_main->agentnum
+                                          );
             if ( defined($date_style) && $date_style eq 'month_of' ) {
               $time_period = time2str('The month of %B', $cust_bill_pkg->sdate);
+            } elsif ( defined($date_style) && $date_style eq 'X_month' ) {
+              my $desc = $conf->config( 'cust_bill-line_item-date_description',
+                                         $cust_main->agentnum
+                                      );
+              $desc .= ' ' unless $desc =~ /\s$/;
+              $time_period = $desc. time2str('%B', $cust_bill_pkg->sdate);
             } else {
               $time_period =      time2str($date_format, $cust_bill_pkg->sdate).
                            " - ". time2str($date_format, $cust_bill_pkg->edate);