dolibarr 21.0.0-alpha
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 public $type_code;
69 public $type_accountancy_code;
70
71 public $amount;
72 public $paye;
76 public $periode;
77 public $period;
78
82 public $lib;
83
87 public $fk_account;
88
92 public $accountid;
93
97 public $paiementtype;
98
99 public $mode_reglement_id;
100 public $mode_reglement_code;
101 public $mode_reglement;
102
106 public $fk_project;
107
111 public $fk_user;
112
116 public $total;
117
118 public $totalpaid;
119
120
121 const STATUS_UNPAID = 0;
122 const STATUS_PAID = 1;
123
124
130 public function __construct(DoliDB $db)
131 {
132 $this->db = $db;
133 }
134
142 public function fetch($id, $ref = '')
143 {
144 $sql = "SELECT cs.rowid, cs.date_ech";
145 $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";
146 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
147 $sql .= ", c.libelle as type_label, c.code as type_code, c.accountancy_code as type_accountancy_code";
148 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
149 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
150 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
151 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
152 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
153 if ($ref) {
154 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
155 } else {
156 $sql .= " AND cs.rowid = ".((int) $id);
157 }
158
159 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
160 $resql = $this->db->query($sql);
161 if ($resql) {
162 if ($this->db->num_rows($resql)) {
163 $obj = $this->db->fetch_object($resql);
164
165 $this->id = $obj->rowid;
166 $this->ref = $obj->rowid;
167 $this->date_ech = $this->db->jdate($obj->date_ech);
168 $this->lib = $obj->label;
169 $this->label = $obj->label;
170 $this->type = $obj->fk_type;
171 $this->type_label = $obj->type_label;
172 $this->type_code = $obj->type_code;
173 $this->type_accountancy_code = $obj->type_accountancy_code;
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->period);
185 $this->period = $this->db->jdate($obj->period);
186 $this->import_key = $obj->import_key;
187
188 $this->db->free($resql);
189
190 return 1;
191 } else {
192 return 0;
193 }
194 } else {
195 $this->error = $this->db->lasterror();
196 return -1;
197 }
198 }
199
205 public function check()
206 {
207 $newamount = price2num($this->amount, 'MT');
208
209 // Validation of parameters
210 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
211 return false;
212 }
213
214 return true;
215 }
216
223 public function create($user)
224 {
225 global $conf;
226 $error = 0;
227
228 $now = dol_now();
229
230 // Nettoyage parameters
231 $newamount = price2num($this->amount, 'MT');
232
233 if (!$this->check()) {
234 $this->error = "ErrorBadParameter";
235 return -2;
236 }
237
238 $this->db->begin();
239
240 $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)";
241 $sql .= " VALUES (".((int) $this->type);
242 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
243 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
244 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
245 $sql .= ", '".$this->db->idate($this->date_ech)."'";
246 $sql .= ", '".$this->db->idate($this->periode)."'";
247 $sql .= ", '".price2num($newamount)."'";
248 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
249 $sql .= ", ".((int) $conf->entity);
250 $sql .= ", ".((int) $user->id);
251 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
252 $sql .= ", '".$this->db->idate($now)."'";
253 $sql .= ")";
254
255 dol_syslog(get_class($this)."::create", LOG_DEBUG);
256 $resql = $this->db->query($sql);
257 if ($resql) {
258 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
259
260 //dol_syslog("ChargesSociales::create this->id=".$this->id);
261 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
262 if ($result < 0) {
263 $error++;
264 }
265
266 if (empty($error)) {
267 $this->db->commit();
268 return $this->id;
269 } else {
270 $this->db->rollback();
271 return -1 * $error;
272 }
273 } else {
274 $this->error = $this->db->error();
275 $this->db->rollback();
276 return -1;
277 }
278 }
279
280
287 public function delete($user)
288 {
289 $error = 0;
290
291 $this->db->begin();
292
293 // Get bank transaction lines for this social contributions
294 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
295 $account = new Account($this->db);
296 $lines_url = $account->get_url('', $this->id, 'sc');
297
298 // Delete bank urls
299 foreach ($lines_url as $line_url) {
300 if (!$error) {
301 $accountline = new AccountLine($this->db);
302 $accountline->fetch($line_url['fk_bank']);
303 $result = $accountline->delete_urls($user);
304 if ($result < 0) {
305 $error++;
306 }
307 }
308 }
309
310 // Delete payments
311 if (!$error) {
312 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
313 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
314 $resql = $this->db->query($sql);
315 if (!$resql) {
316 $error++;
317 $this->error = $this->db->lasterror();
318 }
319 }
320
321 if (!$error) {
322 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
323 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
324 $resql = $this->db->query($sql);
325 if (!$resql) {
326 $error++;
327 $this->error = $this->db->lasterror();
328 }
329 }
330
331 if (!$error) {
332 $this->db->commit();
333 return 1;
334 } else {
335 $this->db->rollback();
336 return -1;
337 }
338 }
339
340
348 public function update($user, $notrigger = 0)
349 {
350 $error = 0;
351 $this->db->begin();
352
353 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
354 $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
355 $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
356 $sql .= ", periode='".$this->db->idate($this->periode)."'";
357 $sql .= ", amount='".price2num($this->amount, 'MT')."'";
358 $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
359 $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
360 $sql .= ", fk_user_modif=".$user->id;
361 $sql .= " WHERE rowid=".((int) $this->id);
362
363 dol_syslog(get_class($this)."::update", LOG_DEBUG);
364 $resql = $this->db->query($sql);
365
366 if (!$resql) {
367 $error++;
368 $this->errors[] = "Error ".$this->db->lasterror();
369 }
370
371 if (!$error) {
372 if (!$notrigger) {
373 // Call trigger
374 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
375 if ($result < 0) {
376 $error++;
377 }
378 // End call triggers
379 }
380 }
381
382 // Commit or rollback
383 if ($error) {
384 foreach ($this->errors as $errmsg) {
385 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
386 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
387 }
388 $this->db->rollback();
389 return -1 * $error;
390 } else {
391 $this->db->commit();
392 return 1;
393 }
394 }
395
402 public function solde($year = 0)
403 {
404 global $conf;
405
406 $sql = "SELECT SUM(f.amount) as amount";
407 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
408 $sql .= " WHERE f.entity = ".$conf->entity;
409 $sql .= " AND paye = 0";
410
411 if ($year) {
412 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
413 }
414
415 $result = $this->db->query($sql);
416 if ($result) {
417 if ($this->db->num_rows($result)) {
418 $obj = $this->db->fetch_object($result);
419 $this->db->free($result);
420 return $obj->amount;
421 } else {
422 return 0;
423 }
424 } else {
425 print $this->db->error();
426 return -1;
427 }
428 }
429
430 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
439 public function set_paid($user)
440 {
441 // phpcs:enable
442 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
443 return $this->setPaid($user);
444 }
445
452 public function setPaid($user)
453 {
454 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
455 $sql .= " paye = 1";
456 $sql .= " WHERE rowid = ".((int) $this->id);
457
458 $return = $this->db->query($sql);
459
460 if ($return) {
461 $this->paye = 1;
462
463 return 1;
464 } else {
465 return -1;
466 }
467 }
468
469 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
478 public function set_unpaid($user)
479 {
480 // phpcs:enable
481 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
482 return $this->setUnpaid($user);
483 }
484
491 public function setUnpaid($user)
492 {
493 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
494 $sql .= " paye = 0";
495 $sql .= " WHERE rowid = ".((int) $this->id);
496
497 $return = $this->db->query($sql);
498
499 if ($return) {
500 $this->paye = 0;
501
502 return 1;
503 } else {
504 return -1;
505 }
506 }
507
515 public function getLibStatut($mode = 0, $alreadypaid = -1)
516 {
517 return $this->LibStatut($this->paye, $mode, $alreadypaid);
518 }
519
520 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
529 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
530 {
531 // phpcs:enable
532 global $langs;
533
534 // Load translation files required by the page
535 $langs->loadLangs(array("customers", "bills"));
536
537 // We reinit status array to force to redefine them because label may change according to properties values.
538 $this->labelStatus = array();
539 $this->labelStatusShort = array();
540
541 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
542 global $langs;
543 //$langs->load("mymodule");
544 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
545 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
546 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
547 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
548 }
549 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
550 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
551 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
552 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
553 }
554 }
555
556 $statusType = 'status1';
557 if ($status == 0 && $alreadypaid > 0) {
558 $statusType = 'status3';
559 }
560 if ($status == 1) {
561 $statusType = 'status6';
562 }
563
564 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
565 }
566
567
578 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
579 {
580 global $langs, $conf, $user, $hookmanager;
581
582 if (!empty($conf->dol_no_mouse_hover)) {
583 $notooltip = 1; // Force disable tooltips
584 }
585
586 $result = '';
587
588 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
589
590 if ($short) {
591 return $url;
592 }
593
594 if ($option !== 'nolink') {
595 // Add param to save lastsearch_values or not
596 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
597 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
598 $add_save_lastsearch_values = 1;
599 }
600 if ($add_save_lastsearch_values) {
601 $url .= '&save_lastsearch_values=1';
602 }
603 }
604
605 if (empty($this->ref)) {
606 $this->ref = $this->label;
607 }
608
609 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
610 if (isset($this->paye)) {
611 $label .= ' '.$this->getLibStatut(5);
612 }
613 if (!empty($this->ref)) {
614 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
615 }
616 if (!empty($this->label)) {
617 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
618 }
619 if (!empty($this->type_label)) {
620 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
621 if (!empty($this->type_accountancy_code)) {
622 $label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.$this->type_accountancy_code.')</span>';
623 }
624 }
625
626 $linkclose = '';
627 if (empty($notooltip) && $user->hasRight("facture", "read")) {
628 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
629 $label = $langs->trans("SocialContribution");
630 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
631 }
632 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
633 $linkclose .= ' class="classfortooltip"';
634 }
635
636 $linkstart = '<a href="'.$url.'"';
637 $linkstart .= $linkclose.'>';
638 $linkend = '</a>';
639
640 $result .= $linkstart;
641 if ($withpicto) {
642 $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);
643 }
644 if ($withpicto != 2) {
645 $result .= $this->ref;
646 }
647 $result .= $linkend;
648
649 global $action;
650 $hookmanager->initHooks(array($this->element . 'dao'));
651 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
652 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
653 if ($reshook > 0) {
654 $result = $hookmanager->resPrint;
655 } else {
656 $result .= $hookmanager->resPrint;
657 }
658
659 return $result;
660 }
661
667 public function getSommePaiement()
668 {
669 $table = 'paiementcharge';
670 $field = 'fk_charge';
671
672 $sql = 'SELECT sum(amount) as amount';
673 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
674 $sql .= " WHERE ".$field." = ".((int) $this->id);
675
676 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
677 $resql = $this->db->query($sql);
678 if ($resql) {
679 $amount = 0;
680
681 $obj = $this->db->fetch_object($resql);
682 if ($obj) {
683 $amount = $obj->amount ? $obj->amount : 0;
684 }
685
686 $this->db->free($resql);
687 return $amount;
688 } else {
689 return -1;
690 }
691 }
692
699 public function info($id)
700 {
701 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
702 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
703 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
704 $sql .= " WHERE e.rowid = ".((int) $id);
705
706 dol_syslog(get_class($this)."::info", LOG_DEBUG);
707 $result = $this->db->query($sql);
708 if ($result) {
709 if ($this->db->num_rows($result)) {
710 $obj = $this->db->fetch_object($result);
711
712 $this->id = $obj->rowid;
713
714 $this->user_creation_id = $obj->fk_user_author;
715 $this->user_modification_id = $obj->fk_user_modif;
716 $this->user_validation_id = $obj->fk_user_valid;
717 $this->date_creation = $this->db->jdate($obj->datec);
718 $this->date_modification = $this->db->jdate($obj->datem);
719 $this->date_validation = $this->db->jdate($obj->datev);
720 $this->import_key = $obj->import_key;
721 }
722
723 $this->db->free($result);
724 return 1;
725 } else {
726 dol_print_error($this->db);
727 return -1;
728 }
729 }
730
738 public function initAsSpecimen()
739 {
740 // Initialize parameters
741 $this->id = 0;
742 $this->ref = 'SPECIMEN';
743 $this->specimen = 1;
744 $this->paye = 0;
745 $this->date_creation = dol_now();
746 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
747 $this->periode = $this->date_creation + 3600 * 24 * 30;
748 $this->period = $this->date_creation + 3600 * 24 * 30;
749 $this->amount = 100;
750 $this->label = 'Social contribution label';
751 $this->type = 1;
752 $this->type_label = 'Type of social contribution';
753
754 return 1;
755 }
756
764 public function getKanbanView($option = '', $arraydata = null)
765 {
766 global $conf, $langs;
767
768 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
769
770 $return = '<div class="box-flex-item box-flex-grow-zero">';
771 $return .= '<div class="info-box info-box-sm">';
772 $return .= '<span class="info-box-icon bg-infobox-action">';
773 $return .= img_picto('', $this->picto);
774 $return .= '</span>';
775 $return .= '<div class="info-box-content">';
776 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
777 if ($selected >= 0) {
778 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
779 }
780 if (property_exists($this, 'label')) {
781 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
782 }
783 if (!empty($arraydata['project']) && $arraydata['project']->id > 0) {
784 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
785 }
786 if (property_exists($this, 'date_ech')) {
787 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
788 }
789 if (property_exists($this, 'amount')) {
790 $return .= '<br>';
791 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
792 }
793 if (method_exists($this, 'LibStatut')) {
794 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
795 }
796 $return .= '</div>';
797 $return .= '</div>';
798 $return .= '</div>';
799 return $return;
800 }
801}
$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