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'))) {
116 $this->results = array(
'myreturn' => 999);
117 $this->resprints =
'A text to show';
120 $this->errors[] =
'Error message';
140 global
$conf, $user, $langs;
145 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
147 foreach ($parameters[
'toselect'] as $objectid) {
152 $this->results = array(
'myreturn' => 999);
153 $this->resprints =
'A text to show';
156 $this->errors[] =
'Error message';
176 global
$conf, $user, $langs;
182 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
183 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
189 $this->errors[] =
'Error message';
208 global
$conf, $user, $langs;
211 $outputlangs = $langs;
215 dol_syslog(get_class($this).
'::executeHooks action='.$action);
219 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
237 global
$conf, $user, $langs;
240 $outputlangs = $langs;
244 dol_syslog(get_class($this).
'::executeHooks action='.$action);
248 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
269 $langs->load(
"mymodule@mymodule");
271 $this->results = array();
276 if ($parameters[
'tabfamily'] ==
'mymodule') {
278 $head[$h][1] = $langs->trans(
"Home");
279 $head[$h][2] =
'home';
282 $this->results[
'title'] = $langs->trans(
"MyModule");
283 $this->results[
'picto'] =
'mymodule@mymodule';
286 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
287 $head[$h][1] = $langs->trans(
"CustomReports");
288 $head[$h][2] =
'customreports';
290 $this->results[
'head'] = $head;
292 $arrayoftypes = array();
295 $this->results[
'arrayoftype'] = $arrayoftypes;
316 if ($parameters[
'features'] ==
'myobject') {
317 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
318 $this->results[
'result'] = 1;
321 $this->results[
'result'] = 0;
342 global $langs,
$conf, $user;
344 if (!isset($parameters[
'object']->element)) {
347 if ($parameters[
'mode'] ==
'remove') {
350 } elseif ($parameters[
'mode'] ==
'add') {
351 $langs->load(
'mymodule@mymodule');
353 $counter = count($parameters[
'head']);
354 $element = $parameters[
'object']->element;
355 $id = $parameters[
'object']->id;
358 if (in_array($element, [
'context1',
'context2'])) {
361 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' .
$id .
'&module='.$element;
362 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
363 if ($datacount > 0) {
364 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
366 $parameters[
'head'][$counter][2] =
'mymoduleemails';
369 if ($counter > 0 && (
int) DOL_VERSION < 14) {
370 $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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...