From 0cd86ff68f0f21566daf66adf1d0ba601603e697 Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Mon, 20 Feb 2017 16:27:15 +0100 Subject: [PATCH] TT#5811 MT#15667 MT#15793 api/callist "call_id" param - including the desired sorting by call leg depth - "... order by length(call_id) asc, start_time asc;" seems to cover the call flow sceanrios. Change-Id: I294c27985627bea6a9acdaff8aeedc84e365c34e --- lib/NGCP/Panel/Controller/API/CallLists.pm | 17 +++++++++++++++++ lib/NGCP/Panel/Role/API/CallLists.pm | 1 + 2 files changed, 18 insertions(+) diff --git a/lib/NGCP/Panel/Controller/API/CallLists.pm b/lib/NGCP/Panel/Controller/API/CallLists.pm index bb7df4d65f..4ec1122492 100644 --- a/lib/NGCP/Panel/Controller/API/CallLists.pm +++ b/lib/NGCP/Panel/Controller/API/CallLists.pm @@ -205,6 +205,23 @@ sub query_params { second => sub {}, }, }, + { + param => 'call_id', + description => 'Filter for a particular call_id and sort by call leg depth.', + query => { + first => sub { + my $q = shift; + { + call_id => { like => $q.'%' }, + }; + }, + second => sub { + { + order_by => \"length(call_id) ASC, start_time ASC", + }; + }, + }, + }, ]; } diff --git a/lib/NGCP/Panel/Role/API/CallLists.pm b/lib/NGCP/Panel/Role/API/CallLists.pm index c1f9ae45ab..e19e1e6430 100644 --- a/lib/NGCP/Panel/Role/API/CallLists.pm +++ b/lib/NGCP/Panel/Role/API/CallLists.pm @@ -21,6 +21,7 @@ sub _item_rs { my ($self, $c) = @_; my $item_rs = $c->model('DB')->resultset('cdr'); + if($c->user->roles eq "admin") { } elsif($c->user->roles eq "reseller") { $item_rs = $item_rs->search({