fix prorates & recurring fees with recur_Common-using packages, RT#11993
[freeside.git] / FS / FS / part_pkg / flat.pm
index ffeb8ae..c9f2858 100644 (file)
@@ -1,19 +1,16 @@
 package FS::part_pkg::flat;
 
 use strict;
-use vars qw( @ISA %info
-             %usage_recharge_fields @usage_recharge_fieldorder
+use base qw( FS::part_pkg 
+             FS::part_pkg::prorate_Mixin
+             FS::part_pkg::discount_Mixin
            );
+use vars qw( %info %usage_recharge_fields @usage_recharge_fieldorder );
 use Tie::IxHash;
 use List::Util qw(min); # max);
 #use FS::Record qw(qsearch);
 use FS::UI::bytecount;
 use FS::Conf;
-use FS::part_pkg;
-
-@ISA = qw(FS::part_pkg 
-          FS::part_pkg::prorate_Mixin
-          FS::part_pkg::discount_Mixin);
 
 tie my %temporalities, 'Tie::IxHash',
   'upcoming'  => "Upcoming (future)",
@@ -77,6 +74,19 @@ tie my %contract_years, 'Tie::IxHash', (
   'weight' => 10,
 );
 
+sub price_info {
+    my $self = shift;
+    my $conf = new FS::Conf;
+    my $money_char = $conf->config('money_char') || '$';
+    my $setup = $self->option('setup_fee') || 0;
+    my $recur = $self->option('recur_fee', 1) || 0;
+    my $str = '';
+    $str = $money_char . $setup . ' one-time' if $setup;
+    $str .= ', ' if ($setup && $recur);
+    $str .= $money_char . $recur . ' recurring ' if $recur;
+    $str;
+}
+
 sub calc_setup {
   my($self, $cust_pkg, $sdate, $details ) = @_;