X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fdiscount.pm;h=4f42c5b72d3149265cb9f0f6067dd373d04712c4;hb=d173c0ab4d47eea5fc0d76b9f8d94b7dc6a44cfb;hp=8afeb2e0c06b4935a896feb12698553804ce4e7d;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm index 8afeb2e0c..4f42c5b72 100644 --- a/FS/FS/discount.pm +++ b/FS/FS/discount.pm @@ -133,6 +133,17 @@ sub check { ; return $error if $error; + #discourage non-integer months for package discounts + if ($self->discountnum) { + my $sql = + "SELECT count(*) FROM part_pkg_discount WHERE part_pkg_discount.discountnum = ". + $self->discountnum; + + my $count = $self->scalar_sql($sql); + return "months must be integers greater than 1" + if ( $count && ($self->ut_number('months') || $self->months < 2) ); + } + $self->SUPER::check; }