Preserve query string parameters across list and edit pages (#7907)
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2022-2023
|
||||
Portions created by the Initial Developer are Copyright (C) 2022-2026
|
||||
the Initial Developer. All Rights Reserved.
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,36 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
// Set variables from http GET parameters
|
||||
$page = is_numeric($_GET['page'] ?? '') ? $_GET['page'] : 0;
|
||||
$order_by = preg_replace('#[^a-zA-Z0-9_\-]#', '', ($_GET['order_by'] ?? 'fax_date'));
|
||||
$order = ($_GET['order'] ?? '') === 'asc' ? 'asc' : 'desc';
|
||||
$search = $_GET['search'] ?? '';
|
||||
$show = $_GET['show'] ?? '';
|
||||
$fax_status = $_GET['fax_status'] ?? '';
|
||||
|
||||
// Build the query string
|
||||
$param = [];
|
||||
if (!empty($page)) {
|
||||
$param['page'] = $page;
|
||||
}
|
||||
if (!empty($_GET['order_by'])) {
|
||||
$param['order_by'] = $order_by;
|
||||
}
|
||||
if (!empty($_GET['order'])) {
|
||||
$param['order'] = $order;
|
||||
}
|
||||
if (!empty($search)) {
|
||||
$param['search'] = $search;
|
||||
}
|
||||
if (!empty($show) && $show == 'all' && permission_exists('fax_queue_all')) {
|
||||
$param['show'] = $show;
|
||||
}
|
||||
if (!empty($fax_status)) {
|
||||
$param['fax_status'] = $fax_status;
|
||||
}
|
||||
$query_string = http_build_query($param);
|
||||
|
||||
//action add or update
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
@@ -73,7 +103,7 @@
|
||||
$token = new token;
|
||||
if (!$token->validate($_SERVER['PHP_SELF'])) {
|
||||
message::add($text['message-invalid_token'],'negative');
|
||||
header('Location: fax_queue.php');
|
||||
header('Location: fax_queue.php'.($query_string ? '?'.$query_string : ''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -101,8 +131,8 @@
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
if (in_array($_POST['action'], array('copy', 'delete', 'toggle') && is_uuid($id))) {
|
||||
header('Location: fax_queue_edit.php?id='.$id);
|
||||
if (in_array($_POST['action'], array('copy', 'delete', 'toggle')) && is_uuid($id)) {
|
||||
header('Location: fax_queue_edit.php?id='.$id.($query_string ? '&'.$query_string : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -173,7 +203,7 @@
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
//header('Location: fax_queue.php');
|
||||
header('Location: fax_queue_edit.php?id='.urlencode($fax_queue_uuid));
|
||||
header('Location: fax_queue_edit.php?id='.urlencode($fax_queue_uuid).($query_string ? '&'.$query_string : ''));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +269,7 @@
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-fax_queue']."</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'fax_queue.php']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$settings->get('theme', 'button_icon_back'),'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'fax_queue.php'.($query_string ? '?'.$query_string : '')]);
|
||||
if ($action == 'update') {
|
||||
if (permission_exists('_add')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
|
||||
Reference in New Issue
Block a user