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($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 $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 if (!$error && $user && !$notrigger) {
428 // Call trigger
429 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_MODIFY', $user);
430 if ($result < 0) {
431 $error++;
432 }
433 // End call triggers
434 }
435
436 // Commit or rollback
437 if ($error) {
438 foreach ($this->errors as $errmsg) {
439 dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
440 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
441 }
442 $this->db->rollback();
443 return -1 * $error;
444 } else {
445 $this->db->commit();
446 return 1;
447 }
448 }
449
450
458 public function delete($user, $notrigger = 0)
459 {
460 $error = 0;
461
462 dol_syslog(get_class($this)."::delete");
463
464 $this->db->begin();
465
466 if ($this->bank_line > 0) {
467 $accline = new AccountLine($this->db);
468 $accline->fetch($this->bank_line);
469 $result = $accline->delete($user);
470 if ($result < 0) {
471 $this->errors[] = $accline->error;
472 $error++;
473 }
474 }
475
476 if (!$error) {
477 $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge";
478 $sql .= " WHERE rowid=".((int) $this->id);
479
480 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
481 $resql = $this->db->query($sql);
482 if (!$resql) {
483 $error++;
484 $this->errors[] = "Error ".$this->db->lasterror();
485 }
486 }
487
488 if (!$error && !$notrigger) {
489 // Call trigger
490 $result = $this->call_trigger('PAYMENTSOCIALCONTRIBUTION_DELETE', $user);
491 if ($result < 0) {
492 $error++;
493 }
494 // End call triggers
495 }
496
497 // Commit or rollback
498 if ($error) {
499 foreach ($this->errors as $errmsg) {
500 dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
501 $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
502 }
503 $this->db->rollback();
504 return -1 * $error;
505 } else {
506 $this->db->commit();
507 return 1;
508 }
509 }
510
511
512
520 public function createFromClone(User $user, $fromid)
521 {
522 $error = 0;
523
524 $object = new PaymentSocialContribution($this->db);
525
526 $this->db->begin();
527
528 // Load source object
529 $object->fetch($fromid);
530 $object->id = 0;
531 $object->statut = 0;
532 $object->status = 0;
533
534 // Clear fields
535 // ...
536
537 // Create clone
538 $object->context['createfromclone'] = 'createfromclone';
539 $result = $object->create($user);
540
541 // Other options
542 if ($result < 0) {
544 $error++;
545 }
546
547 unset($object->context['createfromclone']);
548
549 // End
550 if (!$error) {
551 $this->db->commit();
552 return $object->id;
553 } else {
554 $this->db->rollback();
555 return -1;
556 }
557 }
558
559
567 public function initAsSpecimen()
568 {
569 $this->id = 0;
570 $this->fk_charge = 0;
571 $this->datec = dol_now();
572 $this->tms = dol_now();
573 $this->datep = dol_now();
574 $this->amount = 100;
575 $this->fk_typepaiement = 0;
576 $this->num_payment = 'ABC123';
577 $this->note_private = '';
578 $this->note_public = '';
579 $this->fk_bank = 0;
580 $this->fk_user_creat = 0;
581 $this->fk_user_modif = 0;
582
583 return 1;
584 }
585
586
599 public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque)
600 {
601 global $conf, $langs;
602
603 // Clean data
604 $this->num_payment = trim($this->num_payment);
605
606 $error = 0;
607
608 if (isModEnabled("bank")) {
609 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
610
611 $acc = new Account($this->db);
612 $acc->fetch($accountid);
613
614 $total = $this->amount;
615 if ($mode == 'payment_sc') {
616 $total = -$total;
617 }
618
619 // Insert payment into llx_bank
620 $bank_line_id = $acc->addline(
621 $this->datepaye,
622 $this->paiementtype, // Payment mode id or code ("CHQ or VIR for example")
623 $label,
624 $total,
625 $this->num_payment,
626 0,
627 $user,
628 $emetteur_nom,
629 $emetteur_banque
630 );
631
632 // Update fk_bank in llx_paiement.
633 // This way we know the payment that generated the bank entry
634 if ($bank_line_id > 0) {
635 $result = $this->update_fk_bank($bank_line_id);
636 if ($result <= 0) {
637 $error++;
638 }
639
640 // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
641 $url = '';
642 if ($mode == 'payment_sc') {
643 $url = DOL_URL_ROOT.'/compta/payment_sc/card.php?id=';
644 }
645 if ($url) {
646 $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
647 if ($result <= 0) {
648 $error++;
649 $this->setErrorsFromObject($acc);
650 }
651 }
652
653 // Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
654 $linkaddedforthirdparty = array();
655 foreach ($this->amounts as $key => $value) {
656 if ($mode == 'payment_sc') {
657 $socialcontrib = new ChargeSociales($this->db);
658 $socialcontrib->fetch($key);
659 $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');
660 if ($result <= 0) {
661 $this->setErrorsFromObject($acc);
662 $error++;
663 }
664
665 if ($socialcontrib->fk_user) {
666 $fuser = new User($this->db);
667 $fuser->fetch($socialcontrib->fk_user);
668
669 // Add link 'user' in bank_url between operation and bank transaction
670 $result = $acc->add_url_line(
671 $bank_line_id,
672 $socialcontrib->fk_user,
673 DOL_URL_ROOT.'/user/card.php?id=',
674 $fuser->getFullName($langs),
675 'user'
676 );
677
678 if ($result <= 0) {
679 $this->setErrorsFromObject($acc);
680 $error++;
681 }
682 }
683 }
684 }
685 } else {
686 $this->setErrorsFromObject($acc);
687 $error++;
688 }
689 }
690
691 if (!$error) {
692 return 1;
693 } else {
694 return -1;
695 }
696 }
697
698
699 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
706 public function update_fk_bank($id_bank)
707 {
708 // phpcs:enable
709 $sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
710
711 dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
712 $result = $this->db->query($sql);
713 if ($result) {
714 return 1;
715 } else {
716 $this->error = $this->db->error();
717 return 0;
718 }
719 }
720
721
728 public function getLibStatut($mode = 0)
729 {
730 return $this->LibStatut($this->statut, $mode);
731 }
732
733 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
741 public function LibStatut($status, $mode = 0)
742 {
743 // phpcs:enable
744 global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage
745
746 $langs->load('compta');
747 /*if ($mode == 0)
748 {
749 if ($status == 0) return $langs->trans('ToValidate');
750 if ($status == 1) return $langs->trans('Validated');
751 }
752 if ($mode == 1)
753 {
754 if ($status == 0) return $langs->trans('ToValidate');
755 if ($status == 1) return $langs->trans('Validated');
756 }
757 if ($mode == 2)
758 {
759 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
760 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
761 }
762 if ($mode == 3)
763 {
764 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
765 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
766 }
767 if ($mode == 4)
768 {
769 if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
770 if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
771 }
772 if ($mode == 5)
773 {
774 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
775 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
776 }
777 if ($mode == 6)
778 {
779 if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
780 if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
781 }*/
782 return '';
783 }
784
792 public function getNomUrl($withpicto = 0, $maxlen = 0)
793 {
794 global $langs;
795
796 $result = '';
797
798 if (empty($this->ref)) {
799 $this->ref = $this->label;
800 }
801
802 $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
803 $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
804 if (!empty($this->label)) {
805 $labeltoshow = $this->label;
806 $reg = array();
807 if (preg_match('/^\‍((.*)\‍)$/i', $this->label, $reg)) {
808 // Generic label because it is in parentheses. We display it translated.
809 if ($reg[1] == 'paiement') {
810 $reg[1] = 'Payment';
811 }
812 $labeltoshow = $langs->trans($reg[1]);
813 }
814 $label .= '<br><b>'.$langs->trans('Label').':</b> '.$labeltoshow;
815 }
816 if ($this->datep) {
817 $label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->datep, 'day');
818 }
819
820 if (!empty($this->id)) {
821 $link = '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
822 $linkend = '</a>';
823
824 if ($withpicto) {
825 $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend.' ');
826 }
827 if ($withpicto && $withpicto != 2) {
828 $result .= ' ';
829 }
830 if ($withpicto != 2) {
831 $result .= $link.($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
832 }
833 }
834
835 global $action, $hookmanager;
836 $hookmanager->initHooks(array($this->element . 'dao'));
837 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
838 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
839 if ($reshook > 0) {
840 $result = $hookmanager->resPrint;
841 } else {
842 $result .= $hookmanager->resPrint;
843 }
844
845 return $result;
846 }
847
848
855 public function getVentilExportCompta($mode = 0)
856 {
857 $alreadydispatched = 0;
858
859 $type = 'bank';
860
861 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
862 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
863 $sql .= " WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->bank_line);
864
865 $resql = $this->db->query($sql);
866 if ($resql) {
867 $obj = $this->db->fetch_object($resql);
868 if ($obj) {
869 $alreadydispatched = $obj->nb;
870 }
871 } else {
872 $this->error = $this->db->lasterror();
873 return -1;
874 }
875
876 if ($alreadydispatched) {
877 return $alreadydispatched;
878 }
879 return 0;
880 }
881}
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.
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:
dol_now($mode='gmt')
Return date for now.
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)
Definition html.lib.php:181
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