TT#24850 fix POST /api/invoices

+ apply suppression rs decoration for cdr rs as last
  step, after any "select =>"

Change-Id: I4caf8b897ab10ef0900a51bfc0ec427c958758bb
(cherry picked from commit 88c8b81580)
changes/00/17300/1
Rene Krenn 8 years ago committed by Irina Peshinskaya
parent 116a6405d4
commit 735fbcd2db

@ -297,7 +297,15 @@ sub get_contract_calls_rs{
$stime ||= NGCP::Panel::Utils::DateTime::current_local()->truncate( to => 'month' );
$etime ||= $stime->clone->add( months => 1 );
my $calls_rs = NGCP::Panel::Utils::CallList::call_list_suppressions_rs($c,$c->model('DB')->resultset('cdr')->search_rs( {
my @cols = ();
push(@cols,qw/source_user source_domain source_cli destination_user_in/);
#push(@cols,NGCP::Panel::Utils::CallList::get_suppression_id_colnames());
push(@cols,qw/start_time duration call_type source_customer_cost/);
my @colnames = @cols;
push(@cols,qw/source_customer_billing_zones_history.zone source_customer_billing_zones_history.detail/);
push(@colnames,qw/zone zone_detail/);
my $calls_rs = $c->model('DB')->resultset('cdr')->search_rs({
# source_user_id => { 'in' => [ map {$_->uuid} @{$contract->{subscriber}} ] },
'call_status' => 'ok',
'source_user_id' => { '!=' => '0' },
@ -307,22 +315,15 @@ sub get_contract_calls_rs{
{ '<=' => $etime->epoch},
],
'source_account_id' => $customer_contract_id,
},undef ),NGCP::Panel::Utils::CallList::SUPPRESS_INOUT);
my @cols = ();
push(@cols,qw/source_user source_domain source_cli destination_user_in/);
push(@cols,NGCP::Panel::Utils::CallList::get_suppression_id_colnames());
push(@cols,qw/start_time duration call_type source_customer_cost/);
my @colnames = @cols;
push(@cols,qw/source_customer_billing_zones_history.zone source_customer_billing_zones_history.detail/);
push(@colnames,qw/zone zone_detail/);
return $calls_rs->search_rs(undef,{
},{
select => \@cols,
as => \@colnames,
'join' => 'source_customer_billing_zones_history',
'order_by' => 'start_time',
} );
});
#suppression rs decoration at last, after any "select =>"
return NGCP::Panel::Utils::CallList::call_list_suppressions_rs($c,$calls_rs,NGCP::Panel::Utils::CallList::SUPPRESS_INOUT);
}

Loading…
Cancel
Save