From 351b18827db52ffc39a882420c2660a8e78d6e3a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 13 May 2020 15:31:50 +0200 Subject: [PATCH] customAction & customSearchAction: do not show question template if no confirmation need and action executed --- src/includes/routes.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/includes/routes.php b/src/includes/routes.php index 94aed4bd..bc2182b3 100644 --- a/src/includes/routes.php +++ b/src/includes/routes.php @@ -535,6 +535,9 @@ function handle_LSobject_search_customAction($request) { $objectname = $object -> getDisplayName(); $title = isset($config['label'])?__($config['label']):$customAction; + // Define page title + LStemplate :: assign('pagetitle', $title); + // Run search customAction (if validated or no confirmation need) if (isset($_GET['valid']) || $config['noConfirmation']) { if (call_user_func_array($config['function'], array(&$LSsearch))) { @@ -552,10 +555,12 @@ function handle_LSobject_search_customAction($request) { else { LSerror :: addErrorCode('LSsearch_16', $customAction); } + // Custom action executed: show its template (if not already redirect) + LSsession :: displayTemplate(); + return; } - // Define page title & template variables - LStemplate :: assign('pagetitle', $title); + // Need confirmation: set template variables and show it LStemplate :: assign( 'question', ( @@ -1205,6 +1210,8 @@ function handle_LSobject_customAction($request) { $objectname = $object -> getDisplayName(); $title = isset($config['label'])?__($config['label']):$customAction; + // Define page title + LStemplate :: assign('pagetitle', $title.' : '.$objectname); // Run customAction (if validated or noConfirmation required) if (isset($_GET['valid']) || (isset($config['noConfirmation']) && $config['noConfirmation'])) { @@ -1233,10 +1240,12 @@ function handle_LSobject_customAction($request) { else { LSerror :: addErrorCode('LSldapObject_31', array('objectname' => $objectname, 'customAction' => $customAction)); } + // Custom action executed: show its template (if not already redirect) + LSsession :: displayTemplate(); + return; } - // Define page title & template variables - LStemplate :: assign('pagetitle', $title.' : '.$objectname); + // Need confirmation: set template variables and show it LStemplate :: assign( 'question', (