summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-02-16 18:13:27 -0600
committerMitch Jackson <mitch@freeside.biz>2018-05-26 21:04:29 +0000
commitde07e068a34760e588bbc29708fd5197b7ee9ea1 (patch)
tree3d90072a82a0350c4610a5042b1d3ef9bee033a5
parentb7da0342d2a1d9a41f4caa5db292c0eae1446077 (diff)
RT# 79549 Requre a Rate Plan to use voip_cdr Price Plan
-rw-r--r--FS/FS/part_pkg.pm17
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm8
2 files changed, 18 insertions, 7 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 5f7c831bc..cad761498 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -671,11 +671,17 @@ sub check {
=item check_options
-For a passed I<$options> hashref, validates any options that
-have 'validate' subroutines defined in the info hash,
-then validates the entire hashref if the price plan has
-its own 'validate' subroutine defined in the info hash
-(I<$options> values might be altered.)
+Pass an I<$options> hashref that contains the values to be
+inserted or updated for any FS::part_pkg::MODULE.pm.
+
+For each key in I<$options>, validates the value by calling
+the 'validate' subroutine defined for that option e.g.
+FS::part_pkg::MODULE::plan_info()->{$KEY}->{validate}. The
+option validation function is only called when the hashkey for
+that option exists in I<$options>.
+
+Then the module validation function is called, from
+FS::part_pkg::MODULE::plan_info()->{validate}
Returns error message, or empty string if valid.
@@ -2201,4 +2207,3 @@ schema.html from the base documentation.
=cut
1;
-
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 2d8c359cf..870292647 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -371,6 +371,13 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
)
],
'weight' => 41,
+ 'validate' => sub {
+ # Validation function for FS::part_pkg::check_options()
+ my $options = shift;
+ return "Please select a rate plan for price plan VoIP/telco CDR rating (standard)"
+ unless $options->{ratenum};
+ return;
+ },
);
sub price_info {
@@ -754,4 +761,3 @@ sub hide_svc_detail {
1;
-