Merge branch 'master' of git.freeside.biz:/home/git/freeside
authorIvan Kohler <ivan@freeside.biz>
Wed, 3 Jul 2013 03:02:42 +0000 (20:02 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 3 Jul 2013 03:02:42 +0000 (20:02 -0700)
FS/FS/Conf.pm
FS/FS/part_pkg/currency_fixed.pm
FS/FS/part_pkg/incomplete/rt_time.pm [new file with mode: 0644]
FS/FS/part_pkg/rt_time.pm [deleted file]

index 42fe9ec..f76c72f 100644 (file)
@@ -2275,6 +2275,7 @@ and customer address. Include units.',
     'key'         => 'selfservice-timeout',
     'section'     => 'self-service',
     'description' => 'Timeout for the self-service login cookie, in seconds.  Defaults to 1 hour.',
+    'type'        => 'text',
   },
 
   {
index ce71452..c64fb78 100644 (file)
@@ -81,9 +81,12 @@ sub base_recur {
 sub can_discount { 0; } #can't discount yet (percentage would work, but amount?)
 sub calc_recur {
   my $self = shift;
+
   #my($cust_pkg, $sdate, $details, $param ) = @_;
-  #$self->calc_recur_Common($cust_pkg,$sdate,$details,$param);
-  $self->calc_recur_Common(@_);
+  my $cust_pkg = $_[0];
+
+  ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_); #($cust_pkg,$sdate,$details,$param);
+
 }
 
 sub is_free { 0; }
diff --git a/FS/FS/part_pkg/incomplete/rt_time.pm b/FS/FS/part_pkg/incomplete/rt_time.pm
new file mode 100644 (file)
index 0000000..f96eba6
--- /dev/null
@@ -0,0 +1,82 @@
+package FS::part_pkg::rt_time;
+
+use strict;
+use FS::Conf;
+use FS::Record qw(qsearchs qsearch);
+use FS::part_pkg::recur_Common;
+use Carp qw(cluck);
+
+our @ISA = qw(FS::part_pkg::recur_Common);
+
+our $DEBUG = 0;
+
+our %info = (
+  'name'      =>  'Bill from Time Worked on tickets in RT',
+  'shortname' =>  'Project Billing (RT)',
+  'weight'    => 55,
+  'inherit_fields' => [ 'global_Mixin' ],
+  'fields'    =>  {
+    'base_rate' =>  {   'name'    =>  'Rate (per minute)',
+                        'default' => 0,
+                    },
+    'recur_fee' => {'disabled' => 1},
+  },
+  'fieldorder' => [ 'base_rate' ],
+);
+
+sub price_info {
+    my $self = shift;
+    my $str = $self->SUPER::price_info;
+    my $rate = $self->option('base_rate');
+    $str .= " plus $rate/min" if $rate;
+    $str;
+}
+
+sub calc_setup {
+  my($self, $cust_pkg ) = @_;
+  $self->option('setup_fee');
+}
+
+sub calc_recur {
+  my $self = shift;
+  my($cust_pkg, $sdate, $details, $param ) = @_;
+
+  my $charges = 0;
+
+  $charges += $self->calc_usage(@_);
+  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
+
+  $charges;
+
+}
+
+sub can_discount { 0; }
+
+# use the default
+#sub calc_cancel {
+#  my $self = shift;
+#  my($cust_pkg, $sdate, $details, $param ) = @_;
+#
+#  $self->calc_usage(@_);
+#}
+
+sub calc_usage {
+  my $self = shift;
+  my($cust_pkg, $sdate, $details, $param ) = @_;
+
+  my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
+  my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
+
+  my $charges = 0;
+
+  my $rate = $self->option('base_rate');
+
+  foreach my $ding ( @tickets) {
+        $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
+        push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
+  }
+  cluck $rate, $charges, @$details if $DEBUG > 0;
+  return $charges;
+}
+
+1;
diff --git a/FS/FS/part_pkg/rt_time.pm b/FS/FS/part_pkg/rt_time.pm
deleted file mode 100644 (file)
index 11b7ee8..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-package FS::part_pkg::rt_time;
-
-use strict;
-use FS::Conf;
-use FS::Record qw(qsearchs qsearch);
-use FS::part_pkg::recur_Common;
-use Carp qw(cluck);
-
-our @ISA = qw(FS::part_pkg::recur_Common);
-
-our $DEBUG = 0;
-
-our %info = (
-  'name'      =>  'Bill from Time Worked on tickets in RT',
-  'shortname' =>  'Project Billing (RT)',
-  'weight'    => 55,
-  'inherit_fields' => [ 'global_Mixin' ],
-  'fields'    =>  {
-    'base_rate' =>  {   'name'    =>  'Rate (per minute)',
-                        'default' => 0,
-                    },
-    'recur_fee' => {'disabled' => 1},
-  },
-  'fieldorder' => [ 'base_rate' ],
-);
-
-sub price_info {
-    my $self = shift;
-    my $str = $self->SUPER::price_info;
-    my $rate = $self->option('base_rate');
-    $str .= " plus $rate/min" if $rate;
-    $str;
-}
-
-sub calc_setup {
-  my($self, $cust_pkg ) = @_;
-  $self->option('setup_fee');
-}
-
-sub calc_recur {
-  my $self = shift;
-  my($cust_pkg, $sdate, $details, $param ) = @_;
-
-  my $charges = 0;
-
-  $charges += $self->calc_usage(@_);
-  $charges += $self->calc_recur_Common(@_);
-
-  $charges;
-
-}
-
-sub can_discount { 0; }
-
-# use the default
-#sub calc_cancel {
-#  my $self = shift;
-#  my($cust_pkg, $sdate, $details, $param ) = @_;
-#
-#  $self->calc_usage(@_);
-#}
-
-sub calc_usage {
-  my $self = shift;
-  my($cust_pkg, $sdate, $details, $param ) = @_;
-
-  my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
-  my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
-
-  my $charges = 0;
-
-  my $rate = $self->option('base_rate');
-
-  foreach my $ding ( @tickets) {
-        $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
-        push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
-  }
-  cluck $rate, $charges, @$details if $DEBUG > 0;
-  return $charges;
-}
-
-1;