dolibarr 22.0.5
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 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024 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
62 public $datec = '';
63 public $datep = '';
64
68 public $type_code;
69
73 public $type_label;
74
78 public $bank_account;
79
83 public $bank_line;
84
90 public $total;
91
95 public $amount; // Total amount of payment
99 public $amounts = array(); // Array of amounts
100
104 public $fk_typepaiement;
105
111 public $num_paiement;
112
117 public $num_payment;
118
122 public $fk_bank;
123
127 public $fk_user_creat;
128
132 public $fk_user_modif;
133
137 public $chid;
138
142 public $datepaye;
143
147 public $paiementtype;
148
149
155 public function __construct(DoliDB $db)
156 {
157 $this->db = $db;
158 }
159
168 public function create($user, $closepaidcontrib = 0)
169 {
170 $error = 0;
171
172 $now = dol_now();
173
174 dol_syslog(get_class($this)."::create", LOG_DEBUG);
175
176 // Validate parameters
177 if (!$this->datepaye) {
178 $this->error = 'ErrorBadValueForParameterCreatePaymentSocialContrib';
179 return -1;
180 }
181
182 // Clean parameters
183 if (isset($this->fk_charge)) {
184 $this->fk_charge = (int) $this->fk_charge;
185 }
186 if (isset($this->amount)) {
187 $this->amount = (float) $this->amount;
188 }
189 if (isset($this->fk_typepaiement)) {
190 $this->fk_typepaiement = (int) $this->fk_typepaiement;
191 }
192 if (isset($this->num_payment)) {
193 $this->num_payment = trim($this->num_payment);
194 }
195 if (isset($this->note_private)) {
196 $this->note_private = trim($this->note_private);
197 }
198 if (isset($this->fk_bank)) {
199 $this->fk_bank = (int) $this->fk_bank;
200 }
201 if (isset($this->fk_user_creat)) {
202 $this->fk_user_creat = (int) $this->fk_user_creat;
203 }
204 if (isset($this->fk_user_modif)) {
205 $this->fk_user_modif = (int) $this->fk_user_modif;
206 }
207
208 $totalamount = 0;
209 foreach ($this->amounts as $key => $value) { // How payment is dispatch
210 $newvalue = (float) price2num($value, 'MT');
211 $this->amounts[$key] = $newvalue;
212 $totalamount += $newvalue;
213 }
214 $totalamount = (float) price2num($totalamount);
215
216 // Check parameters
217 if ($totalamount == 0) {
218 return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
219 }
220
221
222 $this->db->begin();
223
224 if ($totalamount != 0) {
225 $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,";
226 $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)";
227 $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
228 $sql .= " '".$this->db->idate($this->datepaye)."',";
229 $sql .= " ".((float) $totalamount).",";
230 $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.",";
231 $sql .= " 0)";
232
233 $resql = $this->db->query($sql);
234 if ($resql) {
235 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
236
237 // Insere tableau des montants / factures
238 foreach ($this->amounts as $key => $amount) {
239 $contribid = $key;
240 if (is_numeric($amount) && $amount != 0) {
241 $amount = (float) price2num($amount);
242
243 // If we want to closed paid invoices
244 if ($closepaidcontrib) {
245 $contrib = new ChargeSociales($this->db);
246 $contrib->fetch($contribid);
247 $paiement = $contrib->getSommePaiement();
248 //$creditnotes=$contrib->getSumCreditNotesUsed();
249 $creditnotes = 0;
250 //$deposits=$contrib->getSumDepositsUsed();
251 $deposits = 0;
252 $alreadypayed = (float) price2num($paiement + $creditnotes + $deposits, 'MT');
253 $remaintopay = (float) price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
254 if ($remaintopay == 0) {
255 $result = $contrib->setPaid($user);
256 } else {
257 dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
258 }
259 }
260 }
261 }
262 } else {
263 $error++;
264 }
265 }
266
267 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
268 if ($result < 0) {
269 $error++;
270 }
271
272 if ($totalamount != 0 && !$error) {
273 $this->amount = $totalamount;
274 $this->total = $totalamount; // deprecated
275 $this->db->commit();
276 return $this->id;
277 } else {
278 $this->error = $this->db->error();
279 $this->db->rollback();
280 return -1;
281 }
282 }
283
290 public function fetch($id)
291 {
292 $sql = "SELECT";
293 $sql .= " t.rowid,";
294 $sql .= " t.fk_charge,";
295 $sql .= " t.datec,";
296 $sql .= " t.tms,";
297 $sql .= " t.datep,";
298 $sql .= " t.amount,";
299 $sql .= " t.fk_typepaiement,";
300 $sql .= " t.num_paiement as num_payment,";
301 $sql .= " t.note as note_private,";
302 $sql .= " t.fk_bank,";
303 $sql .= " t.fk_user_creat,";
304 $sql .= " t.fk_user_modif,";
305 $sql .= " pt.code as type_code, pt.libelle as type_label,";
306 $sql .= ' b.fk_account';
307 $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
308 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
309 $sql .= " WHERE t.rowid = ".((int) $id);
310 // TODO link on entity of tax;
311
312 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
313 $resql = $this->db->query($sql);
314 if ($resql) {
315 if ($this->db->num_rows($resql)) {
316 $obj = $this->db->fetch_object($resql);
317
318 $this->id = $obj->rowid;
319 $this->ref = $obj->rowid;
320
321 $this->fk_charge = $obj->fk_charge;
322 $this->datec = $this->db->jdate($obj->datec);
323 $this->tms = $this->db->jdate($obj->tms);
324 $this->datep = $this->db->jdate($obj->datep);
325 $this->amount = $obj->amount;
326 $this->total = $obj->amount;
327 $this->fk_typepaiement = $obj->fk_typepaiement;
328 $this->num_payment = $obj->num_payment;
329 $this->num_paiement = $obj->num_payment;
330 $this->note_private = $obj->note_private;
331 $this->fk_bank = $obj->fk_bank;
332 $this->fk_user_creat = $obj->fk_user_creat;
333 $this->fk_user_modif = $obj->fk_user_modif;
334
335 $this->type_code = $obj->type_code;
336 $this->type_label = $obj->type_label;
337
338 $this->bank_account = $obj->fk_account;
339 $this->bank_line = $obj->fk_bank;
340 }
341 $this->db->free($resql);
342
343 return 1;
344 } else {
345 $this->error = "Error ".$this->db->lasterror();
346 return -1;
347 }
348 }
349
350
358 public function update($user = null, $notrigger = 0)
359 {
360 global $conf, $langs;
361 $error = 0;
362
363 // Clean parameters
364
365 if (isset($this->fk_charge)) {
366 $this->fk_charge = (int) $this->fk_charge;
367 }
368 if (isset($this->amount)) {
369 $this->amount = (float) $this->amount;
370 }
371 if (isset($this->fk_typepaiement)) {
372 $this->fk_typepaiement = (int) $this->fk_typepaiement;
373 }
374 if (isset($this->num_payment)) {
375 $this->num_payment = trim($this->num_payment);
376 }
377 if (isset($this->note_private)) {
378 $this->note_private = trim($this->note_private);
379 }
380 if (isset($this->fk_bank)) {
381 $this->fk_bank = (int) $this->fk_bank;
382 }
383 if (isset($this->fk_user_creat)) {
384 $this->fk_user_creat = (int) $this->fk_user_creat;
385 }
386 if (isset($this->fk_user_modif)) {
387 $this->fk_user_modif = (int) $this->fk_user_modif;
388 }
389
390
391
392 // Check parameters
393 // Put here code to add control on parameters values
394
395 // Update request
396 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
397 $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").",";
398 $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
399 $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
400 $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
401 $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").",";
402 $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").",";
403 $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
404 $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
405 $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
406 $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
407 $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
408 $sql .= " WHERE rowid=".((int) $this->id);
409
410 $this->db->begin();
411
412 dol_syslog(get_class($this)."::update", LOG_DEBUG);
413 $resql = $this->db->query($sql);
414 if (!$resql) {
415 $error++;
416 $this->errors[] = "Error ".$this->db->lasterror();
417 }
418
419 // Commit or rollback
420 if ($error) {
421 foreach ($this->errors as $errmsg) {
422 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
423 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
424 }
425 $this->db->rollback();
426 return -1 * $error;
427 } else {
428 $this->db->commit();
429 return 1;
430 }
431 }
432
433
441 public function delete($user, $notrigger = 0)
442 {
443 $error = 0;
444
445 dol_syslog(get_class($this)."::delete");
446
447 $this->db->begin();
448
449 if ($this->bank_line > 0) {
450 $accline = new AccountLine($this->db);
451 $accline->fetch($this->bank_line);
452 $result = $accline->delete($user);
453 if ($result < 0) {
454 $this->errors[] = $accline->error;
455 $error++;
456 }
457 }
458
459 if (!$error) {
460 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
461 $sql .= " WHERE rowid=".((int) $this->id);
462
463 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
464 $resql = $this->db->query($sql);
465 if (!$resql) {
466 $error++;
467 $this->errors[] = "Error ".$this->db->lasterror();
468 }
469 }
470
471 // Commit or rollback
472 if ($error) {
473 foreach ($this->errors as $errmsg) {
474 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
475 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
476 }
477 $this->db->rollback();
478 return -1 * $error;
479 } else {
480 $this->db->commit();
481 return 1;
482 }
483 }
484
485
486
494 public function createFromClone(User $user, $fromid)
495 {
496 $error = 0;
497
498 $object = new PaymentSocialContribution($this->db);
499
500 $this->db->begin();
501
502 // Load source object
503 $object->fetch($fromid);
504 $object->id = 0;
505 $object->statut = 0;
506
507 // Clear fields
508 // ...
509
510 // Create clone
511 $object->context['createfromclone'] = 'createfromclone';
512 $result = $object->create($user);
513
514 // Other options
515 if ($result < 0) {
516 $this->error = $object->error;
517 $error++;
518 }
519
520 unset($object->context['createfromclone']);
521
522 // End
523 if (!$error) {
524 $this->db->commit();
525 return $object->id;
526 } else {
527 $this->db->rollback();
528 return -1;
529 }
530 }
531
532
540 public function initAsSpecimen()
541 {
542 $this->id = 0;
543 $this->fk_charge = 0;
544 $this->datec = dol_now();
545 $this->tms = dol_now();
546 $this->datep = dol_now();
547 $this->amount = 100;
548 $this->fk_typepaiement = 0;
549 $this->num_payment = 'ABC123';
550 $this->note_private = '';
551 $this->note_public = '';
552 $this->fk_bank = 0;
553 $this->fk_user_creat = 0;
554 $this->fk_user_modif = 0;
555
556 return 1;
557 }
558
559
572 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
573 {
574 global $conf, $langs;
575
576 // Clean data
577 $this->num_payment = trim($this->num_payment);
578
579 $error = 0;
580
581 if (isModEnabled("bank")) {
582 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
583
584 $acc = new Account($this->db);
585 $acc->fetch($accountid);
586
587 $total = $this->amount;
588 if ($mode == 'payment_sc') {
589 $total = -$total;
590 }
591
592 // Insert payment into llx_bank
593 $bank_line_id = $acc->addline(
594 $this->datepaye,
595 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
596 $label,
597 $total,
598 $this->num_payment,
599 0,
600 $user,
601 $emetteur_nom,
602 $emetteur_banque
603 );
604
605 // Mise a jour fk_bank dans llx_paiement.
606 // On connait ainsi le paiement qui a genere l'ecriture bancaire
607 if ($bank_line_id > 0) {
608 $result = $this->update_fk_bank($bank_line_id);
609 if ($result <= 0) {
610 $error++;
611 }
612
613 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
614 $url = '';
615 if ($mode == 'payment_sc') {
616 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
617 }
618 if ($url) {
619 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
620 if ($result <= 0) {
621 $error++;
622 $this->setErrorsFromObject($acc);
623 }
624 }
625
626 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
627 $linkaddedforthirdparty = array();
628 foreach ($this->amounts as $key => $value) {
629 if ($mode == 'payment_sc') {
630 $socialcontrib = new ChargeSociales($this->db);
631 $socialcontrib->fetch($key);
632 $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');
633 if ($result <= 0) {
634 $this->setErrorsFromObject($acc);
635 $error++;
636 }
637
638 if ($socialcontrib->fk_user) {
639 $fuser = new User($this->db);
640 $fuser->fetch($socialcontrib->fk_user);
641
642 // Add link 'user' in bank_url between operation and bank transaction
643 $result = $acc->add_url_line(
644 $bank_line_id,
645 $socialcontrib->fk_user,
646 DOL_URL_ROOT.'/user/card.php?id=',
647 $fuser->getFullName($langs),
648 'user'
649 );
650
651 if ($result <= 0) {
652 $this->setErrorsFromObject($acc);
653 $error++;
654 }
655 }
656 }
657 }
658 } else {
659 $this->setErrorsFromObject($acc);
660 $error++;
661 }
662 }
663
664 if (!$error) {
665 return 1;
666 } else {
667 return -1;
668 }
669 }
670
671
672 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
679 public function update_fk_bank($id_bank)
680 {
681 // phpcs:enable
682 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
683
684 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
685 $result = $this->db->query($sql);
686 if ($result) {
687 return 1;
688 } else {
689 $this->error = $this->db->error();
690 return 0;
691 }
692 }
693
694
701 public function getLibStatut($mode = 0)
702 {
703 return $this->LibStatut($this->statut, $mode);
704 }
705
706 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
714 public function LibStatut($status, $mode = 0)
715 {
716 // phpcs:enable
717 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
718
719 $langs->load('compta');
720 /*if ($mode == 0)
721 {
722 if ($status == 0) return $langs->trans('ToValidate');
723 if ($status == 1) return $langs->trans('Validated');
724 }
725 if ($mode == 1)
726 {
727 if ($status == 0) return $langs->trans('ToValidate');
728 if ($status == 1) return $langs->trans('Validated');
729 }
730 if ($mode == 2)
731 {
732 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
733 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
734 }
735 if ($mode == 3)
736 {
737 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
738 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
739 }
740 if ($mode == 4)
741 {
742 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
743 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
744 }
745 if ($mode == 5)
746 {
747 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
748 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
749 }
750 if ($mode == 6)
751 {
752 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
753 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
754 }*/
755 return '';
756 }
757
765 public function getNomUrl($withpicto = 0, $maxlen = 0)
766 {
767 global $langs;
768
769 $result = '';
770
771 if (empty($this->ref)) {
772 $this->ref = $this->label;
773 }
774
775 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
776 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
777 if (!empty($this->label)) {
778 $labeltoshow = $this->label;
779 $reg = array();
780 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
781 // Label generique car entre parentheses. On l'affiche en le traduisant
782 if ($reg[1] == 'paiement') {
783 $reg[1] = 'Payment';
784 }
785 $labeltoshow = $langs->trans($reg[1]);
786 }
787 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
788 }
789 if ($this->datep) {
790 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
791 }
792
793 if (!empty($this->id)) {
794 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
795 $linkend = '</a>';
796
797 if ($withpicto) {
798 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
799 }
800 if ($withpicto && $withpicto != 2) {
801 $result .= ' ';
802 }
803 if ($withpicto != 2) {
804 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
805 }
806 }
807
808 return $result;
809 }
810
811
818 public function getVentilExportCompta($mode = 0)
819 {
820 $alreadydispatched = 0;
821
822 $type = 'bank';
823
824 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
825 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
826 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
827
828 $resql = $this->db->query($sql);
829 if ($resql) {
830 $obj = $this->db->fetch_object($resql);
831 if ($obj) {
832 $alreadydispatched = $obj->nb;
833 }
834 } else {
835 $this->error = $this->db->lasterror();
836 return -1;
837 }
838
839 if ($alreadydispatched) {
840 return $alreadydispatched;
841 }
842 return 0;
843 }
844}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
$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
call_trigger($triggerName, $user)
Call trigger based on this instance.
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.
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_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_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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79