projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git]
/
FS
/
FS
/
cust_main
/
Billing.pm
diff --git
a/FS/FS/cust_main/Billing.pm
b/FS/FS/cust_main/Billing.pm
index
a18873f
..
4821ce5
100644
(file)
--- a/
FS/FS/cust_main/Billing.pm
+++ b/
FS/FS/cust_main/Billing.pm
@@
-216,6
+216,9
@@
sub cancel_expired_pkgs {
my @errors = ();
my @errors = ();
+ my @really_cancel_pkgs;
+ my @cancel_reasons;
+
CUST_PKG: foreach my $cust_pkg ( @cancel_pkgs ) {
my $cpr = $cust_pkg->last_cust_pkg_reason('expire');
my $error;
CUST_PKG: foreach my $cust_pkg ( @cancel_pkgs ) {
my $cpr = $cust_pkg->last_cust_pkg_reason('expire');
my $error;
@@
-233,14
+236,22
@@
sub cancel_expired_pkgs {
$error = '' if ref $error eq 'FS::cust_pkg';
} else { # just cancel it
$error = '' if ref $error eq 'FS::cust_pkg';
} else { # just cancel it
- $error = $cust_pkg->cancel($cpr ? ( 'reason' => $cpr->reasonnum,
- 'reason_otaker' => $cpr->otaker,
- 'time' => $time,
- )
- : ()
- );
+
+ push @really_cancel_pkgs, $cust_pkg;
+ push @cancel_reasons, $cpr;
+
}
}
- push @errors, 'pkgnum '.$cust_pkg->pkgnum.": $error" if $error;
+ }
+
+ if (@really_cancel_pkgs) {
+
+ my %cancel_opt = ( 'cust_pkg' => \@really_cancel_pkgs,
+ 'cust_pkg_reason' => \@cancel_reasons,
+ 'time' => $time,
+ );
+
+ push @errors, $self->cancel_pkgs(%cancel_opt);
+
}
join(' / ', @errors);
}
join(' / ', @errors);
@@
-1067,6
+1078,9
@@
sub _make_lines {
my $recur_billed_currency = '';
my $recur_billed_amount = 0;
my $sdate;
my $recur_billed_currency = '';
my $recur_billed_amount = 0;
my $sdate;
+
+ my $override_quantity;
+
# Conditions for billing the recurring fee:
# - the package doesn't have a future start date
# - and it's not suspended
# Conditions for billing the recurring fee:
# - the package doesn't have a future start date
# - and it's not suspended
@@
-1167,6
+1181,11
@@
sub _make_lines {
$recur_billed_amount = delete $param{'billed_amount'};
}
$recur_billed_amount = delete $param{'billed_amount'};
}
+ if ( $param{'override_quantity'} ) {
+ $override_quantity = $param{'override_quantity'};
+ $unitrecur = $recur / $override_quantity;
+ }
+
if ( $increment_next_bill ) {
my $next_bill;
if ( $increment_next_bill ) {
my $next_bill;
@@
-1241,7
+1260,7
@@
sub _make_lines {
}
}
}
}
- }
+ }
# end of recurring fee
warn "\$setup is undefined" unless defined($setup);
warn "\$recur is undefined" unless defined($recur);
warn "\$setup is undefined" unless defined($setup);
warn "\$recur is undefined" unless defined($recur);
@@
-1312,7
+1331,7
@@
sub _make_lines {
'unitrecur' => sprintf('%.2f', $unitrecur),
'recur_billed_currency' => $recur_billed_currency,
'recur_billed_amount' => $recur_billed_amount,
'unitrecur' => sprintf('%.2f', $unitrecur),
'recur_billed_currency' => $recur_billed_currency,
'recur_billed_amount' => $recur_billed_amount,
- 'quantity' => $cust_pkg->quantity,
+ 'quantity' => $
override_quantity || $
cust_pkg->quantity,
'details' => \@details,
'discounts' => [ @setup_discounts, @recur_discounts ],
'hidden' => $part_pkg->hidden,
'details' => \@details,
'discounts' => [ @setup_discounts, @recur_discounts ],
'hidden' => $part_pkg->hidden,