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 'base_rate' => { 'name' => 'Rate (per minute)',
24 my($self, $cust_pkg ) = @_;
25 $self->option('setup_fee');
30 my($cust_pkg, $sdate, $details, $param ) = @_;
34 $charges += $self->calc_usage(@_);
35 $charges += $self->calc_recur_Common(@_);
43 my($cust_pkg, $sdate, $details, $param ) = @_;
45 $self->calc_usage(@_);
50 my($cust_pkg, $sdate, $details, $param ) = @_;
52 my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
53 my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
57 my $rate = $self->option('base_rate');
59 foreach my $ding ( @tickets) {
60 $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
61 push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
63 cluck $rate, $charges, @$details if $DEBUG > 0;