dolibarr 22.0.5
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-2025 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
47 public $table = 'chargesociales';
48
52 public $table_element = 'chargesociales';
53
57 public $picto = 'bill';
58
62 protected $table_ref_field = 'ref';
63
67 public $date_ech;
68
72 public $label;
73
77 public $type;
78
82 public $type_label;
83
87 public $type_code;
88
92 public $type_accountancy_code;
93
97 public $amount;
98
102 public $paye;
103
108 public $periode;
109
113 public $period;
114
119 public $lib;
120
124 public $fk_account;
125
129 public $accountid;
130
134 public $paiementtype;
135
139 public $mode_reglement_id;
140
144 public $mode_reglement_code;
145
149 public $mode_reglement;
150
154 public $fk_project;
155
159 public $fk_user;
160
164 public $total;
165
169 public $totalpaid;
170
174 const STATUS_UNPAID = 0;
175
179 const STATUS_PAID = 1;
180
181
187 public function __construct(DoliDB $db)
188 {
189 $this->db = $db;
190 }
191
199 public function fetch($id, $ref = '')
200 {
201 $sql = "SELECT cs.rowid, cs.date_ech";
202 $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";
203 $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
204 $sql .= ", c.libelle as type_label, c.code as type_code, c.accountancy_code as type_accountancy_code";
205 $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
206 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
207 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
208 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
209 $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
210 if ($ref) {
211 $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
212 } else {
213 $sql .= " AND cs.rowid = ".((int) $id);
214 }
215
216 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
217 $resql = $this->db->query($sql);
218 if ($resql) {
219 if ($this->db->num_rows($resql)) {
220 $obj = $this->db->fetch_object($resql);
221
222 $this->id = $obj->rowid;
223 $this->ref = $obj->rowid;
224 $this->date_ech = $this->db->jdate($obj->date_ech);
225 $this->lib = $obj->label;
226 $this->label = $obj->label;
227 $this->type = $obj->fk_type;
228 $this->type_label = $obj->type_label;
229 $this->type_code = $obj->type_code;
230 $this->type_accountancy_code = $obj->type_accountancy_code;
231 $this->fk_account = $obj->fk_account;
232 $this->mode_reglement_id = $obj->fk_mode_reglement;
233 $this->mode_reglement_code = $obj->mode_reglement_code;
234 $this->mode_reglement = $obj->mode_reglement_libelle;
235 $this->amount = $obj->amount;
236 $this->fk_project = $obj->fk_project;
237 $this->fk_user = $obj->fk_user;
238 $this->note_public = $obj->note_public;
239 $this->note_private = $obj->note_private;
240 $this->paye = $obj->paye;
241 $this->periode = $this->db->jdate($obj->period);
242 $this->period = $this->db->jdate($obj->period);
243 $this->import_key = $obj->import_key;
244
245 $this->db->free($resql);
246
247 return 1;
248 } else {
249 return 0;
250 }
251 } else {
252 $this->error = $this->db->lasterror();
253 return -1;
254 }
255 }
256
262 public function check()
263 {
264 $newamount = price2num($this->amount, 'MT');
265
266 // Validation of parameters
267 if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
268 return false;
269 }
270
271 return true;
272 }
273
280 public function create($user)
281 {
282 global $conf;
283 $error = 0;
284
285 $now = dol_now();
286
287 // Nettoyage parameters
288 $newamount = price2num($this->amount, 'MT');
289
290 if (!$this->check()) {
291 $this->error = "ErrorBadParameter";
292 return -2;
293 }
294
295 $this->db->begin();
296
297 $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)";
298 $sql .= " VALUES (".((int) $this->type);
299 $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
300 $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
301 $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
302 $sql .= ", '".$this->db->idate($this->date_ech)."'";
303 $sql .= ", '".$this->db->idate($this->period)."'";
304 $sql .= ", '".price2num($newamount)."'";
305 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
306 $sql .= ", ".((int) $conf->entity);
307 $sql .= ", ".((int) $user->id);
308 $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
309 $sql .= ", '".$this->db->idate($now)."'";
310 $sql .= ")";
311
312 dol_syslog(get_class($this)."::create", LOG_DEBUG);
313 $resql = $this->db->query($sql);
314 if ($resql) {
315 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
316
317 //dol_syslog("ChargesSociales::create this->id=".$this->id);
318 $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
319 if ($result < 0) {
320 $error++;
321 }
322
323 if (empty($error)) {
324 $this->db->commit();
325 return $this->id;
326 } else {
327 $this->db->rollback();
328 return -1 * $error;
329 }
330 } else {
331 $this->error = $this->db->error();
332 $this->db->rollback();
333 return -1;
334 }
335 }
336
337
344 public function delete($user)
345 {
346 $error = 0;
347
348 $this->db->begin();
349
350 // Get bank transaction lines for this social contributions
351 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
352 $account = new Account($this->db);
353 $lines_url = $account->get_url(0, $this->id, 'sc');
354
355 // Delete bank urls
356 foreach ($lines_url as $line_url) {
357 if (!$error) {
358 $accountline = new AccountLine($this->db);
359 $accountline->fetch($line_url['fk_bank']);
360 $result = $accountline->delete_urls($user);
361 if ($result < 0) {
362 $error++;
363 }
364 }
365 }
366
367 // Delete payments
368 if (!$error) {
369 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
370 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
371 $resql = $this->db->query($sql);
372 if (!$resql) {
373 $error++;
374 $this->error = $this->db->lasterror();
375 }
376 }
377
378 if (!$error) {
379 $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
380 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
381 $resql = $this->db->query($sql);
382 if (!$resql) {
383 $error++;
384 $this->error = $this->db->lasterror();
385 }
386 }
387
388 if (!$error) {
389 $this->db->commit();
390 return 1;
391 } else {
392 $this->db->rollback();
393 return -1;
394 }
395 }
396
397
405 public function update($user, $notrigger = 0)
406 {
407 $error = 0;
408 $this->db->begin();
409
410 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
411 $sql .= " SET libelle = '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
412 $sql .= ", date_ech = '".$this->db->idate($this->date_ech)."'";
413 $sql .= ", periode = '".$this->db->idate($this->period ? $this->period : $this->periode)."'";
414 $sql .= ", amount = ".((float) price2num($this->amount, 'MT'));
415 $sql .= ", fk_projet=".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL");
416 $sql .= ", fk_user=".($this->fk_user > 0 ? ((int) $this->fk_user) : "NULL");
417 $sql .= ", fk_user_modif=".((int) $user->id);
418 if ($this->type > 0) {
419 $sql .= ", fk_type = ".((int) $this->type);
420 }
421 $sql .= " WHERE rowid=".((int) $this->id);
422
423 dol_syslog(get_class($this)."::update", LOG_DEBUG);
424 $resql = $this->db->query($sql);
425
426 if (!$resql) {
427 $error++;
428 $this->errors[] = "Error ".$this->db->lasterror();
429 }
430
431 if (!$error) {
432 if (!$notrigger) {
433 // Call trigger
434 $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
435 if ($result < 0) {
436 $error++;
437 }
438 // End call triggers
439 }
440 }
441
442 // Commit or rollback
443 if ($error) {
444 foreach ($this->errors as $errmsg) {
445 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
446 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
447 }
448 $this->db->rollback();
449 return -1 * $error;
450 } else {
451 $this->db->commit();
452 return 1;
453 }
454 }
455
462 public function solde($year = 0)
463 {
464 global $conf;
465
466 $sql = "SELECT SUM(f.amount) as amount";
467 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
468 $sql .= " WHERE f.entity = ".((int) $conf->entity);
469 $sql .= " AND paye = 0";
470
471 if ($year) { // TODO Fix to use date function
472 $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
473 }
474
475 $result = $this->db->query($sql);
476 if ($result) {
477 if ($this->db->num_rows($result)) {
478 $obj = $this->db->fetch_object($result);
479 $this->db->free($result);
480 return $obj->amount;
481 } else {
482 return 0;
483 }
484 } else {
485 print $this->db->error();
486 return -1;
487 }
488 }
489
490 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
499 public function set_paid($user)
500 {
501 // phpcs:enable
502 dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
503 return $this->setPaid($user);
504 }
505
512 public function setPaid($user)
513 {
514 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
515 $sql .= " paye = 1";
516 $sql .= " WHERE rowid = ".((int) $this->id);
517
518 $return = $this->db->query($sql);
519
520 if ($return) {
521 $this->paye = 1;
522
523 return 1;
524 } else {
525 return -1;
526 }
527 }
528
529 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
538 public function set_unpaid($user)
539 {
540 // phpcs:enable
541 dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
542 return $this->setUnpaid($user);
543 }
544
551 public function setUnpaid($user)
552 {
553 $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
554 $sql .= " paye = 0";
555 $sql .= " WHERE rowid = ".((int) $this->id);
556
557 $return = $this->db->query($sql);
558
559 if ($return) {
560 $this->paye = 0;
561
562 return 1;
563 } else {
564 return -1;
565 }
566 }
567
575 public function getLibStatut($mode = 0, $alreadypaid = -1)
576 {
577 return $this->LibStatut($this->paye, $mode, $alreadypaid);
578 }
579
580 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
589 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
590 {
591 // phpcs:enable
592 global $langs;
593
594 // Load translation files required by the page
595 $langs->loadLangs(array("customers", "bills"));
596
597 // We reinit status array to force to redefine them because label may change according to properties values.
598 $this->labelStatus = array();
599 $this->labelStatusShort = array();
600
601 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
602 global $langs;
603 //$langs->load("mymodule");
604 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
605 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
606 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
607 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
608 }
609 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
610 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
611 if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
612 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
613 }
614 }
615
616 $statusType = 'status1';
617 if ($status == 0 && $alreadypaid > 0) {
618 $statusType = 'status3';
619 }
620 if ($status == 1) {
621 $statusType = 'status6';
622 }
623
624 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
625 }
626
627
639 public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
640 {
641 global $langs, $conf, $user, $hookmanager;
642
643 if (!empty($conf->dol_no_mouse_hover)) {
644 $notooltip = 1; // Force disable tooltips
645 }
646
647 $result = '';
648
649 $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
650
651 if ($short) {
652 return $url;
653 }
654
655 if ($option !== 'nolink') {
656 // Add param to save lastsearch_values or not
657 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
658 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
659 $add_save_lastsearch_values = 1;
660 }
661 if ($add_save_lastsearch_values) {
662 $url .= '&save_lastsearch_values=1';
663 }
664 }
665
666 if (empty($this->ref)) {
667 $this->ref = $this->label;
668 }
669
670 $label = img_picto('', $this->picto, 'class="pictofixedwidth"').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
671 if (isset($this->paye)) {
672 $label .= ' '.$this->getLibStatut(5);
673 }
674 if (!empty($this->id)) {
675 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->id;
676 }
677 if (!empty($this->label)) {
678 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
679 }
680 if (!empty($this->type_label)) {
681 $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
682 if (isModEnabled('accounting') || !empty($this->type_accountancy_code)) {
683 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
684 $label .= ' <span class="opacitymedium">('.$langs->trans('AccountancyCode').': '.(empty($this->type_accountancy_code) ? $langs->trans("Unknown") : length_accountg($this->type_accountancy_code)).')</span>';
685 }
686 }
687
688 $linkclose = '';
689 if (empty($notooltip) && $user->hasRight("facture", "read")) {
690 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
691 $label = $langs->trans("SocialContribution");
692 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
693 }
694 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
695 $linkclose .= ' class="classfortooltip"';
696 }
697
698 $linkstart = '<a href="'.$url.'"';
699 $linkstart .= $linkclose.'>';
700 $linkend = '</a>';
701
702 $result .= $linkstart;
703 if ($withpicto) {
704 $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);
705 }
706 if ($withpicto != 2) {
707 $result .= $this->ref;
708 }
709 $result .= $linkend;
710
711 if ($addlinktonotes) {
712 $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
713 if ($txttoshow) {
714 $notetoshow = $langs->trans("ViewPrivateNote").':<br>'.$txttoshow;
715 $result .= ' <span class="note inline-block">';
716 $result .= '<a href="'.DOL_URL_ROOT.'/compta/sociales/note.php?id='.$this->id.'" class="classfortooltip" title="'.dolPrintHTMLForAttribute($notetoshow).'">';
717 $result .= img_picto('', 'note');
718 $result .= '</a>';
719 $result .= '</span>';
720 }
721 }
722
723 global $action;
724 $hookmanager->initHooks(array($this->element . 'dao'));
725 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
726 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
727 if ($reshook > 0) {
728 $result = $hookmanager->resPrint;
729 } else {
730 $result .= $hookmanager->resPrint;
731 }
732
733 return $result;
734 }
735
741 public function getSommePaiement()
742 {
743 $table = 'paiementcharge';
744 $field = 'fk_charge';
745
746 $sql = 'SELECT sum(amount) as amount';
747 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
748 $sql .= " WHERE ".$field." = ".((int) $this->id);
749
750 dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
751 $resql = $this->db->query($sql);
752 if ($resql) {
753 $amount = 0;
754
755 $obj = $this->db->fetch_object($resql);
756 if ($obj) {
757 $amount = $obj->amount ? $obj->amount : 0;
758 }
759
760 $this->db->free($resql);
761 return $amount;
762 } else {
763 return -1;
764 }
765 }
766
773 public function info($id)
774 {
775 $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
776 $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
777 $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
778 $sql .= " WHERE e.rowid = ".((int) $id);
779
780 dol_syslog(get_class($this)."::info", LOG_DEBUG);
781 $result = $this->db->query($sql);
782 if ($result) {
783 if ($this->db->num_rows($result)) {
784 $obj = $this->db->fetch_object($result);
785
786 $this->id = $obj->rowid;
787
788 $this->user_creation_id = $obj->fk_user_author;
789 $this->user_modification_id = $obj->fk_user_modif;
790 $this->user_validation_id = $obj->fk_user_valid;
791 $this->date_creation = $this->db->jdate($obj->datec);
792 $this->date_modification = $this->db->jdate($obj->datem);
793 $this->date_validation = $this->db->jdate($obj->datev);
794 $this->import_key = $obj->import_key;
795 }
796
797 $this->db->free($result);
798 return 1;
799 } else {
800 dol_print_error($this->db);
801 return -1;
802 }
803 }
804
812 public function initAsSpecimen()
813 {
814 // Initialize parameters
815 $this->id = 0;
816 $this->ref = 'SPECIMEN';
817 $this->specimen = 1;
818 $this->paye = 0;
819 $this->date_creation = dol_now();
820 $this->date_ech = $this->date_creation + 3600 * 24 * 30;
821 $this->periode = $this->date_creation + 3600 * 24 * 30;
822 $this->period = $this->date_creation + 3600 * 24 * 30;
823 $this->amount = 100;
824 $this->label = 'Social contribution label';
825 $this->type = 1;
826 $this->type_label = 'Type of social contribution';
827
828 return 1;
829 }
830
838 public function getKanbanView($option = '', $arraydata = null)
839 {
840 global $conf, $langs;
841
842 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
843
844 $return = '<div class="box-flex-item box-flex-grow-zero">';
845 $return .= '<div class="info-box info-box-sm">';
846 $return .= '<span class="info-box-icon bg-infobox-action">';
847 $return .= img_picto('', $this->picto);
848 $return .= '</span>';
849 $return .= '<div class="info-box-content">';
850 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(0) : $this->ref).'</span>';
851 if ($selected >= 0) {
852 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
853 }
854 if (property_exists($this, 'label')) {
855 $return .= ' &nbsp; <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
856 }
857 if (!empty($arraydata['project']) && $arraydata['project'] instanceof Project && $arraydata['project']->id > 0) {
858 $return .= '<br><span class="info-box-label">'.$arraydata['project']->getNomUrl(1).'</span>';
859 }
860 if (property_exists($this, 'date_ech')) {
861 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->date_ech, 'day').'</span>';
862 }
863 if (property_exists($this, 'amount')) {
864 $return .= '<br>';
865 $return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
866 }
867 if (method_exists($this, 'LibStatut')) {
868 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
869 }
870 $return .= '</div>';
871 $return .= '</div>';
872 $return .= '</div>';
873 return $return;
874 }
875}
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
$object ref
Definition info.php:90
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 clickable 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.
getNomUrl($withpicto=0, $option='', $notooltip=0, $short=0, $save_lastsearch_value=-1, $addlinktonotes=0)
Return a link to the object card (with optionally the picto)
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.
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.
Class to manage projects.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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 '.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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).
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
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 a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:158