X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=f8720a9c79758f44e3f5064c3544c1a4dbe19a17;hb=38f5c59a6a3b92881c0f60bc8dccc9acd0feef41;hp=356c0c038015a95d9eb4c5033713480b9751cd6b;hpb=057fc61586d26199005660b908ece68a7a1da681;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 356c0c038..f8720a9c7 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 @@ -1889,11 +1900,11 @@ Frequency override (for calc_recur) This option is filled in by the method rather than controlling its operation. It is an arrayref. Applicable discounts will be added to the arrayref, as -L. +L records. =item real_pkgpart -For package add-ons, is the base L, otherwise +For package add-ons, is the base L package definition, otherwise no different than pkgpart. =item precommit_hooks @@ -1917,7 +1928,7 @@ plan option prorate_defer_bill). =back Note: Don't calculate prices when not actually billing the package. For that, -see the L and L methods. +see the L and L methods. =cut