Skip to content

Commit

Permalink
Debug modulebuilder template
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 6, 2024
1 parent 84c343c commit dc50590
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions htdocs/modulebuilder/template/class/actions_mymodule.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand All @@ -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;
}


Expand Down

0 comments on commit dc50590

Please sign in to comment.