X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=f8720a9c79758f44e3f5064c3544c1a4dbe19a17;hb=af2e0f2bcb710bbd288523071d2dd630e6cf401f;hp=fb0570647abff1c76b7bcbbc69c8ced26c801af4;hpb=3117b156cf3d118ae6a76c823311bfd941fbdf86;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index fb0570647..f8720a9c7 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -693,6 +693,25 @@ 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 @@ -1881,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 @@ -1909,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