From dc505909fadad093dfe425694380a461bd3c9ad5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Nov 2024 22:25:00 +0100 Subject: [PATCH] Debug modulebuilder template --- .../template/class/actions_mymodule.class.php | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index cbf5174f9185f..62929391eba5a 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -111,16 +111,18 @@ public function doActions($parameters, &$object, &$action, $hookmanager) if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' // Do what you want here... // You can for example load and use call global vars like $fieldstosearchall to overwrite them, or update the database depending on $action and GETPOST values. - } - if (!$error) { - $this->results = array('myreturn' => 999); - $this->resprints = 'A text to show'; - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } } + + return 0; } @@ -145,16 +147,18 @@ public function doMassActions($parameters, &$object, &$action, $hookmanager) foreach ($parameters['toselect'] as $objectid) { // Do action on each object id } - } - if (!$error) { - $this->results = array('myreturn' => 999); - $this->resprints = 'A text to show'; - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } } + + return 0; }