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)',
18 'base_rate' => { 'name' => 'Rate (per minute)',
25 my($self, $cust_pkg ) = @_;
26 $self->option('setup_fee');
31 my($cust_pkg, $sdate, $details, $param ) = @_;
35 $charges += $self->calc_usage(@_);
36 $charges += $self->calc_recur_Common(@_);
42 sub can_discount { 0; }
46 my($cust_pkg, $sdate, $details, $param ) = @_;
48 $self->calc_usage(@_);
53 my($cust_pkg, $sdate, $details, $param ) = @_;
55 my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
56 my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
60 my $rate = $self->option('base_rate');
62 foreach my $ding ( @tickets) {
63 $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
64 push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
66 cluck $rate, $charges, @$details if $DEBUG > 0;