X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=176d97efee44bbc8a283e3b44f6712fd40350f81;hb=7ed03cd3b992a5df6c786686a5271eea65611dbc;hp=1895404d9512cf2b28d25ae548d643aeedcc83db;hpb=ae6359efac06d899093f799052ef8d472effbe98;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 1895404d9..176d97efe 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 @@ -1875,11 +1886,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 @@ -1903,7 +1914,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