diff --git a/app/call_recordings/call_recordings.php b/app/call_recordings/call_recordings.php index acf529e92e..9e2bc22752 100644 --- a/app/call_recordings/call_recordings.php +++ b/app/call_recordings/call_recordings.php @@ -42,6 +42,49 @@ $language = new text; $text = $language->get(); +//get the action + if (is_array($_POST["call_recordings"])) { + $call_recordings = $_POST["call_recordings"]; + foreach($call_recordings as $row) { + if ($row['action'] == 'download') { + $action = 'download'; + break; + } + if ($row['action'] == 'delete') { + $action = 'delete'; + break; + } + } + } + +//download recordings + if (permission_exists('call_recording_download')) { + if ($action == "download") { + //download + $obj = new call_recordings; + $obj->download($call_recordings); + //delete message + messages::add($text['message-add']); + } + } + +//delete the recordings + if (permission_exists('call_recording_delete')) { + if ($action == "delete") { + //set the array + $call_recordings = $_POST["call_recordings"]; + //download + $obj = new call_recordings; + $obj->delete($call_recordings); + //delete message + messages::add($text['message-delete']); + } + } + +//additional includes + require_once "resources/header.php"; + require_once "resources/paging.php"; + //get variables used to control the order $order_by = check_str($_GET["order_by"]); $order = check_str($_GET["order"]); @@ -57,23 +100,6 @@ $sql_search .= ") "; } -//delete the recordings - if (permission_exists('call_recording_delete')) { - if (is_array($_POST["call_recordings"])) { - //set the array - $call_recordings = $_POST["call_recordings"]; - //download - $obj = new call_recordings; - $obj->delete($call_recordings); - //delete message - messages::add($text['message-delete']); - } - } - -//additional includes - require_once "resources/header.php"; - require_once "resources/paging.php"; - //prepare to page the results $sql = "select count(call_recording_uuid) as num_rows from v_call_recordings "; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; @@ -133,15 +159,18 @@ echo "\n"; //show the content + echo "