dolibarr 24.0.0-beta
paymentsocialcontribution.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) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
5 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
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
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
30
31
36{
40 public $element = 'paiementcharge';
41
45 public $table_element = 'paiementcharge';
46
50 public $picto = 'payment';
51
55 public $label;
56
60 public $fk_charge;
61
65 public $datec = '';
66
70 public $datep = '';
71
75 public $type_code;
76
80 public $type_label;
81
85 public $bank_account;
86
90 public $bank_line;
91
97 public $total;
98
102 public $amount; // Total amount of payment
106 public $amounts = array(); // Array of amounts
107
111 public $fk_typepaiement;
112
118 public $num_paiement;
119
124 public $num_payment;
125
129 public $fk_bank;
130
134 public $fk_user_creat;
135
139 public $fk_user_modif;
140
144 public $chid;
145
149 public $datepaye;
150
154 public $paiementtype;
155
156
162 public function __construct(DoliDB $db)
163 {
164 $this->db = $db;
165 }
166
175 public function create($user, $closepaidcontrib = 0)
176 {
177 $error = 0;
178
179 $now = dol_now();
180
181 dol_syslog(get_class($this)."::create", LOG_DEBUG);
182
183 // Validate parameters
184 if (!$this->datepaye) {
185 $this->error = 'ErrorBadValueForParameterCreatePaymentSocialContrib';
186 return -1;
187 }
188
189 // Clean parameters
190 if (isset($this->fk_charge)) {
191 $this->fk_charge = (int) $this->fk_charge;
192 }
193 if (isset($this->amount)) {
194 $this->amount = (float) $this->amount;
195 }
196 if (isset($this->fk_typepaiement)) {
197 $this->fk_typepaiement = (int) $this->fk_typepaiement;
198 }
199 if (isset($this->num_payment)) {
200 $this->num_payment = trim($this->num_payment);
201 }
202 if (isset($this->note_private)) {
203 $this->note_private = trim($this->note_private);
204 }
205 if (isset($this->fk_bank)) {
206 $this->fk_bank = (int) $this->fk_bank;
207 }
208 if (isset($this->fk_user_creat)) {
209 $this->fk_user_creat = (int) $this->fk_user_creat;
210 }
211 if (isset($this->fk_user_modif)) {
212 $this->fk_user_modif = (int) $this->fk_user_modif;
213 }
214
215 $totalamount = 0;
216 foreach ($this->amounts as $key => $value) { // How payment is dispatch
217 $newvalue = (float) price2num($value, 'MT');
218 $this->amounts[$key] = $newvalue;
219 $totalamount += $newvalue;
220 }
221 $totalamount = (float) price2num($totalamount);
222
223 // Check parameters
224 if ($totalamount == 0) {
225 $this->error = 'ErrorPaymentAmountMustNotBeNull';
226 return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
227 }
228
229
230 $this->db->begin();
231
232 if ($totalamount != 0) {
233 $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
234 $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
235 $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
236 $sql .= " '".$this->db->idate($this->datepaye)."',";
237 $sql .= " ".((float) $totalamount).",";
238 $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
239 $sql .= " 0)";
240
241 $resql = $this->db->query($sql);
242 if ($resql) {
243 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
244
245 // Insere tableau des montants / factures
246 foreach ($this->amounts as $key => $amount) {
247 $contribid = $key;
248 if (is_numeric($amount) && $amount != 0) {
249 $amount = (float) price2num($amount);
250
251 // If we want to closed paid invoices
252 if ($closepaidcontrib) {
253 $contrib = new ChargeSociales($this->db);
254 $contrib->fetch($contribid);
255 $paiement = $contrib->getSommePaiement();
256 //$creditnotes=$contrib->getSumCreditNotesUsed();
257 $creditnotes = 0;
258 //$deposits=$contrib->getSumDepositsUsed();
259 $deposits = 0;
260 $alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT');
261 $remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
262 if ($remaintopay == 0) {
263 $result = $contrib->setPaid($user);
264 } else {
265 dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
266 }
267 }
268 }
269 }
270 } else {
271 $error++;
272 }
273 }
274
275 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
276 if ($result < 0) {
277 $error++;
278 }
279
280 if ($totalamount != 0 && !$error) {
281 $this->amount = $totalamount;
282 $this->total = $totalamount; // deprecated
283 $this->db->commit();
284 return $this->id;
285 } else {
286 $this->error = $this->db->error();
287 $this->db->rollback();
288 return -1;
289 }
290 }
291
298 public function fetch($id)
299 {
300 $sql = "SELECT";
301 $sql .= " t.rowid,";
302 $sql .= " t.fk_charge,";
303 $sql .= " t.datec,";
304 $sql .= " t.tms,";
305 $sql .= " t.datep,";
306 $sql .= " t.amount,";
307 $sql .= " t.fk_typepaiement,";
308 $sql .= " t.num_paiement as num_payment,";
309 $sql .= " t.note as note_private,";
310 $sql .= " t.fk_bank,";
311 $sql .= " t.fk_user_creat,";
312 $sql .= " t.fk_user_modif,";
313 $sql .= " pt.code as type_code, pt.libelle as type_label,";
314 $sql .= ' b.fk_account';
315 $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
316 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
317 $sql .= " WHERE t.rowid = ".((int) $id);
318 // TODO link on entity of tax;
319
320 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
321 $resql = $this->db->query($sql);
322 if ($resql) {
323 if ($this->db->num_rows($resql)) {
324 $obj = $this->db->fetch_object($resql);
325
326 $this->id = $obj->rowid;
327 $this->ref = $obj->rowid;
328
329 $this->fk_charge = $obj->fk_charge;
330 $this->datec = $this->db->jdate($obj->datec);
331 $this->tms = $this->db->jdate($obj->tms);
332 $this->datep = $this->db->jdate($obj->datep);
333 $this->amount = $obj->amount;
334 $this->total = $obj->amount;
335 $this->fk_typepaiement = $obj->fk_typepaiement;
336 $this->num_payment = $obj->num_payment;
337 $this->num_paiement = $obj->num_payment;
338 $this->note_private = $obj->note_private;
339 $this->fk_bank = $obj->fk_bank;
340 $this->fk_user_creat = $obj->fk_user_creat;
341 $this->fk_user_modif = $obj->fk_user_modif;
342
343 $this->type_code = $obj->type_code;
344 $this->type_label = $obj->type_label;
345
346 $this->bank_account = $obj->fk_account;
347 $this->bank_line = $obj->fk_bank;
348 }
349 $this->db->free($resql);
350
351 return 1;
352 } else {
353 $this->error = "Error ".$this->db->lasterror();
354 return -1;
355 }
356 }
357
358
366 public function update($user = null, $notrigger = 0)
367 {
368 global $conf, $langs;
369 $error = 0;
370
371 // Clean parameters
372
373 if (isset($this->fk_charge)) {
374 $this->fk_charge = (int) $this->fk_charge;
375 }
376 if (isset($this->amount)) {
377 $this->amount = (float) $this->amount;
378 }
379 if (isset($this->fk_typepaiement)) {
380 $this->fk_typepaiement = (int) $this->fk_typepaiement;
381 }
382 if (isset($this->num_payment)) {
383 $this->num_payment = trim($this->num_payment);
384 }
385 if (isset($this->note_private)) {
386 $this->note_private = trim($this->note_private);
387 }
388 if (isset($this->fk_bank)) {
389 $this->fk_bank = (int) $this->fk_bank;
390 }
391 if (isset($this->fk_user_creat)) {
392 $this->fk_user_creat = (int) $this->fk_user_creat;
393 }
394 if (isset($this->fk_user_modif)) {
395 $this->fk_user_modif = (int) $this->fk_user_modif;
396 }
397
398
399
400 // Check parameters
401 // Put here code to add control on parameters values
402
403 // Update request
404 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
405 $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").",";
406 $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
407 $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
408 $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
409 $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").",";
410 $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").",";
411 $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
412 $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
413 $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
414 $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
415 $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
416 $sql .= " WHERE rowid=".((int) $this->id);
417
418 $this->db->begin();
419
420 dol_syslog(get_class($this)."::update", LOG_DEBUG);
421 $resql = $this->db->query($sql);
422 if (!$resql) {
423 $error++;
424 $this->errors[] = "Error ".$this->db->lasterror();
425 }
426
427 // Commit or rollback
428 if ($error) {
429 foreach ($this->errors as $errmsg) {
430 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
431 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
432 }
433 $this->db->rollback();
434 return -1 * $error;
435 } else {
436 $this->db->commit();
437 return 1;
438 }
439 }
440
441
449 public function delete($user, $notrigger = 0)
450 {
451 $error = 0;
452
453 dol_syslog(get_class($this)."::delete");
454
455 $this->db->begin();
456
457 if ($this->bank_line > 0) {
458 $accline = new AccountLine($this->db);
459 $accline->fetch($this->bank_line);
460 $result = $accline->delete($user);
461 if ($result < 0) {
462 $this->errors[] = $accline->error;
463 $error++;
464 }
465 }
466
467 if (!$error) {
468 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
469 $sql .= " WHERE rowid=".((int) $this->id);
470
471 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
472 $resql = $this->db->query($sql);
473 if (!$resql) {
474 $error++;
475 $this->errors[] = "Error ".$this->db->lasterror();
476 }
477 }
478
479 // Commit or rollback
480 if ($error) {
481 foreach ($this->errors as $errmsg) {
482 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
483 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
484 }
485 $this->db->rollback();
486 return -1 * $error;
487 } else {
488 $this->db->commit();
489 return 1;
490 }
491 }
492
493
494
502 public function createFromClone(User $user, $fromid)
503 {
504 $error = 0;
505
506 $object = new PaymentSocialContribution($this->db);
507
508 $this->db->begin();
509
510 // Load source object
511 $object->fetch($fromid);
512 $object->id = 0;
513 $object->statut = 0;
514 $object->status = 0;
515
516 // Clear fields
517 // ...
518
519 // Create clone
520 $object->context['createfromclone'] = 'createfromclone';
521 $result = $object->create($user);
522
523 // Other options
524 if ($result < 0) {
526 $error++;
527 }
528
529 unset($object->context['createfromclone']);
530
531 // End
532 if (!$error) {
533 $this->db->commit();
534 return $object->id;
535 } else {
536 $this->db->rollback();
537 return -1;
538 }
539 }
540
541
549 public function initAsSpecimen()
550 {
551 $this->id = 0;
552 $this->fk_charge = 0;
553 $this->datec = dol_now();
554 $this->tms = dol_now();
555 $this->datep = dol_now();
556 $this->amount = 100;
557 $this->fk_typepaiement = 0;
558 $this->num_payment = 'ABC123';
559 $this->note_private = '';
560 $this->note_public = '';
561 $this->fk_bank = 0;
562 $this->fk_user_creat = 0;
563 $this->fk_user_modif = 0;
564
565 return 1;
566 }
567
568
581 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
582 {
583 global $conf, $langs;
584
585 // Clean data
586 $this->num_payment = trim($this->num_payment);
587
588 $error = 0;
589
590 if (isModEnabled("bank")) {
591 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
592
593 $acc = new Account($this->db);
594 $acc->fetch($accountid);
595
596 $total = $this->amount;
597 if ($mode == 'payment_sc') {
598 $total = -$total;
599 }
600
601 // Insert payment into llx_bank
602 $bank_line_id = $acc->addline(
603 $this->datepaye,
604 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
605 $label,
606 $total,
607 $this->num_payment,
608 0,
609 $user,
610 $emetteur_nom,
611 $emetteur_banque
612 );
613
614 // Mise a jour fk_bank dans llx_paiement.
615 // On connait ainsi le paiement qui a genere l'ecriture bancaire
616 if ($bank_line_id > 0) {
617 $result = $this->update_fk_bank($bank_line_id);
618 if ($result <= 0) {
619 $error++;
620 }
621
622 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
623 $url = '';
624 if ($mode == 'payment_sc') {
625 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
626 }
627 if ($url) {
628 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
629 if ($result <= 0) {
630 $error++;
631 $this->setErrorsFromObject($acc);
632 }
633 }
634
635 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
636 $linkaddedforthirdparty = array();
637 foreach ($this->amounts as $key => $value) {
638 if ($mode == 'payment_sc') {
639 $socialcontrib = new ChargeSociales($this->db);
640 $socialcontrib->fetch($key);
641 $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
642 if ($result <= 0) {
643 $this->setErrorsFromObject($acc);
644 $error++;
645 }
646
647 if ($socialcontrib->fk_user) {
648 $fuser = new User($this->db);
649 $fuser->fetch($socialcontrib->fk_user);
650
651 // Add link 'user' in bank_url between operation and bank transaction
652 $result = $acc->add_url_line(
653 $bank_line_id,
654 $socialcontrib->fk_user,
655 DOL_URL_ROOT.'/user/card.php?id=',
656 $fuser->getFullName($langs),
657 'user'
658 );
659
660 if ($result <= 0) {
661 $this->setErrorsFromObject($acc);
662 $error++;
663 }
664 }
665 }
666 }
667 } else {
668 $this->setErrorsFromObject($acc);
669 $error++;
670 }
671 }
672
673 if (!$error) {
674 return 1;
675 } else {
676 return -1;
677 }
678 }
679
680
681 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
688 public function update_fk_bank($id_bank)
689 {
690 // phpcs:enable
691 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
692
693 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
694 $result = $this->db->query($sql);
695 if ($result) {
696 return 1;
697 } else {
698 $this->error = $this->db->error();
699 return 0;
700 }
701 }
702
703
710 public function getLibStatut($mode = 0)
711 {
712 return $this->LibStatut($this->statut, $mode);
713 }
714
715 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
723 public function LibStatut($status, $mode = 0)
724 {
725 // phpcs:enable
726 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
727
728 $langs->load('compta');
729 /*if ($mode == 0)
730 {
731 if ($status == 0) return $langs->trans('ToValidate');
732 if ($status == 1) return $langs->trans('Validated');
733 }
734 if ($mode == 1)
735 {
736 if ($status == 0) return $langs->trans('ToValidate');
737 if ($status == 1) return $langs->trans('Validated');
738 }
739 if ($mode == 2)
740 {
741 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
742 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
743 }
744 if ($mode == 3)
745 {
746 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
747 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
748 }
749 if ($mode == 4)
750 {
751 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
752 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
753 }
754 if ($mode == 5)
755 {
756 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
757 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
758 }
759 if ($mode == 6)
760 {
761 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
762 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
763 }*/
764 return '';
765 }
766
774 public function getNomUrl($withpicto = 0, $maxlen = 0)
775 {
776 global $langs;
777
778 $result = '';
779
780 if (empty($this->ref)) {
781 $this->ref = $this->label;
782 }
783
784 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
785 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
786 if (!empty($this->label)) {
787 $labeltoshow = $this->label;
788 $reg = array();
789 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
790 // Label generique car entre parentheses. On l'affiche en le traduisant
791 if ($reg[1] == 'paiement') {
792 $reg[1] = 'Payment';
793 }
794 $labeltoshow = $langs->trans($reg[1]);
795 }
796 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
797 }
798 if ($this->datep) {
799 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
800 }
801
802 if (!empty($this->id)) {
803 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
804 $linkend = '</a>';
805
806 if ($withpicto) {
807 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
808 }
809 if ($withpicto && $withpicto != 2) {
810 $result .= ' ';
811 }
812 if ($withpicto != 2) {
813 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
814 }
815 }
816
817 return $result;
818 }
819
820
827 public function getVentilExportCompta($mode = 0)
828 {
829 $alreadydispatched = 0;
830
831 $type = 'bank';
832
833 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
834 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
835 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
836
837 $resql = $this->db->query($sql);
838 if ($resql) {
839 $obj = $this->db->fetch_object($resql);
840 if ($obj) {
841 $alreadydispatched = $obj->nb;
842 }
843 } else {
844 $this->error = $this->db->lasterror();
845 return -1;
846 }
847
848 if ($alreadydispatched) {
849 return $alreadydispatched;
850 }
851 return 0;
852 }
853}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$object ref
Definition info.php:90
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
setErrorsFromObject($object)
setErrorsFromObject
Class to manage Dolibarr database access.
Class to manage payments of social contributions.
getLibStatut($mode=0)
Return the label of the status.
fetch($id)
Load object in memory from database.
getNomUrl($withpicto=0, $maxlen=0)
Return clickable name (with picto eventually)
getVentilExportCompta($mode=0)
Return if object was dispatched into bookkeeping, or return the array of bookkeeping id.
create($user, $closepaidcontrib=0)
Create payment of social contribution into database.
addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
Add record into bank for payment with links between this bank record and invoices of payment.
LibStatut($status, $mode=0)
Return the label of a given status.
update($user=null, $notrigger=0)
Update database.
createFromClone(User $user, $fromid)
Load an object from its id and create a new one in database.
update_fk_bank($id_bank)
Update the link between the Payment and the line generated in llx_bank.
initAsSpecimen()
Initialise an instance with random values.
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
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 '.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
Definition receipt.php:489