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' ],
28 my($self, $cust_pkg ) = @_;
29 $self->option('setup_fee');
34 my($cust_pkg, $sdate, $details, $param ) = @_;
38 $charges += $self->calc_usage(@_);
39 $charges += $self->calc_recur_Common(@_);
45 sub can_discount { 0; }
49 my($cust_pkg, $sdate, $details, $param ) = @_;
51 $self->calc_usage(@_);
56 my($cust_pkg, $sdate, $details, $param ) = @_;
58 my $last_bill = $cust_pkg->get('last_bill') || $cust_pkg->get('setup');
59 my @tickets = @{ FS::TicketSystem->comments_on_tickets( $cust_pkg->custnum, 100, $last_bill ) };
63 my $rate = $self->option('base_rate');
65 foreach my $ding ( @tickets) {
66 $charges += sprintf('%.2f', $ding->{'timetaken'} * $rate);
67 push @$details, join( ", ", ("($ding->{timetaken}) Minutes", substr($ding->{'content'},0,255)));
69 cluck $rate, $charges, @$details if $DEBUG > 0;