summaryrefslogtreecommitdiff
path: root/FS/FS/part_pkg.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-04-25 16:18:10 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-04-25 16:21:50 -0500
commit17082fbc034dac221ff1748f19a9114306a829cf (patch)
treefb8142ffbf9c4722f417d964c58513aa91d54834 /FS/FS/part_pkg.pm
parent0ea99482851f5c4d7afa6cfc9c08c3b29f0732a8 (diff)
RT#41866: Punctuation prevented package from billing
Diffstat (limited to 'FS/FS/part_pkg.pm')
-rw-r--r--FS/FS/part_pkg.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 9ed623f..709e137 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -770,6 +770,32 @@ sub check {
'';
}
+=item check_options
+
+For a passed I<$options> hashref, validates any options that
+have 'validate' subroutines defined (I<$options> values might
+be altered.) Returns error message, or empty string if valid.
+
+Invoked by L</insert> and L</replace> via the equivalent
+methods in L<FS::option_Common>.
+
+=cut
+
+sub check_options {
+ my ($self,$options) = @_;
+ foreach my $option (keys %$options) {
+ if (exists $plans{ $self->plan }->{fields}->{$option}) {
+ if (exists($plans{$self->plan}->{fields}->{$option}->{'validate'})) {
+ # pass option name for use in error message
+ # pass a reference to the $options value, so it can be cleaned up
+ my $error = &{$plans{$self->plan}->{fields}->{$option}->{'validate'}}($option,\($options->{$option}));
+ return $error if $error;
+ }
+ } # else "option does not exist" error?
+ }
+ return '';
+}
+
=item check_pkg_svc
Checks pkg_svc records as a whole (for part_svc_link dependencies).