dolibarr  18.0.6
actions_addupdatedelete.inc.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  * or see https://www.gnu.org/
17  */
18 
25 // $action or $cancel must be defined
26 // $object must be defined
27 // $permissiontoadd must be defined
28 // $permissiontodelete must be defined
29 // $backurlforlist must be defined
30 // $backtopage may be defined
31 // $noback may be defined
32 // $triggermodname may be defined
33 
34 $hidedetails = isset($hidedetails) ? $hidedetails : '';
35 $hidedesc = isset($hidedesc) ? $hidedesc : '';
36 $hideref = isset($hideref) ? $hideref : '';
37 
38 
39 if (!empty($permissionedit) && empty($permissiontoadd)) {
40  $permissiontoadd = $permissionedit; // For backward compatibility
41 }
42 
43 if ($cancel) {
44  /*var_dump($cancel);var_dump($backtopage);var_dump($backtopageforcancel);exit;*/
45  if (!empty($backtopageforcancel)) {
46  header("Location: ".$backtopageforcancel);
47  exit;
48  } elseif (!empty($backtopage)) {
49  header("Location: ".$backtopage);
50  exit;
51  }
52  $action = '';
53 }
54 
55 
56 // Action to add record
57 if ($action == 'add' && !empty($permissiontoadd)) {
58  foreach ($object->fields as $key => $val) {
59  if ($object->fields[$key]['type'] == 'duration') {
60  if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') {
61  continue; // The field was not submited to be saved
62  }
63  } else {
64  if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
65  continue; // The field was not submited to be saved
66  }
67  }
68  // Ignore special fields
69  if (in_array($key, array('rowid', 'entity', 'import_key'))) {
70  continue;
71  }
72  if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
73  if (!in_array(abs($val['visible']), array(1, 3))) {
74  continue; // Only 1 and 3 that are case to create
75  }
76  }
77 
78  // Set value to insert
79  if (preg_match('/^text/', $object->fields[$key]['type'])) {
80  $tmparray = explode(':', $object->fields[$key]['type']);
81  if (!empty($tmparray[1])) {
82  $value = GETPOST($key, $tmparray[1]);
83  } else {
84  $value = GETPOST($key, 'nohtml');
85  }
86  } elseif (preg_match('/^html/', $object->fields[$key]['type'])) {
87  $tmparray = explode(':', $object->fields[$key]['type']);
88  if (!empty($tmparray[1])) {
89  $value = GETPOST($key, $tmparray[1]);
90  } else {
91  $value = GETPOST($key, 'restricthtml');
92  }
93  } elseif ($object->fields[$key]['type'] == 'date') {
94  $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
95  } elseif ($object->fields[$key]['type'] == 'datetime') {
96  $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
97  } elseif ($object->fields[$key]['type'] == 'duration') {
98  $hour = intval(GETPOST($key.'hour', 'int'));
99  $min = intval(GETPOST($key.'min', 'int'));
100  $value = 60 * 60 * $hour + 60 * $min;
101  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
102  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
103  } elseif ($object->fields[$key]['type'] == 'boolean') {
104  $value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
105  } elseif ($object->fields[$key]['type'] == 'reference') {
106  $tmparraykey = array_keys($object->param_list);
107  $value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
108  } elseif (preg_match('/^chkbxlst:(.*)/', $object->fields[$key]['type'])) {
109  $value = '';
110  $values_arr = GETPOST($key, 'array');
111  if (!empty($values_arr)) {
112  $value = implode(',', $values_arr);
113  }
114  } else {
115  if ($key == 'lang') {
116  $value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : "";
117  } else {
118  $value = GETPOST($key, 'alphanohtml');
119  }
120  }
121  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
122  $value = ''; // This is an implicit foreign key field
123  }
124  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
125  $value = ''; // This is an explicit foreign key field
126  }
127 
128  //var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
129  $object->$key = $value;
130  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
131  $object->$key = '(PROV)';
132  }
133  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
134  $error++;
135  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
136  }
137 
138  // Validation of fields values
139  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
140  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
141  if (!$object->validateField($object->fields, $key, $value)) {
142  $error++;
143  }
144  }
145  }
146  }
147 
148  // Fill array 'array_options' with data from add form
149  if (!$error) {
150  $ret = $extrafields->setOptionalsFromPost(null, $object, '', 1);
151  if ($ret < 0) {
152  $error++;
153  }
154  }
155 
156  if (!$error) {
157  $db->begin();
158 
159  $result = $object->create($user);
160  if ($result > 0) {
161  // Creation OK
162  if (isModEnabled('categorie') && method_exists($object, 'setCategories')) {
163  $categories = GETPOST('categories', 'array:int');
164  $object->setCategories($categories);
165  }
166 
167  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
168  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
169 
170  $db->commit();
171 
172  if (empty($noback)) {
173  header("Location: " . $urltogo);
174  exit;
175  }
176  } else {
177  $db->rollback();
178 
179  $error++;
180  // Creation KO
181  if (!empty($object->errors)) {
182  setEventMessages(null, $object->errors, 'errors');
183  } else {
184  setEventMessages($object->error, null, 'errors');
185  }
186  $action = 'create';
187  }
188  } else {
189  $action = 'create';
190  }
191 }
192 
193 // Action to update record
194 if ($action == 'update' && !empty($permissiontoadd)) {
195  foreach ($object->fields as $key => $val) {
196  // Check if field was submited to be edited
197  if ($object->fields[$key]['type'] == 'duration') {
198  if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
199  continue; // The field was not submited to be saved
200  }
201  } elseif ($object->fields[$key]['type'] == 'boolean') {
202  if (!GETPOSTISSET($key)) {
203  $object->$key = 0; // use 0 instead null if the field is defined as not null
204  continue;
205  }
206  } else {
207  if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
208  continue; // The field was not submited to be saved
209  }
210  }
211  // Ignore special fields
212  if (in_array($key, array('rowid', 'entity', 'import_key'))) {
213  continue;
214  }
215  if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
216  if (!in_array(abs($val['visible']), array(1, 3, 4))) {
217  continue; // Only 1 and 3 and 4, that are cases to update
218  }
219  }
220 
221  // Set value to update
222  if (preg_match('/^text/', $object->fields[$key]['type'])) {
223  $tmparray = explode(':', $object->fields[$key]['type']);
224  if (!empty($tmparray[1])) {
225  $value = GETPOST($key, $tmparray[1]);
226  } else {
227  $value = GETPOST($key, 'nohtml');
228  }
229  } elseif (preg_match('/^html/', $object->fields[$key]['type'])) {
230  $tmparray = explode(':', $object->fields[$key]['type']);
231  if (!empty($tmparray[1])) {
232  $value = GETPOST($key, $tmparray[1]);
233  } else {
234  $value = GETPOST($key, 'restricthtml');
235  }
236  } elseif ($object->fields[$key]['type'] == 'date') {
237  $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
238  } elseif ($object->fields[$key]['type'] == 'datetime') {
239  $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
240  } elseif ($object->fields[$key]['type'] == 'duration') {
241  if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
242  $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
243  } else {
244  $value = '';
245  }
246  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
247  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
248  } elseif ($object->fields[$key]['type'] == 'boolean') {
249  $value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
250  } elseif ($object->fields[$key]['type'] == 'reference') {
251  $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
252  } elseif (preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
253  $value = '';
254  $values_arr = GETPOST($key, 'array');
255  if (!empty($values_arr)) {
256  $value = implode(',', $values_arr);
257  }
258  } else {
259  if ($key == 'lang') {
260  $value = GETPOST($key, 'aZ09');
261  } else {
262  $value = GETPOST($key, 'alphanohtml');
263  }
264  }
265  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
266  $value = ''; // This is an implicit foreign key field
267  }
268  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
269  $value = ''; // This is an explicit foreign key field
270  }
271 
272  $object->$key = $value;
273  if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
274  $error++;
275  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
276  }
277 
278  // Validation of fields values
279  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
280  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
281  if (!$object->validateField($object->fields, $key, $value)) {
282  $error++;
283  }
284  }
285  }
286 
287  if (isModEnabled('categorie')) {
288  $categories = GETPOST('categories', 'array');
289  if (method_exists($object, 'setCategories')) {
290  $object->setCategories($categories);
291  }
292  }
293  }
294 
295  // Fill array 'array_options' with data from add form
296  if (!$error) {
297  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
298  if ($ret < 0) {
299  $error++;
300  }
301  }
302 
303  if (!$error) {
304  $result = $object->update($user);
305  if ($result > 0) {
306  $action = 'view';
307  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
308  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
309  if ($urltogo && empty($noback)) {
310  header("Location: " . $urltogo);
311  exit;
312  }
313  } else {
314  $error++;
315  // Creation KO
316  setEventMessages($object->error, $object->errors, 'errors');
317  $action = 'edit';
318  }
319  } else {
320  $action = 'edit';
321  }
322 }
323 
324 // Action to update one modulebuilder field
325 $reg = array();
326 if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
327  $object->fetch(GETPOST('id', 'int'));
328 
329  $keyforfield = $reg[1];
330  if (property_exists($object, $keyforfield)) {
331  if (!empty($object->fields[$keyforfield]) && in_array($object->fields[$keyforfield]['type'], array('date', 'datetime', 'timestamp'))) {
332  $object->$keyforfield = dol_mktime(GETPOST($keyforfield.'hour'), GETPOST($keyforfield.'min'), GETPOST($keyforfield.'sec'), GETPOST($keyforfield.'month'), GETPOST($keyforfield.'day'), GETPOST($keyforfield.'year'));
333  } else {
334  $object->$keyforfield = GETPOST($keyforfield);
335  }
336 
337  $result = $object->update($user);
338 
339  if ($result > 0) {
340  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
341  $action = 'view';
342  } else {
343  $error++;
344  setEventMessages($object->error, $object->errors, 'errors');
345  $action = 'edit'.$reg[1];
346  }
347  }
348 }
349 
350 // Action to update one extrafield
351 if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
352  $object->fetch(GETPOST('id', 'int'));
353 
354  $error = 0;
355 
356  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
357  if ($ret < 0) {
358  $error++;
359  setEventMessages($extrafields->error, $object->errors, 'errors');
360  $action = 'edit_extras';
361  } else {
362  $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
363  if ($result > 0) {
364  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
365  $action = 'view';
366  } else {
367  $error++;
368  setEventMessages($object->error, $object->errors, 'errors');
369  $action = 'edit_extras';
370  }
371  }
372 }
373 
374 // Action to delete
375 if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
376  if (!($object->id > 0)) {
377  dol_print_error('', 'Error, object must be fetched before being deleted');
378  exit;
379  }
380 
381  $result = $object->delete($user);
382 
383  if ($result > 0) {
384  // Delete OK
385  setEventMessages("RecordDeleted", null, 'mesgs');
386 
387  if (empty($noback)) {
388  header("Location: " . $backurlforlist);
389  exit;
390  }
391  } else {
392  $error++;
393  if (!empty($object->errors)) {
394  setEventMessages(null, $object->errors, 'errors');
395  } else {
396  setEventMessages($object->error, null, 'errors');
397  }
398  }
399 
400  $action = '';
401 }
402 
403 // Remove a line
404 if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd)) {
405  if (method_exists($object, 'deleteline')) {
406  $result = $object->deleteline($user, $lineid); // For backward compatibility
407  } else {
408  $result = $object->deleteLine($user, $lineid);
409  }
410  if ($result > 0) {
411  // Define output language
412  $outputlangs = $langs;
413  $newlang = '';
414  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
415  $newlang = GETPOST('lang_id', 'aZ09');
416  }
417  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && is_object($object->thirdparty)) {
418  $newlang = $object->thirdparty->default_lang;
419  }
420  if (!empty($newlang)) {
421  $outputlangs = new Translate("", $conf);
422  $outputlangs->setDefaultLang($newlang);
423  }
424  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
425  if (method_exists($object, 'generateDocument')) {
426  $ret = $object->fetch($object->id); // Reload to get new records
427  $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
428  }
429  }
430 
431  setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
432 
433  if (empty($noback)) {
434  header('Location: '.((empty($backtopage)) ? $_SERVER["PHP_SELF"].'?id='.$object->id : $backtopage));
435  exit;
436  }
437  } else {
438  $error++;
439  setEventMessages($object->error, $object->errors, 'errors');
440  }
441  $action = '';
442 }
443 
444 // Action validate object
445 if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
446  $result = $object->validate($user);
447  if ($result >= 0) {
448  // Define output language
449  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
450  if (method_exists($object, 'generateDocument')) {
451  $outputlangs = $langs;
452  $newlang = '';
453  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
454  $newlang = GETPOST('lang_id', 'aZ09');
455  }
456  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
457  $newlang = !empty($object->thirdparty->default_lang) ? $object->thirdparty->default_lang : "";
458  }
459  if (!empty($newlang)) {
460  $outputlangs = new Translate("", $conf);
461  $outputlangs->setDefaultLang($newlang);
462  }
463 
464  $ret = $object->fetch($id); // Reload to get new records
465 
466  $model = $object->model_pdf;
467 
468  $retgen = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
469  if ($retgen < 0) {
470  setEventMessages($object->error, $object->errors, 'warnings');
471  }
472  }
473  }
474  } else {
475  $error++;
476  setEventMessages($object->error, $object->errors, 'errors');
477  }
478  $action = '';
479 }
480 
481 // Action close object
482 if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) {
483  $result = $object->cancel($user);
484  if ($result >= 0) {
485  // Define output language
486  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
487  if (method_exists($object, 'generateDocument')) {
488  $outputlangs = $langs;
489  $newlang = '';
490  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
491  $newlang = GETPOST('lang_id', 'aZ09');
492  }
493  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
494  $newlang = $object->thirdparty->default_lang;
495  }
496  if (!empty($newlang)) {
497  $outputlangs = new Translate("", $conf);
498  $outputlangs->setDefaultLang($newlang);
499  }
500  $model = $object->model_pdf;
501  $ret = $object->fetch($id); // Reload to get new records
502 
503  $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
504  }
505  }
506  } else {
507  $error++;
508  setEventMessages($object->error, $object->errors, 'errors');
509  }
510  $action = '';
511 }
512 
513 // Action setdraft object
514 if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
515  $result = $object->setDraft($user);
516  if ($result >= 0) {
517  // Nothing else done
518  } else {
519  $error++;
520  setEventMessages($object->error, $object->errors, 'errors');
521  }
522  $action = '';
523 }
524 
525 // Action reopen object
526 if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
527  $result = $object->reopen($user);
528  if ($result >= 0) {
529  // Define output language
530  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
531  if (method_exists($object, 'generateDocument')) {
532  $outputlangs = $langs;
533  $newlang = '';
534  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
535  $newlang = GETPOST('lang_id', 'aZ09');
536  }
537  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
538  $newlang = $object->thirdparty->default_lang;
539  }
540  if (!empty($newlang)) {
541  $outputlangs = new Translate("", $conf);
542  $outputlangs->setDefaultLang($newlang);
543  }
544  $model = $object->model_pdf;
545  $ret = $object->fetch($id); // Reload to get new records
546 
547  $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
548  }
549  }
550  } else {
551  $error++;
552  setEventMessages($object->error, $object->errors, 'errors');
553  }
554  $action = '';
555 }
556 
557 // Action clone object
558 if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) {
559  if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) {
560  setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
561  } else {
562  $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
563  //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
564  // ...
565  $result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
566  if (is_object($result) || $result > 0) {
567  $newid = 0;
568  if (is_object($result)) {
569  $newid = $result->id;
570  } else {
571  $newid = $result;
572  }
573 
574  if (empty($noback)) {
575  header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $newid); // Open record of new object
576  exit;
577  }
578  } else {
579  $error++;
580  setEventMessages($objectutil->error, $objectutil->errors, 'errors');
581  $action = '';
582  }
583  }
584 }
Class to manage translations.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.