[freeside-commits] freeside/FS/FS Conf.pm, 1.416, 1.417 cust_bill.pm, 1.302, 1.303 cust_bill_pkg.pm, 1.51, 1.52

Erik Levinson levinse at wavetail.420.am
Thu Jan 13 08:35:18 PST 2011


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

Modified Files:
	Conf.pm cust_bill.pm cust_bill_pkg.pm 
Log Message:
optionally generate line items which are fully discounted, RT10481

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.416
retrieving revision 1.417
diff -u -w -d -r1.416 -r1.417
--- Conf.pm	1 Jan 2011 06:39:17 -0000	1.416
+++ Conf.pm	13 Jan 2011 16:35:13 -0000	1.417
@@ -655,6 +655,13 @@
   },
 
   {
+    'key'         => 'discount-show-always',
+    'section'     => 'billing',
+    'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'encryption',
     'section'     => 'billing',
     'description' => 'Enable encryption of credit cards.',

Index: cust_bill_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill_pkg.pm,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -w -d -r1.51 -r1.52
--- cust_bill_pkg.pm	27 Jun 2010 09:25:26 -0000	1.51
+++ cust_bill_pkg.pm	13 Jan 2011 16:35:15 -0000	1.52
@@ -874,6 +874,17 @@
 
 }
 
+=item cust_bill_pkg_discount 
+
+Returns the list of associated cust_bill_pkg_discount objects.
+
+=cut
+
+sub cust_bill_pkg_discount {
+    my $self = shift;
+    qsearch ( 'cust_bill_pkg_discount', { 'billpkgnum' => $self->billpkgnum } );
+}
+
 =back
 
 =head1 BUGS

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -w -d -r1.302 -r1.303
--- cust_bill.pm	28 Dec 2010 05:23:51 -0000	1.302
+++ cust_bill.pm	13 Jan 2011 16:35:14 -0000	1.303
@@ -4125,19 +4125,23 @@
   my $summary_page = $opt{summary_page} || '';
   my $multilocation = $opt{multilocation} || '';
   my $multisection = $opt{multisection} || '';
+  my $discount_show_always = 0;
 
   my @b = ();
   my ($s, $r, $u) = ( undef, undef, undef );
   foreach my $cust_bill_pkg ( @$cust_bill_pkg )
   {
 
+    $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;
+          unless ( $_->{amount} == 0 && !$discount_show_always );
         $_ = undef;
       }
     }
@@ -4211,7 +4215,8 @@
 
         }
 
-        if ( ( $cust_bill_pkg->recur != 0  || $cust_bill_pkg->setup == 0 ) &&
+        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' )
            )
         {
@@ -4336,7 +4341,7 @@
       $_->{amount}      =~ s/^\-0\.00$/0.00/;
       $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
       push @b, { %$_ }
-        unless $_->{amount} == 0;
+	    unless ( $_->{amount} == 0 && !$discount_show_always );
     }
   }
 



More information about the freeside-commits mailing list