diff options
| author | Christopher Burger <burgerc@freeside.biz> | 2019-01-09 20:19:26 -0500 |
|---|---|---|
| committer | Christopher Burger <burgerc@freeside.biz> | 2019-01-09 20:23:02 -0500 |
| commit | e13403cc8e687d852f6986985877eaf584bb257a (patch) | |
| tree | 762bae4246955fdc75a1cc658f6aa3855b6aa948 /FS | |
| parent | 8e554db2f70c1f06cde68c138b549061514e5fdb (diff) | |
RT# 81249 - Fixed error where empty field becomes 0.
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/part_pkg.pm | 11 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 8 | ||||
| -rw-r--r-- | FS/FS/part_pkg/voip_inbound.pm | 8 |
3 files changed, 19 insertions, 8 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 78f5dc097..9b1652a6b 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -585,12 +585,23 @@ sub replace { sub validate_number { my ($option, $valref) = @_; + $$valref = 0 unless $$valref; return "Invalid $option" unless ($$valref) = ($$valref =~ /^\s*(\d+)\s*$/); return ''; } +sub validate_number_blank { + my ($option, $valref) = @_; + + if ($$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 3a6315910..b5da530ce 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -173,13 +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', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, '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', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, '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 22ca79694..7e8b8f052 100644 --- a/FS/FS/part_pkg/voip_inbound.pm +++ b/FS/FS/part_pkg/voip_inbound.pm @@ -64,13 +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', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, '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', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, 'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ', |
