dolibarr  17.0.4
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 (in_array($object->fields[$key]['type'], array('text', 'html'))) {
80  $value = GETPOST($key, 'restricthtml');
81  } elseif ($object->fields[$key]['type'] == 'date') {
82  $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
83  } elseif ($object->fields[$key]['type'] == 'datetime') {
84  $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');
85  } elseif ($object->fields[$key]['type'] == 'duration') {
86  $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
87  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
88  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
89  } elseif ($object->fields[$key]['type'] == 'boolean') {
90  $value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
91  } elseif ($object->fields[$key]['type'] == 'reference') {
92  $tmparraykey = array_keys($object->param_list);
93  $value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
94  } elseif (preg_match('/^chkbxlst:(.*)/', $object->fields[$key]['type'])) {
95  $value = '';
96  $values_arr = GETPOST($key, 'array');
97  if (!empty($values_arr)) {
98  $value = implode(',', $values_arr);
99  }
100  } else {
101  if ($key == 'lang') {
102  $value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : "";
103  } else {
104  $value = GETPOST($key, 'alphanohtml');
105  }
106  }
107  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
108  $value = ''; // This is an implicit foreign key field
109  }
110  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
111  $value = ''; // This is an explicit foreign key field
112  }
113 
114  //var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
115  $object->$key = $value;
116  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
117  $object->$key = '(PROV)';
118  }
119  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
120  $error++;
121  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
122  }
123 
124  // Validation of fields values
125  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
126  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
127  if (!$object->validateField($object->fields, $key, $value)) {
128  $error++;
129  }
130  }
131  }
132  }
133 
134  // Fill array 'array_options' with data from add form
135  if (!$error) {
136  $ret = $extrafields->setOptionalsFromPost(null, $object, '', 1);
137  if ($ret < 0) {
138  $error++;
139  }
140  }
141 
142  if (!$error) {
143  $db->begin();
144 
145  $result = $object->create($user);
146  if ($result > 0) {
147  // Creation OK
148  if (isModEnabled('categorie') && method_exists($object, 'setCategories')) {
149  $categories = GETPOST('categories', 'array:int');
150  $object->setCategories($categories);
151  }
152 
153  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
154  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
155 
156  $db->commit();
157 
158  if (empty($noback)) {
159  header("Location: " . $urltogo);
160  exit;
161  }
162  } else {
163  $db->rollback();
164 
165  $error++;
166  // Creation KO
167  if (!empty($object->errors)) {
168  setEventMessages(null, $object->errors, 'errors');
169  } else {
170  setEventMessages($object->error, null, 'errors');
171  }
172  $action = 'create';
173  }
174  } else {
175  $action = 'create';
176  }
177 }
178 
179 // Action to update record
180 if ($action == 'update' && !empty($permissiontoadd)) {
181  foreach ($object->fields as $key => $val) {
182  // Check if field was submited to be edited
183  if ($object->fields[$key]['type'] == 'duration') {
184  if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
185  continue; // The field was not submited to be saved
186  }
187  } elseif ($object->fields[$key]['type'] == 'boolean') {
188  if (!GETPOSTISSET($key)) {
189  $object->$key = 0; // use 0 instead null if the field is defined as not null
190  continue;
191  }
192  } else {
193  if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
194  continue; // The field was not submited to be saved
195  }
196  }
197  // Ignore special fields
198  if (in_array($key, array('rowid', 'entity', 'import_key'))) {
199  continue;
200  }
201  if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
202  if (!in_array(abs($val['visible']), array(1, 3, 4))) {
203  continue; // Only 1 and 3 and 4, that are cases to update
204  }
205  }
206 
207  // Set value to update
208  if (preg_match('/^(text|html)/', $object->fields[$key]['type'])) {
209  $tmparray = explode(':', $object->fields[$key]['type']);
210  if (!empty($tmparray[1])) {
211  $value = GETPOST($key, $tmparray[1]);
212  } else {
213  $value = GETPOST($key, 'restricthtml');
214  }
215  } elseif ($object->fields[$key]['type'] == 'date') {
216  $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
217  } elseif ($object->fields[$key]['type'] == 'datetime') {
218  $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');
219  } elseif ($object->fields[$key]['type'] == 'duration') {
220  if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
221  $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
222  } else {
223  $value = '';
224  }
225  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
226  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
227  } elseif ($object->fields[$key]['type'] == 'boolean') {
228  $value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
229  } elseif ($object->fields[$key]['type'] == 'reference') {
230  $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
231  } elseif (preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
232  $value = '';
233  $values_arr = GETPOST($key, 'array');
234  if (!empty($values_arr)) {
235  $value = implode(',', $values_arr);
236  }
237  } else {
238  if ($key == 'lang') {
239  $value = GETPOST($key, 'aZ09');
240  } else {
241  $value = GETPOST($key, 'alphanohtml');
242  }
243  }
244  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
245  $value = ''; // This is an implicit foreign key field
246  }
247  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
248  $value = ''; // This is an explicit foreign key field
249  }
250 
251  $object->$key = $value;
252  if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
253  $error++;
254  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
255  }
256 
257  // Validation of fields values
258  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
259  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
260  if (!$object->validateField($object->fields, $key, $value)) {
261  $error++;
262  }
263  }
264  }
265 
266  if (isModEnabled('categorie')) {
267  $categories = GETPOST('categories', 'array');
268  if (method_exists($object, 'setCategories')) {
269  $object->setCategories($categories);
270  }
271  }
272  }
273 
274  // Fill array 'array_options' with data from add form
275  if (!$error) {
276  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
277  if ($ret < 0) {
278  $error++;
279  }
280  }
281 
282  if (!$error) {
283  $result = $object->update($user);
284  if ($result > 0) {
285  $action = 'view';
286  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
287  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
288  if ($urltogo && empty($noback)) {
289  header("Location: " . $urltogo);
290  exit;
291  }
292  } else {
293  $error++;
294  // Creation KO
295  setEventMessages($object->error, $object->errors, 'errors');
296  $action = 'edit';
297  }
298  } else {
299  $action = 'edit';
300  }
301 }
302 
303 // Action to update one modulebuilder field
304 $reg = array();
305 if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
306  $object->fetch(GETPOST('id', 'int'));
307 
308  $keyforfield = $reg[1];
309  if (property_exists($object, $keyforfield)) {
310  if (!empty($object->fields[$keyforfield]) && in_array($object->fields[$keyforfield]['type'], array('date', 'datetime', 'timestamp'))) {
311  $object->$keyforfield = dol_mktime(GETPOST($keyforfield.'hour'), GETPOST($keyforfield.'min'), GETPOST($keyforfield.'sec'), GETPOST($keyforfield.'month'), GETPOST($keyforfield.'day'), GETPOST($keyforfield.'year'));
312  } else {
313  $object->$keyforfield = GETPOST($keyforfield);
314  }
315 
316  $result = $object->update($user);
317 
318  if ($result > 0) {
319  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
320  $action = 'view';
321  } else {
322  $error++;
323  setEventMessages($object->error, $object->errors, 'errors');
324  $action = 'edit'.$reg[1];
325  }
326  }
327 }
328 
329 // Action to update one extrafield
330 if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
331  $object->fetch(GETPOST('id', 'int'));
332 
333  $attributekey = GETPOST('attribute', 'alpha');
334  $attributekeylong = 'options_'.$attributekey;
335 
336  if (GETPOSTISSET($attributekeylong.'day') && GETPOSTISSET($attributekeylong.'month') && GETPOSTISSET($attributekeylong.'year')) {
337  // This is properties of a date
338  $object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
339  //var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
340  } else {
341  $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
342  }
343 
344  $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
345  if ($result > 0) {
346  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
347  $action = 'view';
348  } else {
349  $error++;
350  setEventMessages($object->error, $object->errors, 'errors');
351  $action = 'edit_extras';
352  }
353 }
354 
355 // Action to delete
356 if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
357  if (!($object->id > 0)) {
358  dol_print_error('', 'Error, object must be fetched before being deleted');
359  exit;
360  }
361 
362  $result = $object->delete($user);
363 
364  if ($result > 0) {
365  // Delete OK
366  setEventMessages("RecordDeleted", null, 'mesgs');
367 
368  if (empty($noback)) {
369  header("Location: " . $backurlforlist);
370  exit;
371  }
372  } else {
373  $error++;
374  if (!empty($object->errors)) {
375  setEventMessages(null, $object->errors, 'errors');
376  } else {
377  setEventMessages($object->error, null, 'errors');
378  }
379  }
380 
381  $action = '';
382 }
383 
384 // Remove a line
385 if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd)) {
386  if (method_exists($object, 'deleteline')) {
387  $result = $object->deleteline($user, $lineid); // For backward compatibility
388  } else {
389  $result = $object->deleteLine($user, $lineid);
390  }
391  if ($result > 0) {
392  // Define output language
393  $outputlangs = $langs;
394  $newlang = '';
395  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
396  $newlang = GETPOST('lang_id', 'aZ09');
397  }
398  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && is_object($object->thirdparty)) {
399  $newlang = $object->thirdparty->default_lang;
400  }
401  if (!empty($newlang)) {
402  $outputlangs = new Translate("", $conf);
403  $outputlangs->setDefaultLang($newlang);
404  }
405  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
406  if (method_exists($object, 'generateDocument')) {
407  $ret = $object->fetch($object->id); // Reload to get new records
408  $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
409  }
410  }
411 
412  setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
413 
414  if (empty($noback)) {
415  header('Location: '.((empty($backtopage)) ? $_SERVER["PHP_SELF"].'?id='.$object->id : $backtopage));
416  exit;
417  }
418  } else {
419  $error++;
420  setEventMessages($object->error, $object->errors, 'errors');
421  }
422  $action = '';
423 }
424 
425 // Action validate object
426 if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
427  $result = $object->validate($user);
428  if ($result >= 0) {
429  // Define output language
430  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
431  if (method_exists($object, 'generateDocument')) {
432  $outputlangs = $langs;
433  $newlang = '';
434  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
435  $newlang = GETPOST('lang_id', 'aZ09');
436  }
437  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
438  $newlang = !empty($object->thirdparty->default_lang) ? $object->thirdparty->default_lang : "";
439  }
440  if (!empty($newlang)) {
441  $outputlangs = new Translate("", $conf);
442  $outputlangs->setDefaultLang($newlang);
443  }
444 
445  $ret = $object->fetch($id); // Reload to get new records
446 
447  $model = $object->model_pdf;
448 
449  $retgen = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
450  if ($retgen < 0) {
451  setEventMessages($object->error, $object->errors, 'warnings');
452  }
453  }
454  }
455  } else {
456  $error++;
457  setEventMessages($object->error, $object->errors, 'errors');
458  }
459  $action = '';
460 }
461 
462 // Action close object
463 if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) {
464  $result = $object->cancel($user);
465  if ($result >= 0) {
466  // Define output language
467  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
468  if (method_exists($object, 'generateDocument')) {
469  $outputlangs = $langs;
470  $newlang = '';
471  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
472  $newlang = GETPOST('lang_id', 'aZ09');
473  }
474  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
475  $newlang = $object->thirdparty->default_lang;
476  }
477  if (!empty($newlang)) {
478  $outputlangs = new Translate("", $conf);
479  $outputlangs->setDefaultLang($newlang);
480  }
481  $model = $object->model_pdf;
482  $ret = $object->fetch($id); // Reload to get new records
483 
484  $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
485  }
486  }
487  } else {
488  $error++;
489  setEventMessages($object->error, $object->errors, 'errors');
490  }
491  $action = '';
492 }
493 
494 // Action setdraft object
495 if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
496  $result = $object->setDraft($user);
497  if ($result >= 0) {
498  // Nothing else done
499  } else {
500  $error++;
501  setEventMessages($object->error, $object->errors, 'errors');
502  }
503  $action = '';
504 }
505 
506 // Action reopen object
507 if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
508  $result = $object->reopen($user);
509  if ($result >= 0) {
510  // Define output language
511  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
512  if (method_exists($object, 'generateDocument')) {
513  $outputlangs = $langs;
514  $newlang = '';
515  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
516  $newlang = GETPOST('lang_id', 'aZ09');
517  }
518  if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
519  $newlang = $object->thirdparty->default_lang;
520  }
521  if (!empty($newlang)) {
522  $outputlangs = new Translate("", $conf);
523  $outputlangs->setDefaultLang($newlang);
524  }
525  $model = $object->model_pdf;
526  $ret = $object->fetch($id); // Reload to get new records
527 
528  $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
529  }
530  }
531  } else {
532  $error++;
533  setEventMessages($object->error, $object->errors, 'errors');
534  }
535  $action = '';
536 }
537 
538 // Action clone object
539 if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) {
540  if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) {
541  setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
542  } else {
543  $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.
544  //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
545  // ...
546  $result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
547  if (is_object($result) || $result > 0) {
548  $newid = 0;
549  if (is_object($result)) {
550  $newid = $result->id;
551  } else {
552  $newid = $result;
553  }
554 
555  if (empty($noback)) {
556  header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $newid); // Open record of new object
557  exit;
558  }
559  } else {
560  $error++;
561  setEventMessages($objectutil->error, $objectutil->errors, 'errors');
562  $action = '';
563  }
564  }
565 }
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
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.