use FS::Record qw( qsearch qsearchs dbh );
use FS::rate;
use FS::rate_region;
+use FS::rate_time;
use Tie::IxHash;
@ISA = qw(FS::Record);
=item classnum - usage class (see L<FS::usage_class>) if any for this rate
+=item ratetimenum - rating time period (see L<FS::rate_time) if any
+
+=item cdrtypenum - CDR type (see L<FS::cdr_type>) if any for this rate
+
=back
=head1 METHODS
$self->dest_region->prefixes_short;
}
+=item rate_time
+
+Returns the L<FS::rate_time> object associated with this call
+plan rate, if there is one.
+
+=cut
+
+sub rate_time {
+ my $self = shift;
+ $self->ratetimenum ? FS::rate_time->by_key($self->ratetimenum) : ();
+}
+
+=item rate_time_name
+
+Returns the I<ratetimename> field of the L<FS::rate_time> object
+associated with this rate plan.
+
+=cut
+
+sub rate_time_name {
+ my $self = shift;
+ $self->ratetimenum ? $self->rate_time->ratetimename : '(default)';
+}
+
=item classname
Returns the name of the usage class (see L<FS::usage_class>) associated with
$usage_class ? $usage_class->classname : '';
}
+=item cdrtypename
+
+Returns the name of the CDR type (see L<FS::cdr_type) associated with this
+rate, if there is one. If not, returns the cdrtypenum itself. This will
+only return an empty string if cdrtypenum is NULL.
+
+=cut
+
+sub cdrtypename {
+ my $self = shift;
+ my $cdrtypenum = $self->cdrtypenum or return '';
+ my $cdr_type = qsearchs('cdr_type', { cdrtypenum => $cdrtypenum });
+ return $cdr_type ? $cdr_type->cdrtypename : $cdrtypenum;
+}
=back
%granularities;
}
+=item conn_secs
+
+ Returns an (ordered) hash of conn_sec => name pairs
+
+=cut
+
+tie my %conn_secs, 'Tie::IxHash',
+ '0' => 'connection',
+ '1' => 'first second',
+ '6' => 'first 6 seconds',
+ '30' => 'first 30 seconds', # '1/2 minute',
+ '60' => 'first minute',
+ '120' => 'first 2 minutes',
+ '180' => 'first 3 minutes',
+ '300' => 'first 5 minutes',
+;
+
+sub conn_secs {
+ %conn_secs;
+}
+
+=item process_edit_import
+
+=cut
+
use Storable qw(thaw);
use Data::Dumper;
use MIME::Base64;
}
+=item edit_import
+
+=cut
+
#false laziness w/ #FS::Record::batch_import, grep "edit_import" for differences
#could be turned into callbacks or something
use Text::CSV_XS;
}
-
-
=back
=head1 BUGS