27require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
47 public $errors = array();
53 public $results = array();
89 global $db, $langs, $conf, $user;
90 $this->resprints =
'';
105 global $conf, $user, $langs;
111 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
117 $this->results = array(
'myreturn' => 999);
118 $this->resprints =
'A text to show';
121 $this->errors[] =
'Error message';
138 global $conf, $user, $langs;
143 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
145 foreach ($parameters[
'toselect'] as $objectid) {
151 $this->results = array(
'myreturn' => 999);
152 $this->resprints =
'A text to show';
155 $this->errors[] =
'Error message';
172 global $conf, $user, $langs;
178 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
179 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
185 $this->errors[] =
'Error message';
204 global $conf, $user, $langs;
207 $outputlangs = $langs;
211 dol_syslog(get_class($this).
'::executeHooks action='.$action);
215 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
233 global $conf, $user, $langs;
236 $outputlangs = $langs;
240 dol_syslog(get_class($this).
'::executeHooks action='.$action);
244 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
265 $langs->load(
"mymodule@mymodule");
267 $this->results = array();
272 if ($parameters[
'tabfamily'] ==
'mymodule') {
274 $head[$h][1] = $langs->trans(
"Home");
275 $head[$h][2] =
'home';
278 $this->results[
'title'] = $langs->trans(
"MyModule");
279 $this->results[
'picto'] =
'mymodule@mymodule';
282 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
283 $head[$h][1] = $langs->trans(
"CustomReports");
284 $head[$h][2] =
'customreports';
286 $this->results[
'head'] = $head;
288 $arrayoftypes = array();
291 $this->results[
'arrayoftype'] = $arrayoftypes;
312 if ($parameters[
'features'] ==
'myobject') {
313 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
314 $this->results[
'result'] = 1;
317 $this->results[
'result'] = 0;
338 global $langs, $conf, $user;
340 if (!isset($parameters[
'object']->element)) {
343 if ($parameters[
'mode'] ==
'remove') {
346 } elseif ($parameters[
'mode'] ==
'add') {
347 $langs->load(
'mymodule@mymodule');
349 $counter = count($parameters[
'head']);
350 $element = $parameters[
'object']->element;
351 $id = $parameters[
'object']->id;
354 if (in_array($element, [
'context1',
'context2'])) {
357 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' .
$id .
'&module='.$element;
358 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
359 if ($datacount > 0) {
360 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
362 $parameters[
'head'][$counter][2] =
'mymoduleemails';
365 if ($counter > 0 && (
int) DOL_VERSION < 14) {
366 $this->results = $parameters[
'head'];
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
__construct($db)
Constructor.
doActions($parameters, &$object, &$action, $hookmanager)
Overload the doActions function : replacing the parent's function with the one below.
loadDataForCustomReports($parameters, &$action, $hookmanager)
Overload the loadDataForCustomReports function : returns data to complete the customreport tool.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overload the doMassActions function : replacing the parent's function with the one below.
restrictedArea($parameters, &$action, $hookmanager)
Overload the restrictedArea function : check permission on an object.
afterPDFCreation($parameters, &$pdfhandler, &$action)
Execute action after PDF (document) creation.
completeTabsHead(&$parameters, &$object, &$action, $hookmanager)
Execute action completeTabsHead.
beforePDFCreation($parameters, &$object, &$action)
Execute action before PDF (document) creation.
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overload the addMoreMassActions function : replacing the parent's function with the one below.
getNomUrl($parameters, &$object, &$action)
Execute action.
Parent class of all other hook actions classes.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.