1 package FS::part_pkg::rt_time;
5 use FS::Record qw(qsearchs qsearch);
6 use FS::part_pkg::recur_Common;
9 our @ISA = qw(FS::part_pkg::recur_Common);
14 'name' => 'Bill from Time Worked on tickets in RT',
15 'shortname' => 'Project Billing (RT)',
17 'inherit_fields' => [ 'global_Mixin' ],
19 'base_rate' => { 'name' => 'Rate (per minute)',
22 'recur_fee' => {'disabled' => 1},
24 'fieldorder' => [ 'base_rate' ],
29 my $str = $self->SUPER::price_info;
30 my $rate = $self->option('base_rate');
31 $str .= " plus $rate/min" if $rate;
36 my($self, $cust_pkg ) = @_;
37 $self->option('setup_fee');
42 my($cust_pkg, $sdate, $details, $param ) = @_;
46 $charges += $self->calc_usage(@_);
47 $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
53 sub can_discount { 0; }
58 # my($cust_pkg, $sdate, $details, $param ) = @_;
60 # $self->calc_usage(@_);
65 my($cust_pkg, $sdate, $details, $param ) = @_;
67 my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
68 my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
72 my $rate = $self->option('base_rate');
74 foreach my $ding ( @tickets) {
75 $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
76 push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
78 cluck $rate, $charges, @$details if $DEBUG > 0;