dolibarr 24.0.0-beta
actions_blockedlog.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) ---Replace with your own copyright and developer email---
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25require_once DOL_DOCUMENT_ROOT.'/core/class/commonhookactions.class.php';
26
31{
35 public $db;
36
40 public $error = '';
41
45 public $errors = array();
46
47
51 public $results = array();
52
56 public $resprints;
57
61 public $priority;
62
63
69 public function __construct($db)
70 {
71 $this->db = $db;
72 }
73
74
85 public function beforePDFCreation($parameters, &$object, &$action)
86 {
87 global $conf, $user, $langs;
88 global $hookmanager;
89
90 $outputlangs = $langs;
91
92 $ret = 0;
93 $deltemp = array();
94 dol_syslog(get_class($this).'::executeHooks action='.$action);
95
96 /* print_r($parameters); print_r($object); echo "action: " . $action; */
97 // @phan-suppress-next-line PhanPluginEmptyStatementIf
98 if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) {
99 // do something only for the context 'somecontext1' or 'somecontext2'
100 }
101
102 return $ret;
103 }
104
115 public function afterPDFCreation($parameters, &$pdfhandler, &$action)
116 {
117 global $conf, $user, $langs;
118 global $hookmanager;
119
120 $outputlangs = $langs;
121
122 $ret = 0;
123 $deltemp = array();
124 dol_syslog(get_class($this).'::executeHooks action='.$action);
125
126 /* print_r($parameters); print_r($object); echo "action: " . $action; */
127 // @phan-suppress-next-line PhanPluginEmptyStatementIf
128 if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) {
129 // do something only for the context 'somecontext1' or 'somecontext2'
130 }
131
132 return $ret;
133 }
134
135
136
145 /*
146 public function loadDataForCustomReports($parameters, &$action, $hookmanager)
147 {
148 global $langs;
149
150 $langs->load("mymodule@mymodule");
151
152 $this->results = array();
153
154 $head = array();
155 $h = 0;
156
157 if ($parameters['tabfamily'] == 'mymodule') {
158 $head[$h][0] = dol_buildpath('/module/index.php', 1);
159 $head[$h][1] = $langs->trans("Home");
160 $head[$h][2] = 'home';
161 $h++;
162
163 $this->results['title'] = $langs->trans("MyModule");
164 $this->results['picto'] = 'mymodule@mymodule';
165 }
166
167 $head[$h][0] = 'customreports.php?objecttype='.$parameters['objecttype'].(empty($parameters['tabfamily']) ? '' : '&tabfamily='.$parameters['tabfamily']);
168 $head[$h][1] = $langs->trans("CustomReports");
169 $head[$h][2] = 'customreports';
170
171 $this->results['head'] = $head;
172
173 $arrayoftypes = array();
174 //$arrayoftypes['mymodule_myobject'] = array('label' => 'MyObject', 'picto'=>'myobject@mymodule', 'ObjectClassName' => 'MyObject', 'enabled' => isModEnabled('mymodule'), 'ClassPath' => "/mymodule/class/myobject.class.php", 'langs'=>'mymodule@mymodule')
175
176 $this->results['arrayoftype'] = $arrayoftypes;
177
178 return 0;
179 }
180 */
181
182 /* Add other hook methods here... */
183}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class ActionsBlockedlog.
afterPDFCreation($parameters, &$pdfhandler, &$action)
Execute action after PDF (document) creation.
beforePDFCreation($parameters, &$object, &$action)
Execute action before PDF (document) creation.
Parent class of all other hook actions classes.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.