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;
110 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
116 $this->results = array(
'myreturn' => 999);
117 $this->resprints =
'A text to show';
120 $this->errors[] =
'Error message';
137 global $conf, $user, $langs;
142 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
143 foreach ($parameters[
'toselect'] as $objectid) {
149 $this->results = array(
'myreturn' => 999);
150 $this->resprints =
'A text to show';
153 $this->errors[] =
'Error message';
170 global $conf, $user, $langs;
176 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
177 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
183 $this->errors[] =
'Error message';
202 global $conf, $user, $langs;
205 $outputlangs = $langs;
209 dol_syslog(get_class($this).
'::executeHooks action='.$action);
212 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
230 global $conf, $user, $langs;
233 $outputlangs = $langs;
237 dol_syslog(get_class($this).
'::executeHooks action='.$action);
240 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
261 $langs->load(
"mymodule@mymodule");
263 $this->results = array();
268 if ($parameters[
'tabfamily'] ==
'mymodule') {
270 $head[$h][1] = $langs->trans(
"Home");
271 $head[$h][2] =
'home';
274 $this->results[
'title'] = $langs->trans(
"MyModule");
275 $this->results[
'picto'] =
'mymodule@mymodule';
278 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
279 $head[$h][1] = $langs->trans(
"CustomReports");
280 $head[$h][2] =
'customreports';
282 $this->results[
'head'] = $head;
284 $arrayoftypes = array();
287 $this->results[
'arrayoftype'] = $arrayoftypes;
308 if ($parameters[
'features'] ==
'myobject') {
309 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
310 $this->results[
'result'] = 1;
313 $this->results[
'result'] = 0;
334 global $langs, $conf, $user;
336 if (!isset($parameters[
'object']->element)) {
339 if ($parameters[
'mode'] ==
'remove') {
342 } elseif ($parameters[
'mode'] ==
'add') {
343 $langs->load(
'mymodule@mymodule');
345 $counter = count($parameters[
'head']);
346 $element = $parameters[
'object']->element;
347 $id = $parameters[
'object']->id;
350 if (in_array($element, [
'context1',
'context2'])) {
353 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' . $id .
'&module='.$element;
354 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
355 if ($datacount > 0) {
356 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
358 $parameters[
'head'][$counter][2] =
'mymoduleemails';
361 if ($counter > 0 && (
int) DOL_VERSION < 14) {
362 $this->results = $parameters[
'head'];
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
__construct($db)
Constructor.
doActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below.
loadDataForCustomReports($parameters, &$action, $hookmanager)
Overloading the loadDataForCustomReports function : returns data to complete the customreport tool.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the doMassActions function : replacing the parent's function with the one below.
restrictedArea($parameters, &$action, $hookmanager)
Overloading the restrictedArea function : check permission on an object.
afterPDFCreation($parameters, &$pdfhandler, &$action)
Execute action.
completeTabsHead(&$parameters, &$object, &$action, $hookmanager)
Execute action completeTabsHead.
beforePDFCreation($parameters, &$object, &$action)
Execute action.
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overloading 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.