# 2. the recipient of the commission; may be FS::sales, FS::agent,
# FS::access_user, etc. Here we don't use it, but it will be passed through
# to _calc_credit_percent.
+# 3. optional scalar reference for recording a warning message
sub _calc_credit {
my $self = shift;
# don't multiply by quantity here; it's already included
}
- $$warnref .= $warning if ref($warnref);
+ if ($charge < 0) { # e.g. prorate
+ $charge = 0;
+ $warning .= 'Negative charge set to zero ';
+ }
- $charge = 0 if $charge < 0; # e.g. prorate
+ $$warnref .= $warning if ref($warnref);
return ($percent * $charge / 100);
}