projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
54e557f
)
start implementing billing add-ons
author
ivan
<ivan>
Wed, 16 Apr 2008 21:52:38 +0000
(21:52 +0000)
committer
ivan
<ivan>
Wed, 16 Apr 2008 21:52:38 +0000
(21:52 +0000)
FS/FS/cust_main.pm
patch
|
blob
|
history
FS/FS/part_pkg.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
168c43d
..
c7d497a
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-2093,7
+2093,8
@@
sub bill {
$cust_pkg->setfield('bill', '')
unless defined($cust_pkg->bill);
$cust_pkg->setfield('bill', '')
unless defined($cust_pkg->bill);
- my $part_pkg = $cust_pkg->part_pkg;
+ #my $part_pkg = $cust_pkg->part_pkg;
+ my @part_pkg = $cust_pkg->part_pkg->self_and_bill_linked;
my %hash = $cust_pkg->hash;
my $old_cust_pkg = new FS::cust_pkg \%hash;
my %hash = $cust_pkg->hash;
my $old_cust_pkg = new FS::cust_pkg \%hash;
@@
-2138,7
+2139,7
@@
sub bill {
# XXX should this be a package event? probably. events are called
# at collection time at the moment, though...
# XXX should this be a package event? probably. events are called
# at collection time at the moment, though...
-
if ( $part_pkg->can('reset_usage')
) {
+
foreach my $part_pkg ( grep { $_->can('reset_usage') } @part_pkg
) {
warn " resetting usage counters" if $DEBUG > 1;
$part_pkg->reset_usage($cust_pkg);
}
warn " resetting usage counters" if $DEBUG > 1;
$part_pkg->reset_usage($cust_pkg);
}
diff --git
a/FS/FS/part_pkg.pm
b/FS/FS/part_pkg.pm
index
96bd019
..
fd43e61
100644
(file)
--- a/
FS/FS/part_pkg.pm
+++ b/
FS/FS/part_pkg.pm
@@
-755,6
+755,19
@@
sub _part_pkg_link {
);
}
);
}
+sub self_and_bill_linked {
+ shift->_self_and_linked('bill', @_);
+}
+
+sub _self_and_linked {
+ my( $self, $type ) = @_;
+
+ ( $self,
+ map { $_->dst_pkg->_self_and_linked($type) }
+ $self->_part_pkg_link($type)
+ );
+}
+
=item part_pkg_taxoverride
Returns all associated FS::part_pkg_taxoverride objects (see
=item part_pkg_taxoverride
Returns all associated FS::part_pkg_taxoverride objects (see