dolibarr 19.0.3
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;
72 public $periode;
73 public $period;
74
78 public $date_creation;
79
83 public $date_modification;
84
88 public $date_validation;
89
93 public $lib;
94
98 public $fk_account;
99
103 public $accountid;
104
108 public $paiementtype;
109
110 public $mode_reglement_id;
111 public $mode_reglement_code;
112 public $mode_reglement;
113
117 public $fk_project;
118
122 public $fk_user;
123
127 public $total;
128
129 public $totalpaid;
130
131
132 const STATUS_UNPAID = 0;
133 const STATUS_PAID = 1;
134
135
141 public function __construct(DoliDB $db)
142 {
143 $this->db = $db;
144 }
145
153 public function fetch($id, $ref = '')
154 {
155 $sql = "SELECT cs.rowid, cs.date_ech";
156 $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key";
157 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
158 $sql .= ", c.libelle as type_label";
159 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
160 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
161 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
162 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
163 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
164 if ($ref) {
165 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
166 } else {
167 $sql .= " AND cs.rowid = ".((int) $id);
168 }
169
170 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
171 $resql = $this->db->query($sql);
172 if ($resql) {
173 if ($this->db->num_rows($resql)) {
174 $obj = $this->db->fetch_object($resql);
175
176 $this->id = $obj->rowid;
177 $this->ref = $obj->rowid;
178 $this->date_ech = $this->db->jdate($obj->date_ech);
179 $this->lib = $obj->label;
180 $this->label = $obj->label;
181 $this->type = $obj->fk_type;
182 $this->type_label = $obj->type_label;
183 $this->fk_account = $obj->fk_account;
184 $this->mode_reglement_id = $obj->fk_mode_reglement;
185 $this->mode_reglement_code = $obj->mode_reglement_code;
186 $this->mode_reglement = $obj->mode_reglement_libelle;
187 $this->amount = $obj->amount;
188 $this->fk_project = $obj->fk_project;
189 $this->fk_user = $obj->fk_user;
190 $this->note_public = $obj->note_public;
191 $this->note_private = $obj->note_private;
192 $this->paye = $obj->paye;
193 $this->periode = $this->db->jdate($obj->period);
194 $this->period = $this->db->jdate($obj->period);
195 $this->import_key = $this->import_key;
196
197 $this->db->free($resql);
198
199 return 1;
200 } else {
201 return 0;
202 }
203 } else {
204 $this->error = $this->db->lasterror();
205 return -1;
206 }
207 }
208
214 public function check()
215 {
216 $newamount = price2num($this->amount, 'MT');
217
218 // Validation of parameters
219 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
220 return false;
221 }
222
223 return true;
224 }
225
232 public function create($user)
233 {
234 global $conf;
235 $error = 0;
236
237 $now = dol_now();
238
239 // Nettoyage parametres
240 $newamount = price2num($this->amount, 'MT');
241
242 if (!$this->check()) {
243 $this->error = "ErrorBadParameter";
244 return -2;
245 }
246
247 $this->db->begin();
248
249 $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)";
250 $sql .= " VALUES (".((int) $this->type);
251 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
252 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
253 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
254 $sql .= ", '".$this->db->idate($this->date_ech)."'";
255 $sql .= ", '".$this->db->idate($this->periode)."'";
256 $sql .= ", '".price2num($newamount)."'";
257 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
258 $sql .= ", ".((int) $conf->entity);
259 $sql .= ", ".((int) $user->id);
260 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
261 $sql .= ", '".$this->db->idate($now)."'";
262 $sql .= ")";
263
264 dol_syslog(get_class($this)."::create", LOG_DEBUG);
265 $resql = $this->db->query($sql);
266 if ($resql) {
267 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
268
269 //dol_syslog("ChargesSociales::create this->id=".$this->id);
270 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
271 if ($result < 0) {
272 $error++;
273 }
274
275 if (empty($error)) {
276 $this->db->commit();
277 return $this->id;
278 } else {
279 $this->db->rollback();
280 return -1 * $error;
281 }
282 } else {
283 $this->error = $this->db->error();
284 $this->db->rollback();
285 return -1;
286 }
287 }
288
289
296 public function delete($user)
297 {
298 $error = 0;
299
300 $this->db->begin();
301
302 // Get bank transaction lines for this social contributions
303 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
304 $account = new Account($this->db);
305 $lines_url = $account->get_url('', $this->id, 'sc');
306
307 // Delete bank urls
308 foreach ($lines_url as $line_url) {
309 if (!$error) {
310 $accountline = new AccountLine($this->db);
311 $accountline->fetch($line_url['fk_bank']);
312 $result = $accountline->delete_urls($user);
313 if ($result < 0) {
314 $error++;
315 }
316 }
317 }
318
319 // Delete payments
320 if (!$error) {
321 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((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 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
332 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
333 $resql = $this->db->query($sql);
334 if (!$resql) {
335 $error++;
336 $this->error = $this->db->lasterror();
337 }
338 }
339
340 if (!$error) {
341 $this->db->commit();
342 return 1;
343 } else {
344 $this->db->rollback();
345 return -1;
346 }
347 }
348
349
357 public function update($user, $notrigger = 0)
358 {
359 $error = 0;
360 $this->db->begin();
361
362 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
363 $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
364 $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
365 $sql .= ", periode='".$this->db->idate($this->periode)."'";
366 $sql .= ", amount='".price2num($this->amount, 'MT')."'";
367 $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
368 $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
369 $sql .= ", fk_user_modif=".$user->id;
370 $sql .= " WHERE rowid=".((int) $this->id);
371
372 dol_syslog(get_class($this)."::update", LOG_DEBUG);
373 $resql = $this->db->query($sql);
374
375 if (!$resql) {
376 $error++;
377 $this->errors[] = "Error ".$this->db->lasterror();
378 }
379
380 if (!$error) {
381 if (!$notrigger) {
382 // Call trigger
383 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
384 if ($result < 0) {
385 $error++;
386 }
387 // End call triggers
388 }
389 }
390
391 // Commit or rollback
392 if ($error) {
393 foreach ($this->errors as $errmsg) {
394 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
395 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
396 }
397 $this->db->rollback();
398 return -1 * $error;
399 } else {
400 $this->db->commit();
401 return 1;
402 }
403 }
404
411 public function solde($year = 0)
412 {
413 global $conf;
414
415 $sql = "SELECT SUM(f.amount) as amount";
416 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
417 $sql .= " WHERE f.entity = ".$conf->entity;
418 $sql .= " AND paye = 0";
419
420 if ($year) {
421 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
422 }
423
424 $result = $this->db->query($sql);
425 if ($result) {
426 if ($this->db->num_rows($result)) {
427 $obj = $this->db->fetch_object($result);
428 $this->db->free($result);
429 return $obj->amount;
430 } else {
431 return 0;
432 }
433 } else {
434 print $this->db->error();
435 return -1;
436 }
437 }
438
439 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
448 public function set_paid($user)
449 {
450 // phpcs:enable
451 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
452 return $this->setPaid($user);
453 }
454
461 public function setPaid($user)
462 {
463 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
464 $sql .= " paye = 1";
465 $sql .= " WHERE rowid = ".((int) $this->id);
466
467 $return = $this->db->query($sql);
468
469 if ($return) {
470 $this->paye = 1;
471
472 return 1;
473 } else {
474 return -1;
475 }
476 }
477
478 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
487 public function set_unpaid($user)
488 {
489 // phpcs:enable
490 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
491 return $this->setUnpaid($user);
492 }
493
500 public function setUnpaid($user)
501 {
502 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
503 $sql .= " paye = 0";
504 $sql .= " WHERE rowid = ".((int) $this->id);
505
506 $return = $this->db->query($sql);
507
508 if ($return) {
509 $this->paye = 0;
510
511 return 1;
512 } else {
513 return -1;
514 }
515 }
516
524 public function getLibStatut($mode = 0, $alreadypaid = -1)
525 {
526 return $this->LibStatut($this->paye, $mode, $alreadypaid);
527 }
528
529 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
538 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
539 {
540 // phpcs:enable
541 global $langs;
542
543 // Load translation files required by the page
544 $langs->loadLangs(array("customers", "bills"));
545
546 // We reinit status array to force to redefine them because label may change according to properties values.
547 $this->labelStatus = array();
548 $this->labelStatusShort = array();
549
550 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
551 global $langs;
552 //$langs->load("mymodule");
553 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
554 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
555 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
556 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
557 }
558 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
559 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
560 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
561 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
562 }
563 }
564
565 $statusType = 'status1';
566 if ($status == 0 && $alreadypaid > 0) {
567 $statusType = 'status3';
568 }
569 if ($status == 1) {
570 $statusType = 'status6';
571 }
572
573 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
574 }
575
576
587 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
588 {
589 global $langs, $conf, $user, $form, $hookmanager;
590
591 if (!empty($conf->dol_no_mouse_hover)) {
592 $notooltip = 1; // Force disable tooltips
593 }
594
595 $result = '';
596
597 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
598
599 if ($short) {
600 return $url;
601 }
602
603 if ($option !== 'nolink') {
604 // Add param to save lastsearch_values or not
605 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
606 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
607 $add_save_lastsearch_values = 1;
608 }
609 if ($add_save_lastsearch_values) {
610 $url .= '&save_lastsearch_values=1';
611 }
612 }
613
614 if (empty($this->ref)) {
615 $this->ref = $this->label;
616 }
617
618 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
619 if (isset($this->paye)) {
620 $label .= ' '.$this->getLibStatut(5);
621 }
622 if (!empty($this->ref)) {
623 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
624 }
625 if (!empty($this->label)) {
626 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
627 }
628 if (!empty($this->type_label)) {
629 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
630 }
631
632 $linkclose = '';
633 if (empty($notooltip) && $user->hasRight("facture", "read")) {
634 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
635 $label = $langs->trans("SocialContribution");
636 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
637 }
638 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
639 $linkclose .= ' class="classfortooltip"';
640 }
641
642 $linkstart = '<a href="'.$url.'"';
643 $linkstart .= $linkclose.'>';
644 $linkend = '</a>';
645
646 $result .= $linkstart;
647 if ($withpicto) {
648 $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);
649 }
650 if ($withpicto != 2) {
651 $result .= $this->ref;
652 }
653 $result .= $linkend;
654 global $action;
655 $hookmanager->initHooks(array($this->element . 'dao'));
656 $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
657 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
658 if ($reshook > 0) {
659 $result = $hookmanager->resPrint;
660 } else {
661 $result .= $hookmanager->resPrint;
662 }
663 return $result;
664 }
665
671 public function getSommePaiement()
672 {
673 $table = 'paiementcharge';
674 $field = 'fk_charge';
675
676 $sql = 'SELECT sum(amount) as amount';
677 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
678 $sql .= " WHERE ".$field." = ".((int) $this->id);
679
680 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
681 $resql = $this->db->query($sql);
682 if ($resql) {
683 $amount = 0;
684
685 $obj = $this->db->fetch_object($resql);
686 if ($obj) {
687 $amount = $obj->amount ? $obj->amount : 0;
688 }
689
690 $this->db->free($resql);
691 return $amount;
692 } else {
693 return -1;
694 }
695 }
696
703 public function info($id)
704 {
705 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
706 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
707 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
708 $sql .= " WHERE e.rowid = ".((int) $id);
709
710 dol_syslog(get_class($this)."::info", LOG_DEBUG);
711 $result = $this->db->query($sql);
712 if ($result) {
713 if ($this->db->num_rows($result)) {
714 $obj = $this->db->fetch_object($result);
715
716 $this->id = $obj->rowid;
717
718 $this->user_creation_id = $obj->fk_user_author;
719 $this->user_modification_id = $obj->fk_user_modif;
720 $this->user_validation_id = $obj->fk_user_valid;
721 $this->date_creation = $this->db->jdate($obj->datec);
722 $this->date_modification = $this->db->jdate($obj->datem);
723 $this->date_validation = $this->db->jdate($obj->datev);
724 $this->import_key = $obj->import_key;
725 }
726
727 $this->db->free($result);
728 return 1;
729 } else {
730 dol_print_error($this->db);
731 return -1;
732 }
733 }
734
742 public function initAsSpecimen()
743 {
744 // Initialize parameters
745 $this->id = 0;
746 $this->ref = 'SPECIMEN';
747 $this->specimen = 1;
748 $this->paye = 0;
749 $this->date_creation = dol_now();
750 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
751 $this->periode = $this->date_creation + 3600 * 24 * 30;
752 $this->period = $this->date_creation + 3600 * 24 * 30;
753 $this->amount = 100;
754 $this->label = 'Social contribution label';
755 $this->type = 1;
756 $this->type_label = 'Type of social contribution';
757 }
758
766 public function getKanbanView($option = '', $arraydata = null)
767 {
768 global $conf, $langs;
769
770 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
771
772 $return = '<div class="box-flex-item box-flex-grow-zero">';
773 $return .= '<div class="info-box info-box-sm">';
774 $return .= '<span class="info-box-icon bg-infobox-action">';
775 $return .= img_picto('', $this->picto);
776 $return .= '</span>';
777 $return .= '<div class="info-box-content">';
778 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
779 if ($selected >= 0) {
780 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
781 }
782 if (property_exists($this, 'label')) {
783 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
784 }
785 if (!empty($arraydata['project']) && $arraydata['project']->id > 0) {
786 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
787 }
788 if (property_exists($this, 'date_ech')) {
789 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
790 }
791 if (property_exists($this, 'amount')) {
792 $return .= '<br>';
793 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
794 }
795 if (method_exists($this, 'LibStatut')) {
796 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
797 }
798 $return .= '</div>';
799 $return .= '</div>';
800 $return .= '</div>';
801 return $return;
802 }
803}
$object ref
Definition info.php:79
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.
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)
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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:121