dolibarr 20.0.0
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-2024 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29
30
36{
40 public $element = 'chargesociales';
41
42 public $table = 'chargesociales';
43
47 public $table_element = 'chargesociales';
48
52 public $picto = 'bill';
53
57 protected $table_ref_field = 'ref';
58
62 public $date_ech;
63
64
65 public $label;
66 public $type;
67 public $type_label;
68
69 public $amount;
70 public $paye;
74 public $periode;
75 public $period;
76
80 public $date_creation;
81
85 public $date_modification;
86
90 public $date_validation;
91
95 public $lib;
96
100 public $fk_account;
101
105 public $accountid;
106
110 public $paiementtype;
111
112 public $mode_reglement_id;
113 public $mode_reglement_code;
114 public $mode_reglement;
115
119 public $fk_project;
120
124 public $fk_user;
125
129 public $total;
130
131 public $totalpaid;
132
133
134 const STATUS_UNPAID = 0;
135 const STATUS_PAID = 1;
136
137
143 public function __construct(DoliDB $db)
144 {
145 $this->db = $db;
146 }
147
155 public function fetch($id, $ref = '')
156 {
157 $sql = "SELECT cs.rowid, cs.date_ech";
158 $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";
159 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
160 $sql .= ", c.libelle as type_label";
161 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
162 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
163 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
164 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
165 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
166 if ($ref) {
167 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
168 } else {
169 $sql .= " AND cs.rowid = ".((int) $id);
170 }
171
172 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
173 $resql = $this->db->query($sql);
174 if ($resql) {
175 if ($this->db->num_rows($resql)) {
176 $obj = $this->db->fetch_object($resql);
177
178 $this->id = $obj->rowid;
179 $this->ref = $obj->rowid;
180 $this->date_ech = $this->db->jdate($obj->date_ech);
181 $this->lib = $obj->label;
182 $this->label = $obj->label;
183 $this->type = $obj->fk_type;
184 $this->type_label = $obj->type_label;
185 $this->fk_account = $obj->fk_account;
186 $this->mode_reglement_id = $obj->fk_mode_reglement;
187 $this->mode_reglement_code = $obj->mode_reglement_code;
188 $this->mode_reglement = $obj->mode_reglement_libelle;
189 $this->amount = $obj->amount;
190 $this->fk_project = $obj->fk_project;
191 $this->fk_user = $obj->fk_user;
192 $this->note_public = $obj->note_public;
193 $this->note_private = $obj->note_private;
194 $this->paye = $obj->paye;
195 $this->periode = $this->db->jdate($obj->period);
196 $this->period = $this->db->jdate($obj->period);
197 $this->import_key = $obj->import_key;
198
199 $this->db->free($resql);
200
201 return 1;
202 } else {
203 return 0;
204 }
205 } else {
206 $this->error = $this->db->lasterror();
207 return -1;
208 }
209 }
210
216 public function check()
217 {
218 $newamount = price2num($this->amount, 'MT');
219
220 // Validation of parameters
221 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
222 return false;
223 }
224
225 return true;
226 }
227
234 public function create($user)
235 {
236 global $conf;
237 $error = 0;
238
239 $now = dol_now();
240
241 // Nettoyage parameters
242 $newamount = price2num($this->amount, 'MT');
243
244 if (!$this->check()) {
245 $this->error = "ErrorBadParameter";
246 return -2;
247 }
248
249 $this->db->begin();
250
251 $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)";
252 $sql .= " VALUES (".((int) $this->type);
253 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
254 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
255 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
256 $sql .= ", '".$this->db->idate($this->date_ech)."'";
257 $sql .= ", '".$this->db->idate($this->periode)."'";
258 $sql .= ", '".price2num($newamount)."'";
259 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
260 $sql .= ", ".((int) $conf->entity);
261 $sql .= ", ".((int) $user->id);
262 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
263 $sql .= ", '".$this->db->idate($now)."'";
264 $sql .= ")";
265
266 dol_syslog(get_class($this)."::create", LOG_DEBUG);
267 $resql = $this->db->query($sql);
268 if ($resql) {
269 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
270
271 //dol_syslog("ChargesSociales::create this->id=".$this->id);
272 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
273 if ($result < 0) {
274 $error++;
275 }
276
277 if (empty($error)) {
278 $this->db->commit();
279 return $this->id;
280 } else {
281 $this->db->rollback();
282 return -1 * $error;
283 }
284 } else {
285 $this->error = $this->db->error();
286 $this->db->rollback();
287 return -1;
288 }
289 }
290
291
298 public function delete($user)
299 {
300 $error = 0;
301
302 $this->db->begin();
303
304 // Get bank transaction lines for this social contributions
305 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
306 $account = new Account($this->db);
307 $lines_url = $account->get_url('', $this->id, 'sc');
308
309 // Delete bank urls
310 foreach ($lines_url as $line_url) {
311 if (!$error) {
312 $accountline = new AccountLine($this->db);
313 $accountline->fetch($line_url['fk_bank']);
314 $result = $accountline->delete_urls($user);
315 if ($result < 0) {
316 $error++;
317 }
318 }
319 }
320
321 // Delete payments
322 if (!$error) {
323 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
324 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
325 $resql = $this->db->query($sql);
326 if (!$resql) {
327 $error++;
328 $this->error = $this->db->lasterror();
329 }
330 }
331
332 if (!$error) {
333 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
334 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
335 $resql = $this->db->query($sql);
336 if (!$resql) {
337 $error++;
338 $this->error = $this->db->lasterror();
339 }
340 }
341
342 if (!$error) {
343 $this->db->commit();
344 return 1;
345 } else {
346 $this->db->rollback();
347 return -1;
348 }
349 }
350
351
359 public function update($user, $notrigger = 0)
360 {
361 $error = 0;
362 $this->db->begin();
363
364 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
365 $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
366 $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
367 $sql .= ", periode='".$this->db->idate($this->periode)."'";
368 $sql .= ", amount='".price2num($this->amount, 'MT')."'";
369 $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
370 $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
371 $sql .= ", fk_user_modif=".$user->id;
372 $sql .= " WHERE rowid=".((int) $this->id);
373
374 dol_syslog(get_class($this)."::update", LOG_DEBUG);
375 $resql = $this->db->query($sql);
376
377 if (!$resql) {
378 $error++;
379 $this->errors[] = "Error ".$this->db->lasterror();
380 }
381
382 if (!$error) {
383 if (!$notrigger) {
384 // Call trigger
385 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
386 if ($result < 0) {
387 $error++;
388 }
389 // End call triggers
390 }
391 }
392
393 // Commit or rollback
394 if ($error) {
395 foreach ($this->errors as $errmsg) {
396 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
397 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
398 }
399 $this->db->rollback();
400 return -1 * $error;
401 } else {
402 $this->db->commit();
403 return 1;
404 }
405 }
406
413 public function solde($year = 0)
414 {
415 global $conf;
416
417 $sql = "SELECT SUM(f.amount) as amount";
418 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
419 $sql .= " WHERE f.entity = ".$conf->entity;
420 $sql .= " AND paye = 0";
421
422 if ($year) {
423 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
424 }
425
426 $result = $this->db->query($sql);
427 if ($result) {
428 if ($this->db->num_rows($result)) {
429 $obj = $this->db->fetch_object($result);
430 $this->db->free($result);
431 return $obj->amount;
432 } else {
433 return 0;
434 }
435 } else {
436 print $this->db->error();
437 return -1;
438 }
439 }
440
441 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
450 public function set_paid($user)
451 {
452 // phpcs:enable
453 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
454 return $this->setPaid($user);
455 }
456
463 public function setPaid($user)
464 {
465 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
466 $sql .= " paye = 1";
467 $sql .= " WHERE rowid = ".((int) $this->id);
468
469 $return = $this->db->query($sql);
470
471 if ($return) {
472 $this->paye = 1;
473
474 return 1;
475 } else {
476 return -1;
477 }
478 }
479
480 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
489 public function set_unpaid($user)
490 {
491 // phpcs:enable
492 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
493 return $this->setUnpaid($user);
494 }
495
502 public function setUnpaid($user)
503 {
504 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
505 $sql .= " paye = 0";
506 $sql .= " WHERE rowid = ".((int) $this->id);
507
508 $return = $this->db->query($sql);
509
510 if ($return) {
511 $this->paye = 0;
512
513 return 1;
514 } else {
515 return -1;
516 }
517 }
518
526 public function getLibStatut($mode = 0, $alreadypaid = -1)
527 {
528 return $this->LibStatut($this->paye, $mode, $alreadypaid);
529 }
530
531 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
540 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
541 {
542 // phpcs:enable
543 global $langs;
544
545 // Load translation files required by the page
546 $langs->loadLangs(array("customers", "bills"));
547
548 // We reinit status array to force to redefine them because label may change according to properties values.
549 $this->labelStatus = array();
550 $this->labelStatusShort = array();
551
552 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
553 global $langs;
554 //$langs->load("mymodule");
555 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
556 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
557 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
558 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
559 }
560 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
561 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
562 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
563 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
564 }
565 }
566
567 $statusType = 'status1';
568 if ($status == 0 && $alreadypaid > 0) {
569 $statusType = 'status3';
570 }
571 if ($status == 1) {
572 $statusType = 'status6';
573 }
574
575 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
576 }
577
578
589 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
590 {
591 global $langs, $conf, $user, $form, $hookmanager;
592
593 if (!empty($conf->dol_no_mouse_hover)) {
594 $notooltip = 1; // Force disable tooltips
595 }
596
597 $result = '';
598
599 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
600
601 if ($short) {
602 return $url;
603 }
604
605 if ($option !== 'nolink') {
606 // Add param to save lastsearch_values or not
607 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
608 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
609 $add_save_lastsearch_values = 1;
610 }
611 if ($add_save_lastsearch_values) {
612 $url .= '&save_lastsearch_values=1';
613 }
614 }
615
616 if (empty($this->ref)) {
617 $this->ref = $this->label;
618 }
619
620 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
621 if (isset($this->paye)) {
622 $label .= ' '.$this->getLibStatut(5);
623 }
624 if (!empty($this->ref)) {
625 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
626 }
627 if (!empty($this->label)) {
628 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
629 }
630 if (!empty($this->type_label)) {
631 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
632 }
633
634 $linkclose = '';
635 if (empty($notooltip) && $user->hasRight("facture", "read")) {
636 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
637 $label = $langs->trans("SocialContribution");
638 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
639 }
640 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
641 $linkclose .= ' class="classfortooltip"';
642 }
643
644 $linkstart = '<a href="'.$url.'"';
645 $linkstart .= $linkclose.'>';
646 $linkend = '</a>';
647
648 $result .= $linkstart;
649 if ($withpicto) {
650 $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);
651 }
652 if ($withpicto != 2) {
653 $result .= $this->ref;
654 }
655 $result .= $linkend;
656 global $action;
657 $hookmanager->initHooks(array($this->element . 'dao'));
658 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
659 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
660 if ($reshook > 0) {
661 $result = $hookmanager->resPrint;
662 } else {
663 $result .= $hookmanager->resPrint;
664 }
665 return $result;
666 }
667
673 public function getSommePaiement()
674 {
675 $table = 'paiementcharge';
676 $field = 'fk_charge';
677
678 $sql = 'SELECT sum(amount) as amount';
679 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
680 $sql .= " WHERE ".$field." = ".((int) $this->id);
681
682 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
683 $resql = $this->db->query($sql);
684 if ($resql) {
685 $amount = 0;
686
687 $obj = $this->db->fetch_object($resql);
688 if ($obj) {
689 $amount = $obj->amount ? $obj->amount : 0;
690 }
691
692 $this->db->free($resql);
693 return $amount;
694 } else {
695 return -1;
696 }
697 }
698
705 public function info($id)
706 {
707 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
708 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
709 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
710 $sql .= " WHERE e.rowid = ".((int) $id);
711
712 dol_syslog(get_class($this)."::info", LOG_DEBUG);
713 $result = $this->db->query($sql);
714 if ($result) {
715 if ($this->db->num_rows($result)) {
716 $obj = $this->db->fetch_object($result);
717
718 $this->id = $obj->rowid;
719
720 $this->user_creation_id = $obj->fk_user_author;
721 $this->user_modification_id = $obj->fk_user_modif;
722 $this->user_validation_id = $obj->fk_user_valid;
723 $this->date_creation = $this->db->jdate($obj->datec);
724 $this->date_modification = $this->db->jdate($obj->datem);
725 $this->date_validation = $this->db->jdate($obj->datev);
726 $this->import_key = $obj->import_key;
727 }
728
729 $this->db->free($result);
730 return 1;
731 } else {
732 dol_print_error($this->db);
733 return -1;
734 }
735 }
736
744 public function initAsSpecimen()
745 {
746 // Initialize parameters
747 $this->id = 0;
748 $this->ref = 'SPECIMEN';
749 $this->specimen = 1;
750 $this->paye = 0;
751 $this->date_creation = dol_now();
752 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
753 $this->periode = $this->date_creation + 3600 * 24 * 30;
754 $this->period = $this->date_creation + 3600 * 24 * 30;
755 $this->amount = 100;
756 $this->label = 'Social contribution label';
757 $this->type = 1;
758 $this->type_label = 'Type of social contribution';
759
760 return 1;
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 if ($selected >= 0) {
784 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
785 }
786 if (property_exists($this, 'label')) {
787 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
788 }
789 if (!empty($arraydata['project']) && $arraydata['project']->id > 0) {
790 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
791 }
792 if (property_exists($this, 'date_ech')) {
793 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
794 }
795 if (property_exists($this, 'amount')) {
796 $return .= '<br>';
797 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
798 }
799 if (method_exists($this, 'LibStatut')) {
800 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
801 }
802 $return .= '</div>';
803 $return .= '</div>';
804 $return .= '</div>';
805 return $return;
806 }
807}
$object ref
Definition info.php:79
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
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 optionally the picto)
info($id)
Charge l'information 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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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:139