[freeside-commits] freeside/FS/FS part_pkg.pm, 1.119, 1.120 Schema.pm, 1.304, 1.305 cust_bill.pm, 1.341, 1.342 cust_bill_pkg.pm, 1.54, 1.55

Ivan,,, ivan at wavetail.420.am
Thu Jun 9 20:33:45 PDT 2011


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

Modified Files:
	part_pkg.pm Schema.pm cust_bill.pm cust_bill_pkg.pm 
Log Message:
add package def option to show $0 recurring on invoices, RT#9777

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.304
retrieving revision 1.305
diff -u -w -d -r1.304 -r1.305
--- Schema.pm	9 Jun 2011 02:14:45 -0000	1.304
+++ Schema.pm	10 Jun 2011 03:33:43 -0000	1.305
@@ -1627,6 +1627,7 @@
         'agentnum',      'int',     'NULL', '', '', '', 
         'fcc_ds0s',      'int',     'NULL', '', '', '', 
         'no_auto',      'char',     'NULL',  1, '', '', 
+        'recur_show_zero',  'char', 'NULL',  1, '', '',
       ],
       'primary_key' => 'pkgpart',
       'unique' => [],

Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -w -d -r1.54 -r1.55
--- cust_bill_pkg.pm	27 Apr 2011 05:22:21 -0000	1.54
+++ cust_bill_pkg.pm	10 Jun 2011 03:33:43 -0000	1.55
@@ -413,7 +413,8 @@
 
 Returns an array of detail information for the invoice line item.
 
-Currently available options are: I<format> I<escape_function>
+Currently available options are: I<format>, I<escape_function> and
+I<format_function>.
 
 If I<format> is set to html or latex then the array members are improved
 for tabular appearance in those environments if possible.
@@ -421,6 +422,12 @@
 If I<escape_function> is set then the array members are processed by this
 function before being returned.
 
+I<format_function> overrides the normal HTML or LaTeX function for returning
+formatted CDRs.  It can be set to a subroutine which returns an empty list
+to skip usage detail:
+
+  'format_function' => sub { () },
+
 =cut
 
 sub details {
@@ -872,7 +879,7 @@
   my %hash = ( 'billpkgnum' => $self->billpkgnum );
   $hash{classnum} = $classnum if $classnum;
 
-  qsearch ( 'cust_bill_pkg_detail', { %hash  } ),
+  qsearch( 'cust_bill_pkg_detail', \%hash ),
 
 }
 
@@ -887,6 +894,19 @@
     qsearch ( 'cust_bill_pkg_discount', { 'billpkgnum' => $self->billpkgnum } );
 }
 
+=item recur_show_zero
+
+=cut
+
+sub recur_show_zero {
+  my $self = shift;
+
+     $self->recur == 0
+  && $self->pkgnum
+  && $self->cust_pkg->part_pkg->recur_show_zero;
+
+}
+
 =back
 
 =head1 BUGS

Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -w -d -r1.119 -r1.120
--- part_pkg.pm	21 Mar 2011 01:48:27 -0000	1.119
+++ part_pkg.pm	10 Jun 2011 03:33:43 -0000	1.120
@@ -553,6 +553,7 @@
     || $self->ut_enum('disabled', [ '', 'Y' ] )
     || $self->ut_enum('custom', [ '', 'Y' ] )
     || $self->ut_enum('no_auto', [ '', 'Y' ])
+    || $self->ut_enum('recur_show_zero', [ '', 'Y' ])
     #|| $self->ut_moneyn('setup_cost')
     #|| $self->ut_moneyn('recur_cost')
     || $self->ut_floatn('setup_cost')

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.341
retrieving revision 1.342
diff -u -w -d -r1.341 -r1.342
--- cust_bill.pm	27 May 2011 01:11:02 -0000	1.341
+++ cust_bill.pm	10 Jun 2011 03:33:43 -0000	1.342
@@ -4575,23 +4575,10 @@
   foreach my $cust_bill_pkg ( @$cust_bill_pkgs )
   {
 
-    warn "$me _items_cust_bill_pkg considering cust_bill_pkg $cust_bill_pkg\n"
+    warn "$me _items_cust_bill_pkg considering cust_bill_pkg ".
+         $cust_bill_pkg->billpkgnum. ", pkgnum ". $cust_bill_pkg->pkgnum. "\n"
       if $DEBUG > 1;
 
-    $discount_show_always = ($cust_bill_pkg->cust_bill_pkg_discount
-        			&& $conf->exists('discount-show-always'));
-
-    foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
-      if ( $_ && !$cust_bill_pkg->hidden ) {
-        $_->{amount}      = sprintf( "%.2f", $_->{amount} ),
-        $_->{amount}      =~ s/^\-0\.00$/0.00/;
-        $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
-        push @b, { %$_ }
-          unless ( $_->{amount} == 0 && !$discount_show_always );
-        $_ = undef;
-      }
-    }
-
     foreach my $display ( grep { defined($section)
                                  ? $_->section eq $section
                                  : 1
@@ -4670,9 +4657,13 @@
 
         }
 
-        if ( ( $cust_bill_pkg->recur != 0  || $cust_bill_pkg->setup == 0 || 
-		($discount_show_always && $cust_bill_pkg->recur == 0) ) &&
-             ( !$type || $type eq 'R' || $type eq 'U' )
+        if (    ( !$type || $type eq 'R' || $type eq 'U' )
+             && (
+                     $cust_bill_pkg->recur != 0
+                  || $cust_bill_pkg->setup == 0
+                  || $discount_show_always
+                  || $cust_bill_pkg->recur_show_zero
+                )
            )
         {
 
@@ -4817,21 +4808,38 @@
 
     }
 
-  }
-
-  warn "$me _items_cust_bill_pkg done considering cust_bill_pkgs\n"
-    if $DEBUG > 1;
+    $discount_show_always = ($cust_bill_pkg->cust_bill_pkg_discount
+                                && $conf->exists('discount-show-always'));
 
   foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
-    if ( $_  ) {
+      if ( $_ && !$cust_bill_pkg->hidden ) {
       $_->{amount}      = sprintf( "%.2f", $_->{amount} ),
       $_->{amount}      =~ s/^\-0\.00$/0.00/;
       $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
       push @b, { %$_ }
-        unless ( $_->{amount} == 0 && !$discount_show_always );
+          if $_->{amount} != 0
+          || $discount_show_always
+          || $cust_bill_pkg->recur_show_zero;
+        $_ = undef;
+      }
     }
+
   }
 
+  #foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
+  #  if ( $_  ) {
+  #    $_->{amount}      = sprintf( "%.2f", $_->{amount} ),
+  #    $_->{amount}      =~ s/^\-0\.00$/0.00/;
+  #    $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
+  #    push @b, { %$_ }
+  #      if $_->{amount} != 0
+  #      || $discount_show_always
+  #  }
+  #}
+
+  warn "$me _items_cust_bill_pkg done considering cust_bill_pkgs\n"
+    if $DEBUG > 1;
+
   @b;
 
 }



More information about the freeside-commits mailing list