projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merging RT 4.0.6
[freeside.git]
/
FS
/
FS
/
cust_pkg_discount.pm
diff --git
a/FS/FS/cust_pkg_discount.pm
b/FS/FS/cust_pkg_discount.pm
index
3770a2b
..
a207940
100644
(file)
--- a/
FS/FS/cust_pkg_discount.pm
+++ b/
FS/FS/cust_pkg_discount.pm
@@
-106,6
+106,7
@@
sub insert {
'amount' => $self->amount,
'percent' => $self->percent,
'months' => $self->months,
'amount' => $self->amount,
'percent' => $self->percent,
'months' => $self->months,
+ 'setup' => $self->setup,
'disabled' => 'Y',
};
my $error = $discount->insert;
'disabled' => 'Y',
};
my $error = $discount->insert;
@@
-165,10
+166,16
@@
sub check {
|| $self->ut_float('months_used') #actually decimal, but this will do
|| $self->ut_numbern('end_date')
|| $self->ut_alphan('otaker')
|| $self->ut_float('months_used') #actually decimal, but this will do
|| $self->ut_numbern('end_date')
|| $self->ut_alphan('otaker')
+ || $self->ut_numbern('usernum')
|| $self->ut_enum('disabled', [ '', 'Y' ] )
;
return $error if $error;
|| $self->ut_enum('disabled', [ '', 'Y' ] )
;
return $error if $error;
+ return "Discount does not apply to setup fees, and package has no recurring"
+ if ! $self->discount->setup && $self->cust_pkg->part_pkg->freq =~ /^0/;
+
+ $self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
+
$self->SUPER::check;
}
$self->SUPER::check;
}