dolibarr  18.0.0
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  $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
99  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
100  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
101  } elseif ($object->fields[$key]['type'] == 'boolean') {
102  $value = ((GETPOST($key) == '1' || GETPOST($key) == 'on') ? 1 : 0);
103  } elseif ($object->fields[$key]['type'] == 'reference') {
104  $tmparraykey = array_keys($object->param_list);
105  $value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
106  } elseif (preg_match('/^chkbxlst:(.*)/', $object->fields[$key]['type'])) {
107  $value = '';
108  $values_arr = GETPOST($key, 'array');
109  if (!empty($values_arr)) {
110  $value = implode(',', $values_arr);
111  }
112  } else {
113  if ($key == 'lang') {
114  $value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : "";
115  } else {
116  $value = GETPOST($key, 'alphanohtml');
117  }
118  }
119  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
120  $value = ''; // This is an implicit foreign key field
121  }
122  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
123  $value = ''; // This is an explicit foreign key field
124  }
125 
126  //var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
127  $object->$key = $value;
128  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
129  $object->$key = '(PROV)';
130  }
131  if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
132  $error++;
133  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
134  }
135 
136  // Validation of fields values
137  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
138  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
139  if (!$object->validateField($object->fields, $key, $value)) {
140  $error++;
141  }
142  }
143  }
144  }
145 
146  // Fill array 'array_options' with data from add form
147  if (!$error) {
148  $ret = $extrafields->setOptionalsFromPost(null, $object, '', 1);
149  if ($ret < 0) {
150  $error++;
151  }
152  }
153 
154  if (!$error) {
155  $db->begin();
156 
157  $result = $object->create($user);
158  if ($result > 0) {
159  // Creation OK
160  if (isModEnabled('categorie') && method_exists($object, 'setCategories')) {
161  $categories = GETPOST('categories', 'array:int');
162  $object->setCategories($categories);
163  }
164 
165  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
166  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
167 
168  $db->commit();
169 
170  if (empty($noback)) {
171  header("Location: " . $urltogo);
172  exit;
173  }
174  } else {
175  $db->rollback();
176 
177  $error++;
178  // Creation KO
179  if (!empty($object->errors)) {
180  setEventMessages(null, $object->errors, 'errors');
181  } else {
182  setEventMessages($object->error, null, 'errors');
183  }
184  $action = 'create';
185  }
186  } else {
187  $action = 'create';
188  }
189 }
190 
191 // Action to update record
192 if ($action == 'update' && !empty($permissiontoadd)) {
193  foreach ($object->fields as $key => $val) {
194  // Check if field was submited to be edited
195  if ($object->fields[$key]['type'] == 'duration') {
196  if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
197  continue; // The field was not submited to be saved
198  }
199  } elseif ($object->fields[$key]['type'] == 'boolean') {
200  if (!GETPOSTISSET($key)) {
201  $object->$key = 0; // use 0 instead null if the field is defined as not null
202  continue;
203  }
204  } else {
205  if (!GETPOSTISSET($key) && !preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
206  continue; // The field was not submited to be saved
207  }
208  }
209  // Ignore special fields
210  if (in_array($key, array('rowid', 'entity', 'import_key'))) {
211  continue;
212  }
213  if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
214  if (!in_array(abs($val['visible']), array(1, 3, 4))) {
215  continue; // Only 1 and 3 and 4, that are cases to update
216  }
217  }
218 
219  // Set value to update
220  if (preg_match('/^text/', $object->fields[$key]['type'])) {
221  $tmparray = explode(':', $object->fields[$key]['type']);
222  if (!empty($tmparray[1])) {
223  $value = GETPOST($key, $tmparray[1]);
224  } else {
225  $value = GETPOST($key, 'nohtml');
226  }
227  } elseif (preg_match('/^html/', $object->fields[$key]['type'])) {
228  $tmparray = explode(':', $object->fields[$key]['type']);
229  if (!empty($tmparray[1])) {
230  $value = GETPOST($key, $tmparray[1]);
231  } else {
232  $value = GETPOST($key, 'restricthtml');
233  }
234  } elseif ($object->fields[$key]['type'] == 'date') {
235  $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
236  } elseif ($object->fields[$key]['type'] == 'datetime') {
237  $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');
238  } elseif ($object->fields[$key]['type'] == 'duration') {
239  if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
240  $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
241  } else {
242  $value = '';
243  }
244  } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
245  $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup
246  } elseif ($object->fields[$key]['type'] == 'boolean') {
247  $value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
248  } elseif ($object->fields[$key]['type'] == 'reference') {
249  $value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
250  } elseif (preg_match('/^chkbxlst:/', $object->fields[$key]['type'])) {
251  $value = '';
252  $values_arr = GETPOST($key, 'array');
253  if (!empty($values_arr)) {
254  $value = implode(',', $values_arr);
255  }
256  } else {
257  if ($key == 'lang') {
258  $value = GETPOST($key, 'aZ09');
259  } else {
260  $value = GETPOST($key, 'alphanohtml');
261  }
262  }
263  if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
264  $value = ''; // This is an implicit foreign key field
265  }
266  if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
267  $value = ''; // This is an explicit foreign key field
268  }
269 
270  $object->$key = $value;
271  if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
272  $error++;
273  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
274  }
275 
276  // Validation of fields values
277  if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
278  if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
279  if (!$object->validateField($object->fields, $key, $value)) {
280  $error++;
281  }
282  }
283  }
284 
285  if (isModEnabled('categorie')) {
286  $categories = GETPOST('categories', 'array');
287  if (method_exists($object, 'setCategories')) {
288  $object->setCategories($categories);
289  }
290  }
291  }
292 
293  // Fill array 'array_options' with data from add form
294  if (!$error) {
295  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
296  if ($ret < 0) {
297  $error++;
298  }
299  }
300 
301  if (!$error) {
302  $result = $object->update($user);
303  if ($result > 0) {
304  $action = 'view';
305  $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
306  $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
307  if ($urltogo && empty($noback)) {
308  header("Location: " . $urltogo);
309  exit;
310  }
311  } else {
312  $error++;
313  // Creation KO
314  setEventMessages($object->error, $object->errors, 'errors');
315  $action = 'edit';
316  }
317  } else {
318  $action = 'edit';
319  }
320 }
321 
322 // Action to update one modulebuilder field
323 $reg = array();
324 if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
325  $object->fetch(GETPOST('id', 'int'));
326 
327  $keyforfield = $reg[1];
328  if (property_exists($object, $keyforfield)) {
329  if (!empty($object->fields[$keyforfield]) && in_array($object->fields[$keyforfield]['type'], array('date', 'datetime', 'timestamp'))) {
330  $object->$keyforfield = dol_mktime(GETPOST($keyforfield.'hour'), GETPOST($keyforfield.'min'), GETPOST($keyforfield.'sec'), GETPOST($keyforfield.'month'), GETPOST($keyforfield.'day'), GETPOST($keyforfield.'year'));
331  } else {
332  $object->$keyforfield = GETPOST($keyforfield);
333  }
334 
335  $result = $object->update($user);
336 
337  if ($result > 0) {
338  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
339  $action = 'view';
340  } else {
341  $error++;
342  setEventMessages($object->error, $object->errors, 'errors');
343  $action = 'edit'.$reg[1];
344  }
345  }
346 }
347 
348 // Action to update one extrafield
349 if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
350  $object->fetch(GETPOST('id', 'int'));
351 
352  $attributekey = GETPOST('attribute', 'alpha');
353  $attributekeylong = 'options_'.$attributekey;
354 
355  if (GETPOSTISSET($attributekeylong.'day') && GETPOSTISSET($attributekeylong.'month') && GETPOSTISSET($attributekeylong.'year')) {
356  // This is properties of a date
357  $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'));
358  //var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
359  } else {
360  $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
361  }
362 
363  $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
364  if ($result > 0) {
365  setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
366  $action = 'view';
367  } else {
368  $error++;
369  setEventMessages($object->error, $object->errors, 'errors');
370  $action = 'edit_extras';
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.