X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fpart_pkg.pm;h=bf607849bc530aa6508e1bafc7b18192c1cf9bce;hb=103dfde149eec5034696d073253255f508a1be78;hp=356c0c038015a95d9eb4c5033713480b9751cd6b;hpb=057fc61586d26199005660b908ece68a7a1da681;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 356c0c038..bf607849b 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 @@ -1869,7 +1880,7 @@ sub _rebless { =item calc_setup CUST_PKG START_DATE DETAILS_ARRAYREF OPTIONS_HASHREF -=item calc_recur CUST_PKG START_DATE DETAILS_ARRAYREF OPTIONS_HASHREF +=item calc_recur CUST_PKG START_DATE_SCALARREF DETAILS_ARRAYREF OPTIONS_HASHREF Calculates and returns the setup or recurring fees, respectively, for this package. Implementation is in the FS::part_pkg:* module specific to this price @@ -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