dolibarr 25.0.0-alpha
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-2026 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 (".((int) $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((string) $this->note)."', ".((int) $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 // Insert amounts / invoices array
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 if (!$error) {
276 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_CREATE', $user);
277 if ($result < 0) {
278 $error++;
279 }
280 }
281
282 if ($totalamount != 0 && !$error) {
283 $this->amount = $totalamount;
284 $this->total = $totalamount; // deprecated
285 $this->db->commit();
286 return $this->id;
287 } else {
288 $this->error = $this->db->error();
289 $this->db->rollback();
290 return -1;
291 }
292 }
293
300 public function fetch($id)
301 {
302 $sql = "SELECT";
303 $sql .= " t.rowid,";
304 $sql .= " t.fk_charge,";
305 $sql .= " t.datec,";
306 $sql .= " t.tms,";
307 $sql .= " t.datep,";
308 $sql .= " t.amount,";
309 $sql .= " t.fk_typepaiement,";
310 $sql .= " t.num_paiement as num_payment,";
311 $sql .= " t.note as note_private,";
312 $sql .= " t.fk_bank,";
313 $sql .= " t.fk_user_creat,";
314 $sql .= " t.fk_user_modif,";
315 $sql .= " pt.code as type_code, pt.libelle as type_label,";
316 $sql .= ' b.fk_account';
317 $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id";
318 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid';
319 $sql .= " WHERE t.rowid = ".((int) $id);
320 // TODO link on entity of tax;
321
322 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
323 $resql = $this->db->query($sql);
324 if ($resql) {
325 if ($this->db->num_rows($resql)) {
326 $obj = $this->db->fetch_object($resql);
327
328 $this->id = $obj->rowid;
329 $this->ref = $obj->rowid;
330
331 $this->fk_charge = $obj->fk_charge;
332 $this->datec = $this->db->jdate($obj->datec);
333 $this->tms = $this->db->jdate($obj->tms);
334 $this->datep = $this->db->jdate($obj->datep);
335 $this->amount = $obj->amount;
336 $this->total = $obj->amount;
337 $this->fk_typepaiement = $obj->fk_typepaiement;
338 $this->num_payment = $obj->num_payment;
339 $this->num_paiement = $obj->num_payment;
340 $this->note_private = $obj->note_private;
341 $this->fk_bank = $obj->fk_bank;
342 $this->fk_user_creat = $obj->fk_user_creat;
343 $this->fk_user_modif = $obj->fk_user_modif;
344
345 $this->type_code = $obj->type_code;
346 $this->type_label = $obj->type_label;
347
348 $this->bank_account = $obj->fk_account;
349 $this->bank_line = $obj->fk_bank;
350 }
351 $this->db->free($resql);
352
353 return 1;
354 } else {
355 $this->error = "Error ".$this->db->lasterror();
356 return -1;
357 }
358 }
359
360
368 public function update($user = null, $notrigger = 0)
369 {
370 global $conf, $langs;
371 $error = 0;
372
373 // Clean parameters
374
375 if (isset($this->fk_charge)) {
376 $this->fk_charge = (int) $this->fk_charge;
377 }
378 if (isset($this->amount)) {
379 $this->amount = (float) $this->amount;
380 }
381 if (isset($this->fk_typepaiement)) {
382 $this->fk_typepaiement = (int) $this->fk_typepaiement;
383 }
384 if (isset($this->num_payment)) {
385 $this->num_payment = trim($this->num_payment);
386 }
387 if (isset($this->note_private)) {
388 $this->note_private = trim($this->note_private);
389 }
390 if (isset($this->fk_bank)) {
391 $this->fk_bank = (int) $this->fk_bank;
392 }
393 if (isset($this->fk_user_creat)) {
394 $this->fk_user_creat = (int) $this->fk_user_creat;
395 }
396 if (isset($this->fk_user_modif)) {
397 $this->fk_user_modif = (int) $this->fk_user_modif;
398 }
399
400
401
402 // Check parameters
403 // Put here code to add control on parameters values
404
405 // Update request
406 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
407 $sql .= " fk_charge=".(isset($this->fk_charge) ? ((int) $this->fk_charge) : "null").",";
408 $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
409 $sql .= " tms=".(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
410 $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
411 $sql .= " amount=".(isset($this->amount) ? price2num($this->amount) : "null").",";
412 $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? ((int) $this->fk_typepaiement) : "null").",";
413 $sql .= " num_paiement=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").",";
414 $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").",";
415 $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").",";
416 $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").",";
417 $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null");
418 $sql .= " WHERE rowid=".((int) $this->id);
419
420 $this->db->begin();
421
422 dol_syslog(get_class($this)."::update", LOG_DEBUG);
423 $resql = $this->db->query($sql);
424 if (!$resql) {
425 $error++;
426 $this->errors[] = "Error ".$this->db->lasterror();
427 }
428
429 if (!$error && $user && !$notrigger) {
430 // Call trigger
431 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_MODIFY', $user);
432 if ($result < 0) {
433 $error++;
434 }
435 // End call triggers
436 }
437
438 // Commit or rollback
439 if ($error) {
440 foreach ($this->errors as $errmsg) {
441 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
442 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
443 }
444 $this->db->rollback();
445 return -1 * $error;
446 } else {
447 $this->db->commit();
448 return 1;
449 }
450 }
451
452
460 public function delete($user, $notrigger = 0)
461 {
462 $error = 0;
463
464 dol_syslog(get_class($this)."::delete");
465
466 $this->db->begin();
467
468 if ($this->bank_line > 0) {
469 $accline = new AccountLine($this->db);
470 $accline->fetch($this->bank_line);
471 $result = $accline->delete($user);
472 if ($result < 0) {
473 $this->errors[] = $accline->error;
474 $error++;
475 }
476 }
477
478 if (!$error) {
479 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
480 $sql .= " WHERE rowid=".((int) $this->id);
481
482 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
483 $resql = $this->db->query($sql);
484 if (!$resql) {
485 $error++;
486 $this->errors[] = "Error ".$this->db->lasterror();
487 }
488 }
489
490 if (!$error && !$notrigger) {
491 // Call trigger
492 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_DELETE', $user);
493 if ($result < 0) {
494 $error++;
495 }
496 // End call triggers
497 }
498
499 // Commit or rollback
500 if ($error) {
501 foreach ($this->errors as $errmsg) {
502 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
503 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
504 }
505 $this->db->rollback();
506 return -1 * $error;
507 } else {
508 $this->db->commit();
509 return 1;
510 }
511 }
512
513
514
522 public function createFromClone(User $user, $fromid)
523 {
524 $error = 0;
525
526 $object = new PaymentSocialContribution($this->db);
527
528 $this->db->begin();
529
530 // Load source object
531 $object->fetch($fromid);
532 $object->id = 0;
533 $object->statut = 0;
534 $object->status = 0;
535
536 // Clear fields
537 // ...
538
539 // Create clone
540 $object->context['createfromclone'] = 'createfromclone';
541 $result = $object->create($user);
542
543 // Other options
544 if ($result < 0) {
546 $error++;
547 }
548
549 unset($object->context['createfromclone']);
550
551 // End
552 if (!$error) {
553 $this->db->commit();
554 return $object->id;
555 } else {
556 $this->db->rollback();
557 return -1;
558 }
559 }
560
561
569 public function initAsSpecimen()
570 {
571 $this->id = 0;
572 $this->fk_charge = 0;
573 $this->datec = dol_now();
574 $this->tms = dol_now();
575 $this->datep = dol_now();
576 $this->amount = 100;
577 $this->fk_typepaiement = 0;
578 $this->num_payment = 'ABC123';
579 $this->note_private = '';
580 $this->note_public = '';
581 $this->fk_bank = 0;
582 $this->fk_user_creat = 0;
583 $this->fk_user_modif = 0;
584
585 return 1;
586 }
587
588
601 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
602 {
603 global $conf, $langs;
604
605 // Clean data
606 $this->num_payment = trim($this->num_payment);
607
608 $error = 0;
609
610 if (isModEnabled("bank")) {
611 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
612
613 $acc = new Account($this->db);
614 $acc->fetch($accountid);
615
616 $total = $this->amount;
617 if ($mode == 'payment_sc') {
618 $total = -$total;
619 }
620
621 // Insert payment into llx_bank
622 $bank_line_id = $acc->addline(
623 $this->datepaye,
624 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
625 $label,
626 $total,
627 $this->num_payment,
628 0,
629 $user,
630 $emetteur_nom,
631 $emetteur_banque
632 );
633
634 // Update fk_bank in llx_paiement.
635 // This way we know the payment that generated the bank entry
636 if ($bank_line_id > 0) {
637 $result = $this->update_fk_bank($bank_line_id);
638 if ($result <= 0) {
639 $error++;
640 }
641
642 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
643 $url = '';
644 if ($mode == 'payment_sc') {
645 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
646 }
647 if ($url) {
648 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
649 if ($result <= 0) {
650 $error++;
651 $this->setErrorsFromObject($acc);
652 }
653 }
654
655 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
656 $linkaddedforthirdparty = array();
657 foreach ($this->amounts as $key => $value) {
658 if ($mode == 'payment_sc') {
659 $socialcontrib = new ChargeSociales($this->db);
660 $socialcontrib->fetch($key);
661 $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');
662 if ($result <= 0) {
663 $this->setErrorsFromObject($acc);
664 $error++;
665 }
666
667 if ($socialcontrib->fk_user) {
668 $fuser = new User($this->db);
669 $fuser->fetch($socialcontrib->fk_user);
670
671 // Add link 'user' in bank_url between operation and bank transaction
672 $result = $acc->add_url_line(
673 $bank_line_id,
674 $socialcontrib->fk_user,
675 DOL_URL_ROOT.'/user/card.php?id=',
676 $fuser->getFullName($langs),
677 'user'
678 );
679
680 if ($result <= 0) {
681 $this->setErrorsFromObject($acc);
682 $error++;
683 }
684 }
685 }
686 }
687 } else {
688 $this->setErrorsFromObject($acc);
689 $error++;
690 }
691 }
692
693 if (!$error) {
694 return 1;
695 } else {
696 return -1;
697 }
698 }
699
700
701 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
708 public function update_fk_bank($id_bank)
709 {
710 // phpcs:enable
711 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
712
713 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
714 $result = $this->db->query($sql);
715 if ($result) {
716 return 1;
717 } else {
718 $this->error = $this->db->error();
719 return 0;
720 }
721 }
722
723
730 public function getLibStatut($mode = 0)
731 {
732 return $this->LibStatut($this->statut, $mode);
733 }
734
735 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
743 public function LibStatut($status, $mode = 0)
744 {
745 // phpcs:enable
746 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
747
748 $langs->load('compta');
749 /*if ($mode == 0)
750 {
751 if ($status == 0) return $langs->trans('ToValidate');
752 if ($status == 1) return $langs->trans('Validated');
753 }
754 if ($mode == 1)
755 {
756 if ($status == 0) return $langs->trans('ToValidate');
757 if ($status == 1) return $langs->trans('Validated');
758 }
759 if ($mode == 2)
760 {
761 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
762 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
763 }
764 if ($mode == 3)
765 {
766 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
767 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
768 }
769 if ($mode == 4)
770 {
771 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
772 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
773 }
774 if ($mode == 5)
775 {
776 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
777 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
778 }
779 if ($mode == 6)
780 {
781 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
782 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
783 }*/
784 return '';
785 }
786
794 public function getNomUrl($withpicto = 0, $maxlen = 0)
795 {
796 global $langs;
797
798 $result = '';
799
800 if (empty($this->ref)) {
801 $this->ref = $this->label;
802 }
803
804 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
805 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
806 if (!empty($this->label)) {
807 $labeltoshow = $this->label;
808 $reg = array();
809 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
810 // Generic label because it is in parentheses. We display it translated.
811 if ($reg[1] == 'paiement') {
812 $reg[1] = 'Payment';
813 }
814 $labeltoshow = $langs->trans($reg[1]);
815 }
816 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
817 }
818 if ($this->datep) {
819 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
820 }
821
822 if (!empty($this->id)) {
823 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
824 $linkend = '</a>';
825
826 if ($withpicto) {
827 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
828 }
829 if ($withpicto && $withpicto != 2) {
830 $result .= ' ';
831 }
832 if ($withpicto != 2) {
833 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
834 }
835 }
836
837 global $action, $hookmanager;
838 $hookmanager->initHooks(array($this->element . 'dao'));
839 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
840 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
841 if ($reshook > 0) {
842 $result = $hookmanager->resPrint;
843 } else {
844 $result .= $hookmanager->resPrint;
845 }
846
847 return $result;
848 }
849
850
857 public function getVentilExportCompta($mode = 0)
858 {
859 $alreadydispatched = 0;
860
861 $type = 'bank';
862
863 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
864 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
865 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
866
867 $resql = $this->db->query($sql);
868 if ($resql) {
869 $obj = $this->db->fetch_object($resql);
870 if ($obj) {
871 $alreadydispatched = $obj->nb;
872 }
873 } else {
874 $this->error = $this->db->lasterror();
875 return -1;
876 }
877
878 if ($alreadydispatched) {
879 return $alreadydispatched;
880 }
881 return 0;
882 }
883}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$object ref
Definition info.php:90
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
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.
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
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)
Definition html.lib.php:183
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:494