projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae6359e
)
RT# 81249 - Fixed error where empty field becomes 0.
author
Christopher Burger
<burgerc@freeside.biz>
Thu, 10 Jan 2019 01:19:26 +0000
(20:19 -0500)
committer
Christopher Burger
<burgerc@freeside.biz>
Thu, 10 Jan 2019 14:34:44 +0000
(09:34 -0500)
FS/FS/part_pkg.pm
patch
|
blob
|
history
FS/FS/part_pkg/voip_cdr.pm
patch
|
blob
|
history
FS/FS/part_pkg/voip_inbound.pm
patch
|
blob
|
history
httemplate/edit/elements/edit.html
patch
|
blob
|
history
diff --git
a/FS/FS/part_pkg.pm
b/FS/FS/part_pkg.pm
index
1895404
..
4aa2926
100644
(file)
--- a/
FS/FS/part_pkg.pm
+++ b/
FS/FS/part_pkg.pm
@@
-695,12
+695,23
@@
sub replace {
sub validate_number {
my ($option, $valref) = @_;
sub validate_number {
my ($option, $valref) = @_;
+
$$valref = 0 unless $$valref;
return "Invalid $option"
unless ($$valref) = ($$valref =~ /^\s*(\d+)\s*$/);
return '';
}
$$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
=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
(file)
--- 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: ',
},
'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: ',
},
'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: ',
},
'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
45a7428
..
aecbe33
100644
(file)
--- 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: ',
},
'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: ',
},
'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: ',
},
'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ',
diff --git
a/httemplate/edit/elements/edit.html
b/httemplate/edit/elements/edit.html
index
819b8bd
..
a960172
100644
(file)
--- a/
httemplate/edit/elements/edit.html
+++ b/
httemplate/edit/elements/edit.html
@@
-823,13
+823,13
@@
Example:
% ## set extra field values for validation. ie price plan fields
% my $extra_fields_to_validate = $opt{'extra_fields_validate'};
% my %validate_error_messages = (
% ## set extra field values for validation. ie price plan fields
% my $extra_fields_to_validate = $opt{'extra_fields_validate'};
% my %validate_error_messages = (
-% 'digits' => 'Please only enter numbers here.',
-% 'email' => 'Please enter a valid email here.',
+% 'digits
: true
' => 'Please only enter numbers here.',
+% 'email
: true
' => 'Please enter a valid email here.',
% );
% foreach my $extra_fields (keys %$extra_fields_to_validate) {
% my $validate_type = $extra_fields_to_validate->{$extra_fields};
% );
% foreach my $extra_fields (keys %$extra_fields_to_validate) {
% my $validate_type = $extra_fields_to_validate->{$extra_fields};
-% $js_form_validate->{edit_topform}->{validate_fields}{$extra_fields} = $validate_type
.': true'
;
-%
$js_form_validate->{edit_topform}->{error_message}{$extra_fields} = $validate_error_messages{$validate_type};
+% $js_form_validate->{edit_topform}->{validate_fields}{$extra_fields} = $validate_type;
+% $js_form_validate->{edit_topform}->{error_message}{$extra_fields} = $validate_error_messages{$validate_type};
% }
% unless ($opt{'embed'}) {
% }
% unless ($opt{'embed'}) {