summaryrefslogtreecommitdiff
path: root/FS/FS/rate_detail.pm
diff options
context:
space:
mode:
authormark <mark>2011-02-11 23:59:29 +0000
committermark <mark>2011-02-11 23:59:29 +0000
commit6a10d16ff4e806357abab206254aa38c80a749d3 (patch)
tree94dfb9705ba9d5aa8b3b0d1d96be6ba460115404 /FS/FS/rate_detail.pm
parentca2b8a8c99585a4619eb657f2c7fca12a7304249 (diff)
rate selection by CDR type, RT#10991
Diffstat (limited to 'FS/FS/rate_detail.pm')
-rw-r--r--FS/FS/rate_detail.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/rate_detail.pm b/FS/FS/rate_detail.pm
index 7b9045205..918134a3a 100644
--- a/FS/FS/rate_detail.pm
+++ b/FS/FS/rate_detail.pm
@@ -57,6 +57,8 @@ inherits from FS::Record. The following fields are currently supported:
=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
@@ -234,6 +236,20 @@ sub classname {
$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