diff options
Diffstat (limited to 'FS/FS/discount.pm')
-rw-r--r-- | FS/FS/discount.pm | 11 |
1 files changed, 11 insertions, 0 deletions
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; } |