From 3d4fe6e5c17b6e92534141b0c793c61026a1b659 Mon Sep 17 00:00:00 2001 From: frytimo Date: Wed, 11 Dec 2024 17:53:55 -0400 Subject: [PATCH] fix call forward back button on save (#7196) * fix call forward back button on save --- app/call_forward/call_forward.php | 3 +++ app/call_forward/call_forward_edit.php | 5 ++++- app/extensions/extension_edit.php | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/call_forward/call_forward.php b/app/call_forward/call_forward.php index e95fa55f1e..cdb478d034 100644 --- a/app/call_forward/call_forward.php +++ b/app/call_forward/call_forward.php @@ -209,6 +209,9 @@ } require_once "resources/header.php"; +//set the back button + $_SESSION['call_forward_back'] = $_SERVER['PHP_SELF']; + //show the content if ($is_included) { echo "
\n"; diff --git a/app/call_forward/call_forward_edit.php b/app/call_forward/call_forward_edit.php index 2683a22901..a1b2bc6e72 100644 --- a/app/call_forward/call_forward_edit.php +++ b/app/call_forward/call_forward_edit.php @@ -533,13 +533,16 @@ $object = new token; $token = $object->create($_SERVER['PHP_SELF']); +//save the back button location using referer + $back_destination = "window.location.href='" . ($_SESSION['call_forward_back'] ?? "/app/call_forward/call_forward.php") . "'"; + //show the content echo "
\n"; echo "
\n"; echo "
".$text['title-call_forward']."
\n"; echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','onclick'=>'history.back();']); + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','onclick'=>$back_destination]); echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']); echo "
\n"; echo "
\n"; diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index b04b7a3705..8542c3430b 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1061,6 +1061,9 @@ $object = new token; $token = $object->create($_SERVER['PHP_SELF']); +//set the back button + $_SESSION['call_forward_back'] = $_SERVER['PHP_SELF'] . "?id=$extension_uuid"; + //begin the page content require_once "resources/header.php"; if ($action == "update") {