customAction & customSearchAction: do not show question template if no confirmation need and action executed

This commit is contained in:
Benjamin Renard 2020-05-13 15:31:50 +02:00
parent 50c06500e6
commit 351b18827d

View file

@ -535,6 +535,9 @@ function handle_LSobject_search_customAction($request) {
$objectname = $object -> getDisplayName(); $objectname = $object -> getDisplayName();
$title = isset($config['label'])?__($config['label']):$customAction; $title = isset($config['label'])?__($config['label']):$customAction;
// Define page title
LStemplate :: assign('pagetitle', $title);
// Run search customAction (if validated or no confirmation need) // Run search customAction (if validated or no confirmation need)
if (isset($_GET['valid']) || $config['noConfirmation']) { if (isset($_GET['valid']) || $config['noConfirmation']) {
if (call_user_func_array($config['function'], array(&$LSsearch))) { if (call_user_func_array($config['function'], array(&$LSsearch))) {
@ -552,10 +555,12 @@ function handle_LSobject_search_customAction($request) {
else { else {
LSerror :: addErrorCode('LSsearch_16', $customAction); LSerror :: addErrorCode('LSsearch_16', $customAction);
} }
// Custom action executed: show its template (if not already redirect)
LSsession :: displayTemplate();
return;
} }
// Define page title & template variables // Need confirmation: set template variables and show it
LStemplate :: assign('pagetitle', $title);
LStemplate :: assign( LStemplate :: assign(
'question', 'question',
( (
@ -1205,6 +1210,8 @@ function handle_LSobject_customAction($request) {
$objectname = $object -> getDisplayName(); $objectname = $object -> getDisplayName();
$title = isset($config['label'])?__($config['label']):$customAction; $title = isset($config['label'])?__($config['label']):$customAction;
// Define page title
LStemplate :: assign('pagetitle', $title.' : '.$objectname);
// Run customAction (if validated or noConfirmation required) // Run customAction (if validated or noConfirmation required)
if (isset($_GET['valid']) || (isset($config['noConfirmation']) && $config['noConfirmation'])) { if (isset($_GET['valid']) || (isset($config['noConfirmation']) && $config['noConfirmation'])) {
@ -1233,10 +1240,12 @@ function handle_LSobject_customAction($request) {
else { else {
LSerror :: addErrorCode('LSldapObject_31', array('objectname' => $objectname, 'customAction' => $customAction)); 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 // Need confirmation: set template variables and show it
LStemplate :: assign('pagetitle', $title.' : '.$objectname);
LStemplate :: assign( LStemplate :: assign(
'question', 'question',
( (