projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git]
/
FS
/
FS
/
part_pkg
/
voip_tiered.pm
diff --git
a/FS/FS/part_pkg/voip_tiered.pm
b/FS/FS/part_pkg/voip_tiered.pm
index
e5dcf6d
..
d8d74c1
100644
(file)
--- a/
FS/FS/part_pkg/voip_tiered.pm
+++ b/
FS/FS/part_pkg/voip_tiered.pm
@@
-132,9
+132,11
@@
sub calc_usage {
$options{'inbound'} = ( $pass eq 'inbound' );
$options{'inbound'} = ( $pass eq 'inbound' );
- foreach my $cdr (
- $svc_x->get_cdrs( %options )
- ) {
+ my $cdr_search = $svc_x->psearch_cdrs(%options);
+ $cdr_search->limit(1000);
+ $cdr_search->increment(0);
+ while ( my $cdr = $cdr_search->fetch ) {
+
if ( $DEBUG > 1 ) {
warn "rating CDR $cdr\n".
join('', map { " $_ => ". $cdr->{$_}. "\n" } keys %$cdr );
if ( $DEBUG > 1 ) {
warn "rating CDR $cdr\n".
join('', map { " $_ => ". $cdr->{$_}. "\n" } keys %$cdr );
@@
-173,6
+175,8
@@
sub calc_usage {
$total += $charge_min;
$total += $charge_min;
+ $cdr_search->adjust(1) if $cdr->freesidestatus eq '';
+
} # $cdr
} # $pass
} # $cdr
} # $pass
@@
-213,9
+217,10
@@
sub calc_usage {
# tell the formatter what we're sending it
$formatter->inbound($options{'inbound'});
# tell the formatter what we're sending it
$formatter->inbound($options{'inbound'});
- foreach my $cdr (
- $svc_x->get_cdrs( %options )
- ) {
+ my $cdr_search = $svc_x->psearch_cdrs(%options);
+ $cdr_search->limit(1000);
+ $cdr_search->increment(0);
+ while ( my $cdr = $cdr_search->fetch ) {
my $object = $options{'inbound'}
? $cdr->cdr_termination( 1 ) #1: inbound
my $object = $options{'inbound'}
? $cdr->cdr_termination( 1 ) #1: inbound
@@
-242,6
+247,8
@@
sub calc_usage {
$formatter->append($cdr);
$formatter->append($cdr);
+ $cdr_search->adjust(1) if $cdr->freesidestatus eq 'processing-tiered';
+
} # $cdr
} # $pass
} # $cdr
} # $pass