summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2019-01-09 12:28:19 -0500
committerChristopher Burger <burgerc@freeside.biz>2019-01-09 20:21:54 -0500
commit8e554db2f70c1f06cde68c138b549061514e5fdb (patch)
tree51ac9edf46eb45c81b74cab647c03498a265a50b /FS
parent30776e35f2b4bd50affc82bd0c3277e5b7dcad83 (diff)
RT# 81249 - added ability to validate price plan option fields
Conflicts: httemplate/edit/part_pkg.cgi
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_pkg.pm8
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm4
-rw-r--r--FS/FS/part_pkg/voip_inbound.pm4
3 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index cad761498..78f5dc097 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -583,6 +583,14 @@ sub replace {
'';
}
+sub validate_number {
+ my ($option, $valref) = @_;
+ $$valref = 0 unless $$valref;
+ return "Invalid $option"
+ unless ($$valref) = ($$valref =~ /^\s*(\d+)\s*$/);
+ return '';
+}
+
=item check
Checks all fields to make sure this is a valid package definition. If
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 342f27255..3a6315910 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -173,9 +173,13 @@ tie my %accountcode_tollfree_field, 'Tie::IxHash',
},
'use_cdrtypenum' => { 'name' => 'Only charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'ignore_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this calltypenum: ',
diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm
index 6af6dc375..22ca79694 100644
--- a/FS/FS/part_pkg/voip_inbound.pm
+++ b/FS/FS/part_pkg/voip_inbound.pm
@@ -64,9 +64,13 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
},
'use_cdrtypenum' => { 'name' => 'Only charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'ignore_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is set to this cdrtypenum: ',
+ 'validate' => \&FS::part_pkg::validate_number,
+ 'js_validate' => 'digits',
},
'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ',