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:19:26 -0500 |
commit | d03d9432be02de2abb9ff3d978ad1bdd67ea89d9 (patch) | |
tree | 054d18941aa70d4e35e382694b36184fae8655db /FS | |
parent | 057fc61586d26199005660b908ece68a7a1da681 (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 356c0c0..05cbf1b 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -695,12 +695,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 715d5c0..74deb8b 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -166,13 +166,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 67c53af..6358af2 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: ', |