dolibarr 18.0.6
chargesociales.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2016-2022 Frédéric France <frederic.france@netlogic.fr>
5 * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28
29
35{
39 public $element = 'chargesociales';
40
41 public $table = 'chargesociales';
42
46 public $table_element = 'chargesociales';
47
51 public $picto = 'bill';
52
56 protected $table_ref_field = 'ref';
57
61 public $date_ech;
62
63
64 public $label;
65 public $type;
66 public $type_label;
67 public $amount;
68 public $paye;
69 public $periode;
70
74 public $date_creation;
75
79 public $date_modification;
80
84 public $date_validation;
85
89 public $lib;
90
94 public $fk_account;
95
99 public $accountid;
100
104 public $paiementtype;
105
109 public $fk_project;
110
114 public $fk_user;
115
119 public $total;
120
121 public $totalpaid;
122
123 const STATUS_UNPAID = 0;
124 const STATUS_PAID = 1;
125
126
132 public function __construct(DoliDB $db)
133 {
134 $this->db = $db;
135 }
136
144 public function fetch($id, $ref = '')
145 {
146 $sql = "SELECT cs.rowid, cs.date_ech";
147 $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
148 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
149 $sql .= ", c.libelle as type_label";
150 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
151 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
152 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
153 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
154 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
155 if ($ref) {
156 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
157 } else {
158 $sql .= " AND cs.rowid = ".((int) $id);
159 }
160
161 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
162 $resql = $this->db->query($sql);
163 if ($resql) {
164 if ($this->db->num_rows($resql)) {
165 $obj = $this->db->fetch_object($resql);
166
167 $this->id = $obj->rowid;
168 $this->ref = $obj->rowid;
169 $this->date_ech = $this->db->jdate($obj->date_ech);
170 $this->lib = $obj->label;
171 $this->label = $obj->label;
172 $this->type = $obj->fk_type;
173 $this->type_label = $obj->type_label;
174 $this->fk_account = $obj->fk_account;
175 $this->mode_reglement_id = $obj->fk_mode_reglement;
176 $this->mode_reglement_code = $obj->mode_reglement_code;
177 $this->mode_reglement = $obj->mode_reglement_libelle;
178 $this->amount = $obj->amount;
179 $this->fk_project = $obj->fk_project;
180 $this->fk_user = $obj->fk_user;
181 $this->note_public = $obj->note_public;
182 $this->note_private = $obj->note_private;
183 $this->paye = $obj->paye;
184 $this->periode = $this->db->jdate($obj->periode);
185 $this->import_key = $this->import_key;
186
187 $this->db->free($resql);
188
189 return 1;
190 } else {
191 return 0;
192 }
193 } else {
194 $this->error = $this->db->lasterror();
195 return -1;
196 }
197 }
198
204 public function check()
205 {
206 $newamount = price2num($this->amount, 'MT');
207
208 // Validation of parameters
209 if ($newamount == 0 || empty($this->date_ech) || empty($this->periode)) {
210 return false;
211 }
212
213 return true;
214 }
215
222 public function create($user)
223 {
224 global $conf;
225 $error = 0;
226
227 $now = dol_now();
228
229 // Nettoyage parametres
230 $newamount = price2num($this->amount, 'MT');
231
232 if (!$this->check()) {
233 $this->error = "ErrorBadParameter";
234 return -2;
235 }
236
237 $this->db->begin();
238
239 $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
240 $sql .= " VALUES (".((int) $this->type);
241 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
242 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
243 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
244 $sql .= ", '".$this->db->idate($this->date_ech)."'";
245 $sql .= ", '".$this->db->idate($this->periode)."'";
246 $sql .= ", '".price2num($newamount)."'";
247 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
248 $sql .= ", ".((int) $conf->entity);
249 $sql .= ", ".((int) $user->id);
250 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
251 $sql .= ", '".$this->db->idate($now)."'";
252 $sql .= ")";
253
254 dol_syslog(get_class($this)."::create", LOG_DEBUG);
255 $resql = $this->db->query($sql);
256 if ($resql) {
257 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
258
259 //dol_syslog("ChargesSociales::create this->id=".$this->id);
260 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
261 if ($result < 0) {
262 $error++;
263 }
264
265 if (empty($error)) {
266 $this->db->commit();
267 return $this->id;
268 } else {
269 $this->db->rollback();
270 return -1 * $error;
271 }
272 } else {
273 $this->error = $this->db->error();
274 $this->db->rollback();
275 return -1;
276 }
277 }
278
279
286 public function delete($user)
287 {
288 $error = 0;
289
290 $this->db->begin();
291
292 // Get bank transaction lines for this social contributions
293 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
294 $account = new Account($this->db);
295 $lines_url = $account->get_url('', $this->id, 'sc');
296
297 // Delete bank urls
298 foreach ($lines_url as $line_url) {
299 if (!$error) {
300 $accountline = new AccountLine($this->db);
301 $accountline->fetch($line_url['fk_bank']);
302 $result = $accountline->delete_urls($user);
303 if ($result < 0) {
304 $error++;
305 }
306 }
307 }
308
309 // Delete payments
310 if (!$error) {
311 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
312 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
313 $resql = $this->db->query($sql);
314 if (!$resql) {
315 $error++;
316 $this->error = $this->db->lasterror();
317 }
318 }
319
320 if (!$error) {
321 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
322 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
323 $resql = $this->db->query($sql);
324 if (!$resql) {
325 $error++;
326 $this->error = $this->db->lasterror();
327 }
328 }
329
330 if (!$error) {
331 $this->db->commit();
332 return 1;
333 } else {
334 $this->db->rollback();
335 return -1;
336 }
337 }
338
339
347 public function update($user, $notrigger = 0)
348 {
349 $error = 0;
350 $this->db->begin();
351
352 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
353 $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
354 $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
355 $sql .= ", periode='".$this->db->idate($this->periode)."'";
356 $sql .= ", amount='".price2num($this->amount, 'MT')."'";
357 $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
358 $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
359 $sql .= ", fk_user_modif=".$user->id;
360 $sql .= " WHERE rowid=".((int) $this->id);
361
362 dol_syslog(get_class($this)."::update", LOG_DEBUG);
363 $resql = $this->db->query($sql);
364
365 if (!$resql) {
366 $error++;
367 $this->errors[] = "Error ".$this->db->lasterror();
368 }
369
370 if (!$error) {
371 if (!$notrigger) {
372 // Call trigger
373 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
374 if ($result < 0) {
375 $error++;
376 }
377 // End call triggers
378 }
379 }
380
381 // Commit or rollback
382 if ($error) {
383 foreach ($this->errors as $errmsg) {
384 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
385 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
386 }
387 $this->db->rollback();
388 return -1 * $error;
389 } else {
390 $this->db->commit();
391 return 1;
392 }
393 }
394
401 public function solde($year = 0)
402 {
403 global $conf;
404
405 $sql = "SELECT SUM(f.amount) as amount";
406 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
407 $sql .= " WHERE f.entity = ".$conf->entity;
408 $sql .= " AND paye = 0";
409
410 if ($year) {
411 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
412 }
413
414 $result = $this->db->query($sql);
415 if ($result) {
416 if ($this->db->num_rows($result)) {
417 $obj = $this->db->fetch_object($result);
418 $this->db->free($result);
419 return $obj->amount;
420 } else {
421 return 0;
422 }
423 } else {
424 print $this->db->error();
425 return -1;
426 }
427 }
428
429 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
438 public function set_paid($user)
439 {
440 // phpcs:enable
441 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
442 return $this->setPaid($user);
443 }
444
451 public function setPaid($user)
452 {
453 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
454 $sql .= " paye = 1";
455 $sql .= " WHERE rowid = ".((int) $this->id);
456
457 $return = $this->db->query($sql);
458
459 if ($return) {
460 $this->paye = 1;
461
462 return 1;
463 } else {
464 return -1;
465 }
466 }
467
468 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
477 public function set_unpaid($user)
478 {
479 // phpcs:enable
480 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
481 return $this->setUnpaid($user);
482 }
483
490 public function setUnpaid($user)
491 {
492 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
493 $sql .= " paye = 0";
494 $sql .= " WHERE rowid = ".((int) $this->id);
495
496 $return = $this->db->query($sql);
497
498 if ($return) {
499 $this->paye = 0;
500
501 return 1;
502 } else {
503 return -1;
504 }
505 }
506
514 public function getLibStatut($mode = 0, $alreadypaid = -1)
515 {
516 return $this->LibStatut($this->paye, $mode, $alreadypaid);
517 }
518
519 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
528 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
529 {
530 // phpcs:enable
531 global $langs;
532
533 // Load translation files required by the page
534 $langs->loadLangs(array("customers", "bills"));
535
536 // We reinit status array to force to redefine them because label may change according to properties values.
537 $this->labelStatus = array();
538 $this->labelStatusShort = array();
539
540 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
541 global $langs;
542 //$langs->load("mymodule");
543 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
544 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
545 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
546 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
547 }
548 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
549 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
550 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
551 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
552 }
553 }
554
555 $statusType = 'status1';
556 if ($status == 0 && $alreadypaid > 0) {
557 $statusType = 'status3';
558 }
559 if ($status == 1) {
560 $statusType = 'status6';
561 }
562
563 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
564 }
565
566
577 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
578 {
579 global $langs, $conf, $user, $form, $hookmanager;
580
581 if (!empty($conf->dol_no_mouse_hover)) {
582 $notooltip = 1; // Force disable tooltips
583 }
584
585 $result = '';
586
587 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
588
589 if ($short) {
590 return $url;
591 }
592
593 if ($option !== 'nolink') {
594 // Add param to save lastsearch_values or not
595 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
596 if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
597 $add_save_lastsearch_values = 1;
598 }
599 if ($add_save_lastsearch_values) {
600 $url .= '&save_lastsearch_values=1';
601 }
602 }
603
604 if (empty($this->ref)) {
605 $this->ref = $this->label;
606 }
607
608 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
609 if (isset($this->paye)) {
610 $label .= ' '.$this->getLibStatut(5);
611 }
612 if (!empty($this->ref)) {
613 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
614 }
615 if (!empty($this->label)) {
616 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
617 }
618 if (!empty($this->type_label)) {
619 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
620 }
621
622 $linkclose = '';
623 if (empty($notooltip) && $user->hasRight("facture", "read")) {
624 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
625 $label = $langs->trans("SocialContribution");
626 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
627 }
628 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
629 $linkclose .= ' class="classfortooltip"';
630 }
631
632 $linkstart = '<a href="'.$url.'"';
633 $linkstart .= $linkclose.'>';
634 $linkend = '</a>';
635
636 $result .= $linkstart;
637 if ($withpicto) {
638 $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
639 }
640 if ($withpicto != 2) {
641 $result .= $this->ref;
642 }
643 $result .= $linkend;
644 global $action;
645 $hookmanager->initHooks(array($this->element . 'dao'));
646 $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
647 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
648 if ($reshook > 0) {
649 $result = $hookmanager->resPrint;
650 } else {
651 $result .= $hookmanager->resPrint;
652 }
653 return $result;
654 }
655
661 public function getSommePaiement()
662 {
663 $table = 'paiementcharge';
664 $field = 'fk_charge';
665
666 $sql = 'SELECT sum(amount) as amount';
667 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
668 $sql .= " WHERE ".$field." = ".((int) $this->id);
669
670 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
671 $resql = $this->db->query($sql);
672 if ($resql) {
673 $amount = 0;
674
675 $obj = $this->db->fetch_object($resql);
676 if ($obj) {
677 $amount = $obj->amount ? $obj->amount : 0;
678 }
679
680 $this->db->free($resql);
681 return $amount;
682 } else {
683 return -1;
684 }
685 }
686
693 public function info($id)
694 {
695 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
696 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
697 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
698 $sql .= " WHERE e.rowid = ".((int) $id);
699
700 dol_syslog(get_class($this)."::info", LOG_DEBUG);
701 $result = $this->db->query($sql);
702 if ($result) {
703 if ($this->db->num_rows($result)) {
704 $obj = $this->db->fetch_object($result);
705
706 $this->id = $obj->rowid;
707
708 if ($obj->fk_user_author) {
709 $cuser = new User($this->db);
710 $cuser->fetch($obj->fk_user_author);
711 $this->user_creation = $cuser;
712 }
713
714 if ($obj->fk_user_modif) {
715 $muser = new User($this->db);
716 $muser->fetch($obj->fk_user_modif);
717 $this->user_modification = $muser;
718 }
719
720 if ($obj->fk_user_valid) {
721 $vuser = new User($this->db);
722 $vuser->fetch($obj->fk_user_valid);
723 $this->user_validation = $vuser;
724 }
725
726 $this->date_creation = $this->db->jdate($obj->datec);
727 $this->date_modification = $this->db->jdate($obj->datem);
728 $this->date_validation = $this->db->jdate($obj->datev);
729 $this->import_key = $obj->import_key;
730 }
731
732 $this->db->free($result);
733 return 1;
734 } else {
735 dol_print_error($this->db);
736 return -1;
737 }
738 }
739
747 public function initAsSpecimen()
748 {
749 // Initialize parameters
750 $this->id = 0;
751 $this->ref = 'SPECIMEN';
752 $this->specimen = 1;
753 $this->paye = 0;
754 $this->date = dol_now();
755 $this->date_ech = $this->date + 3600 * 24 * 30;
756 $this->periode = $this->date + 3600 * 24 * 30;
757 $this->amount = 100;
758 $this->label = 'Social contribution label';
759 $this->type = 1;
760 $this->type_label = 'Type of social contribution';
761 }
762
770 public function getKanbanView($option = '', $arraydata = null)
771 {
772 global $conf, $langs;
773
774 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
775
776 $return = '<div class="box-flex-item box-flex-grow-zero">';
777 $return .= '<div class="info-box info-box-sm">';
778 $return .= '<span class="info-box-icon bg-infobox-action">';
779 $return .= img_picto('', $this->picto);
780 $return .= '</span>';
781 $return .= '<div class="info-box-content">';
782 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
783 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
784 if (property_exists($this, 'label')) {
785 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
786 }
787 if (!empty($arraydata['project']) && $arraydata['project']->id > 0) {
788 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
789 }
790 if (property_exists($this, 'date_ech')) {
791 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
792 }
793 if (property_exists($this, 'amount')) {
794 $return .= '<br>';
795 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
796 }
797 if (method_exists($this, 'LibStatut')) {
798 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
799 }
800 $return .= '</div>';
801 $return .= '</div>';
802 $return .= '</div>';
803 return $return;
804 }
805}
$object ref
Definition info.php:78
Class to manage bank accounts.
Class to manage bank transaction lines.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
LibStatut($status, $mode=0, $alreadypaid=-1)
Renvoi le libelle d'un statut donne.
__construct(DoliDB $db)
Constructor.
setUnpaid($user)
Remove tag paid on social contribution.
initAsSpecimen()
Initialise an instance with random values.
check()
Check if a social contribution can be created into database.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
getSommePaiement()
Return amount of payments already done.
solde($year=0)
Calculate amount remaining to pay by year.
fetch($id, $ref='')
Retrouve et charge une charge sociale.
update($user, $notrigger=0)
Update social or fiscal contribution.
set_unpaid($user)
Remove tag paid on social contribution.
set_paid($user)
Tag social contribution as paid completely.
getNomUrl($withpicto=0, $option='', $notooltip=0, $short=0, $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
info($id)
Charge les informations d'ordre info dans l'objet entrepot.
create($user)
Create a social contribution into database.
getLibStatut($mode=0, $alreadypaid=-1)
Retourne le libelle du statut d'une charge (impaye, payee)
setPaid($user)
Tag social contribution as paid completely.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
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...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120