summaryrefslogtreecommitdiff
path: root/FS/FS/rate_detail.pm
diff options
context:
space:
mode:
authorjeff <jeff>2008-08-23 21:59:46 +0000
committerjeff <jeff>2008-08-23 21:59:46 +0000
commitef0d8db38d1ee28a65a7ecdc6e11c7a82c0a741b (patch)
tree78518afc3aa8623211251caedf78459167cd0877 /FS/FS/rate_detail.pm
parent8381e7232f90ac22b3f655cdccd0d39e2bde1d63 (diff)
add usage classes to rate details
Diffstat (limited to 'FS/FS/rate_detail.pm')
-rw-r--r--FS/FS/rate_detail.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/FS/FS/rate_detail.pm b/FS/FS/rate_detail.pm
index 533fb1e..a78ea82 100644
--- a/FS/FS/rate_detail.pm
+++ b/FS/FS/rate_detail.pm
@@ -49,6 +49,8 @@ inherits from FS::Record. The following fields are currently supported:
=item sec_granularity - granularity in seconds, i.e. 6 or 60; 0 for per-call
+=item classnum - usage class (see L<FS::usage_class) if any for this rate
+
=back
=head1 METHODS
@@ -121,6 +123,8 @@ sub check {
|| $self->ut_float('min_charge')
|| $self->ut_number('sec_granularity')
+
+ || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum' )
;
return $error if $error;
@@ -187,6 +191,19 @@ sub dest_prefixes_short {
$self->dest_region->prefixes_short;
}
+=item classname
+
+Returns the name of the usage class (see L<FS::usage_class>) associated with
+this call plan rate.
+
+=cut
+
+sub classname {
+ my $self = shift;
+ my $usage_class = qsearchs('usage_class', { classnum => $self->classnum });
+ $usage_class ? $usage_class->classname : '';
+}
+
=back