diff options
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/part_pkg.pm | 8 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 4 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_inbound.pm | 4 |
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: ', |
