dolibarr 25.0.0-alpha
paymentvarious.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
3 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2026 Solution Libre SAS <contact@solution-libre.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Put here all includes required by your class file
28require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
29
30
35{
39 public $element = 'payment_various';
40
44 public $table_element = 'payment_various';
45
49 public $picto = 'payment';
50
54 public $id;
55
59 public $ref;
60
64 public $datep;
65
69 public $datev;
70
74 public $sens;
75
79 public $amount;
80
84 public $type_payment;
85
90 public $num_payment;
91
95 public $chqemetteur;
96
100 public $chqbank;
101
105 public $category_transaction;
106
110 public $label;
111
115 public $accountancy_code;
116
120 public $subledger_account;
121
125 public $fk_project;
126
130 public $fk_soc;
131
135 public $fk_account;
136
141 public $accountid;
142
146 public $fk_bank;
147
151 public $socid;
152
156 public $categorie_transaction;
157
161 public $fk_user_author;
162
166 public $fk_user_modif;
167
168
172 public $fk_type;
173
177 public $rappro;
178
182 public $bank_num_releve;
183
184
210 // BEGIN MODULEBUILDER PROPERTIES
214 public $fields = array(
215 // TODO: fill this array
216 );
217 // END MODULEBUILDER PROPERTIES
218
222 const STATUS_DRAFT = 0;
223
224
230 public function __construct(DoliDB $db)
231 {
232 $this->db = $db;
233 }
234
242 public function update($user = null, $notrigger = 0)
243 {
244 global $conf, $langs;
245
246 $error = 0;
247
248 // Clean parameters
249 $this->amount = (float) price2num($this->amount);
250 $this->label = trim($this->label);
251 $this->note = trim($this->note);
252 $this->fk_bank = (int) $this->fk_bank;
253 $this->fk_user_author = (int) $this->fk_user_author;
254 $this->fk_user_modif = (int) $this->fk_user_modif;
255
256 $this->db->begin();
257
258 // Update request
259 $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
260 if ($this->tms) {
261 $sql .= " tms='".$this->db->idate($this->tms)."',";
262 }
263 $sql .= " datep='".$this->db->idate($this->datep)."',";
264 $sql .= " datev='".$this->db->idate($this->datev)."',";
265 $sql .= " sens=".(int) $this->sens.",";
266 $sql .= " amount=".price2num($this->amount).",";
267 $sql .= " fk_typepayment=".(int) $this->type_payment.",";
268 $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
269 $sql .= " label='".$this->db->escape($this->label)."',";
270 $sql .= " note='".$this->db->escape($this->note)."',";
271 $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
272 $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
273 $sql .= " fk_projet='".$this->db->escape((string) $this->fk_project)."',";
274 $sql .= " fk_soc=".($this->fk_soc > 0 ? ((int) $this->fk_soc) : "null").",";
275 $sql .= " fk_bank=".($this->fk_bank > 0 ? ((int) $this->fk_bank) : "null").",";
276 $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
277 $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
278 $sql .= " WHERE rowid=".((int) $this->id);
279
280 dol_syslog(get_class($this)."::update", LOG_DEBUG);
281 $resql = $this->db->query($sql);
282 if (!$resql) {
283 $this->error = "Error ".$this->db->lasterror();
284 return -1;
285 }
286
287 // Actions on extra fields
288 $result = $this->insertExtraFields();
289 if ($result < 0) {
290 $error++;
291 }
292
293 if (!$error && !$notrigger) {
294 // Call trigger
295 $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
296 if ($result < 0) {
297 $error++;
298 }
299 // End call triggers
300 }
301
302 if (!$error) {
303 $this->db->commit();
304 return 1;
305 } else {
306 $this->db->rollback();
307 return -1;
308 }
309 }
310
311
319 public function fetch($id, $user = null)
320 {
321 $sql = "SELECT";
322 $sql .= " v.rowid,";
323 $sql .= " v.tms,";
324 $sql .= " v.datep,";
325 $sql .= " v.datev,";
326 $sql .= " v.sens,";
327 $sql .= " v.amount,";
328 $sql .= " v.fk_typepayment,";
329 $sql .= " v.num_payment,";
330 $sql .= " v.label,";
331 $sql .= " v.note as note_private,";
332 $sql .= " v.accountancy_code,";
333 $sql .= " v.subledger_account,";
334 $sql .= " v.fk_projet as fk_project,";
335 $sql .= " v.fk_soc,";
336 $sql .= " v.fk_bank,";
337 $sql .= " v.fk_user_author,";
338 $sql .= " v.fk_user_modif,";
339 $sql .= " b.fk_account,";
340 $sql .= " b.fk_type,";
341 $sql .= " b.rappro,";
342 $sql .= " b.num_releve as bank_num_releve";
343 $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
344 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
345 $sql .= " WHERE v.rowid = ".((int) $id);
346
347 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
348 $resql = $this->db->query($sql);
349 if ($resql) {
350 if ($this->db->num_rows($resql)) {
351 $obj = $this->db->fetch_object($resql);
352
353 $this->id = $obj->rowid;
354 $this->ref = $obj->rowid;
355 $this->tms = $this->db->jdate($obj->tms);
356 $this->datep = $this->db->jdate($obj->datep);
357 $this->datev = $this->db->jdate($obj->datev);
358 $this->sens = $obj->sens;
359 $this->amount = $obj->amount;
360 $this->type_payment = $obj->fk_typepayment;
361 $this->num_payment = $obj->num_payment;
362 $this->label = $obj->label;
363 $this->note = $obj->note_private; // For backward compatibility
364 $this->note_private = $obj->note_private;
365 $this->subledger_account = $obj->subledger_account;
366 $this->accountancy_code = $obj->accountancy_code;
367 $this->fk_project = $obj->fk_project;
368 $this->fk_soc = $obj->fk_soc;
369 $this->socid = $obj->fk_soc;
370 $this->fk_bank = $obj->fk_bank;
371 $this->fk_user_author = $obj->fk_user_author;
372 $this->fk_user_modif = $obj->fk_user_modif;
373 $this->fk_account = $obj->fk_account;
374 $this->fk_type = $obj->fk_type;
375 $this->rappro = $obj->rappro;
376 $this->bank_num_releve = $obj->bank_num_releve;
377 }
378
379 // Fetch extrafields
380 $this->fetch_optionals();
381
382 $this->db->free($resql);
383
384 return 1;
385 } else {
386 $this->error = "Error ".$this->db->lasterror();
387 return -1;
388 }
389 }
390
391
398 public function delete($user)
399 {
400 global $conf, $langs;
401
402 $error = 0;
403
404 // Call trigger
405 $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
406 if ($result < 0) {
407 return -1;
408 }
409 // End call triggers
410
411
412 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
413 $sql .= " WHERE rowid=".((int) $this->id);
414
415 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
416 $resql = $this->db->query($sql);
417 if (!$resql) {
418 $this->error = "Error ".$this->db->lasterror();
419 return -1;
420 }
421
422 // Delete attached documents directory
423 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
424 $dir = $conf->bank->dir_output.'/various_payment/'.((int) $this->id);
425 if (file_exists($dir)) {
427 }
428
429 return 1;
430 }
431
432
440 public function initAsSpecimen()
441 {
442 $this->id = 0;
443 $this->tms = dol_now();
444 $this->datep = dol_now();
445 $this->datev = dol_now();
446 $this->sens = 0;
447 $this->amount = 100;
448 $this->label = 'Specimen payment';
449 $this->accountancy_code = '';
450 $this->subledger_account = '';
451 $this->note = '';
452 $this->fk_bank = 0;
453 $this->fk_user_author = 0;
454 $this->fk_user_modif = 0;
455
456 return 1;
457 }
458
464 public function check()
465 {
466 $newamount = price2num($this->amount, 'MT');
467
468 // Validation of parameters
469 if (!($newamount) > 0 || empty($this->datep)) {
470 return false;
471 }
472
473 return true;
474 }
475
482 public function create($user)
483 {
484 global $conf, $langs;
485
486 $error = 0;
487 $now = dol_now();
488
489 // Clean parameters
490 $this->amount = (float) price2num($this->amount);
491 $this->label = trim($this->label);
492 $this->note = trim($this->note);
493 $this->fk_bank = (int) $this->fk_bank;
494 $this->fk_user_author = (int) $this->fk_user_author;
495 $this->fk_user_modif = (int) $this->fk_user_modif;
496 $this->fk_account = (int) $this->fk_account;
497 if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
498 $this->fk_account = $this->accountid;
499 }
500
501 // Check parameters
502 if (!$this->label) {
503 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
504 return -3;
505 }
506 if ($this->amount < 0 || $this->amount == '') {
507 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
508 return -5;
509 }
510 if (isModEnabled("bank") && (empty($this->fk_account) || $this->fk_account <= 0)) {
511 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
512 return -6;
513 }
514 if (isModEnabled("bank") && (empty($this->type_payment) || $this->type_payment <= 0)) {
515 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
516 return -7;
517 }
518
519 $this->db->begin();
520
521 // Insert into llx_payment_various
522 $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
523 $sql .= " datep";
524 $sql .= ", datev";
525 $sql .= ", sens";
526 $sql .= ", amount";
527 $sql .= ", fk_typepayment";
528 $sql .= ", num_payment";
529 if ($this->note) {
530 $sql .= ", note";
531 }
532 $sql .= ", label";
533 $sql .= ", accountancy_code";
534 $sql .= ", subledger_account";
535 $sql .= ", fk_projet";
536 $sql .= ", fk_soc";
537 $sql .= ", fk_user_author";
538 $sql .= ", datec";
539 $sql .= ", fk_bank";
540 $sql .= ", entity";
541 $sql .= ")";
542 $sql .= " VALUES (";
543 $sql .= "'".$this->db->idate($this->datep)."'";
544 $sql .= ", '".$this->db->idate($this->datev)."'";
545 $sql .= ", '".$this->db->escape((string) $this->sens)."'";
546 $sql .= ", ".price2num($this->amount);
547 $sql .= ", '".$this->db->escape((string) $this->type_payment)."'";
548 $sql .= ", '".$this->db->escape($this->num_payment)."'";
549 if ($this->note) {
550 $sql .= ", '".$this->db->escape($this->note)."'";
551 }
552 $sql .= ", '".$this->db->escape($this->label)."'";
553 $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
554 $sql .= ", '".$this->db->escape($this->subledger_account)."'";
555 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
556 $sql .= ", ".($this->fk_soc > 0 ? ((int) $this->fk_soc) : "NULL");
557 $sql .= ", ".((int) $user->id);
558 $sql .= ", '".$this->db->idate($now)."'";
559 $sql .= ", NULL"; // Filled later
560 $sql .= ", ".((int) $conf->entity);
561 $sql .= ")";
562
563 dol_syslog(get_class($this)."::create", LOG_DEBUG);
564 $result = $this->db->query($sql);
565 if ($result) {
566 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
567 $this->ref = (string) $this->id;
568
569 if ($this->id > 0) {
570 // Insert extrafields
571 $result = $this->insertExtraFields();
572 if ($result < 0) {
573 $error++;
574 }
575
576 if (isModEnabled("bank") && !empty($this->amount)) {
577 // Insert into llx_bank
578 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
579
580 $acc = new Account($this->db);
581 $result = $acc->fetch($this->fk_account);
582 if ($result <= 0) {
583 dol_print_error($this->db);
584 }
585
586 // Insert payment into llx_bank
587 // Add link 'payment_various' in bank_url between payment and bank transaction
588 $sign = 1;
589 if ($this->sens == '0') {
590 $sign = -1;
591 }
592
593 $bank_line_id = $acc->addline(
594 $this->datep,
595 (string) $this->type_payment,
596 $this->label,
597 $sign * abs($this->amount),
598 $this->num_payment,
599 ($this->category_transaction > 0 ? $this->category_transaction : 0),
600 $user,
601 $this->chqemetteur,
602 $this->chqbank,
603 '',
604 $this->datev
605 );
606
607 // Update fk_bank into llx_payment_various
608 // So we know the payment which has generate the banking transaction
609 if ($bank_line_id > 0) {
610 $this->update_fk_bank($bank_line_id);
611 } else {
612 $this->error = $acc->error;
613 $error++;
614 }
615
616 if (!$error) {
617 // Add link 'payment_various' in bank_url between payment and bank transaction
618 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
619
620 $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
621 if ($result <= 0) {
622 $this->error = $acc->error;
623 $error++;
624 }
625 }
626
627 // Add link 'company' in bank_url between thirdparty and bank transaction
628 if (!$error && getDolGlobalString('BANK_VARIOUS_PAYMENT_USE_THIRDPARTY') && $this->fk_soc > 0) {
629 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
630
631 $thirdparty = new Societe($this->db);
632 if ($thirdparty->fetch($this->fk_soc) > 0) {
633 $result = $acc->add_url_line($bank_line_id, $thirdparty->id, DOL_URL_ROOT.'/societe/card.php?socid=', $thirdparty->name, 'company');
634 if ($result <= 0) {
635 $this->error = $acc->error;
636 $error++;
637 }
638 } else {
639 $this->error = $thirdparty->error;
640 $error++;
641 }
642 }
643
644 if ($result <= 0) {
645 $this->error = $acc->error;
646 $error++;
647 }
648 }
649
650 if (!$error) {
651 // Call trigger
652 $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
653 if ($result < 0) {
654 $error++;
655 }
656 // End call triggers
657 }
658 } else {
659 $error++;
660 }
661
662 if (!$error) {
663 $this->db->commit();
664 return $this->id;
665 } else {
666 $this->db->rollback();
667 return -2;
668 }
669 } else {
670 $this->error = $this->db->error();
671 $this->db->rollback();
672 return -1;
673 }
674 }
675
676 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
683 public function update_fk_bank($id_bank)
684 {
685 // phpcs:enable
686 $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
687 $sql .= " WHERE rowid = ".((int) $this->id);
688 $result = $this->db->query($sql);
689 if ($result) {
690 // Keep the in memory object in sync, so a trigger called right after create() reports
691 // the real bank line instead of 0 (#40673).
692 $this->fk_bank = (int) $id_bank;
693 return 1;
694 } else {
695 dol_print_error($this->db);
696 return -1;
697 }
698 }
699
700
707 public function getLibStatut($mode = 0)
708 {
709 return $this->LibStatut($this->status, $mode);
710 }
711
712 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
720 public function LibStatut($status, $mode = 0)
721 {
722 // phpcs:enable
723 global $langs;
724
725 /*
726 if (empty($status)) {
727 $status = 0;
728 }
729
730 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
731 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
732 //$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
733 //$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
734 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
735 //$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
736 //$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
737 }
738
739 $statusType = 'status'.$status;
740
741 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
742 */
743 return '';
744 }
745
746
757 public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
758 {
759 global $db, $conf, $langs, $hookmanager;
760 global $langs;
761
762 if (!empty($conf->dol_no_mouse_hover)) {
763 $notooltip = 1; // Force disable tooltips
764 }
765
766 $result = '';
767
768 $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
769 $label .= '<br>';
770 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
771
772 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
773
774 if ($option != 'nolink') {
775 // Add param to save lastsearch_values or not
776 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
777 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
778 $add_save_lastsearch_values = 1;
779 }
780 if ($add_save_lastsearch_values) {
781 $url .= '&save_lastsearch_values=1';
782 }
783 }
784
785 $linkclose = '';
786 if (empty($notooltip)) {
787 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
788 $label = $langs->trans("ShowMyObject");
789 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
790 }
791 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
792 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
793 } else {
794 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
795 }
796
797 $linkstart = '<a href="'.$url.'"';
798 $linkstart .= $linkclose.'>';
799 $linkend = '</a>';
800
801 $result .= $linkstart;
802 if ($withpicto) {
803 $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
804 }
805 if ($withpicto != 2) {
806 $result .= $this->ref;
807 }
808 $result .= $linkend;
809 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
810
811 global $action;
812 $hookmanager->initHooks(array('variouspayment'));
813 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
814 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
815 if ($reshook > 0) {
816 $result = $hookmanager->resPrint;
817 } else {
818 $result .= $hookmanager->resPrint;
819 }
820
821 return $result;
822 }
823
830 public function info($id)
831 {
832 $sql = 'SELECT v.rowid, v.datec, v.fk_user_author, fk_user_modif, tms';
833 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
834 $sql .= ' WHERE v.rowid = '.((int) $id);
835
836 dol_syslog(get_class($this).'::info', LOG_DEBUG);
837 $result = $this->db->query($sql);
838
839 if ($result) {
840 if ($this->db->num_rows($result)) {
841 $obj = $this->db->fetch_object($result);
842
843 $this->id = $obj->rowid;
844 $this->user_creation = $obj->fk_user_author;
845 $this->user_creation_id = $obj->fk_user_author;
846 $this->user_modification_id = $obj->fk_user_modif;
847 $this->date_creation = $this->db->jdate($obj->datec);
848 $this->date_modification = $this->db->jdate($obj->tms);
849 }
850 $this->db->free($result);
851 } else {
852 dol_print_error($this->db);
853 }
854 }
855
862 public function getVentilExportCompta($mode = 0)
863 {
864 $banklineid = $this->fk_bank;
865
866 $alreadydispatched = 0;
867
868 $type = 'bank';
869
870 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
871 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
872 $resql = $this->db->query($sql);
873 if ($resql) {
874 $obj = $this->db->fetch_object($resql);
875 if ($obj) {
876 $alreadydispatched = $obj->nb;
877 }
878 } else {
879 $this->error = $this->db->lasterror();
880 return -1;
881 }
882
883 if ($alreadydispatched) {
884 return $alreadydispatched;
885 }
886 return 0;
887 }
888
896 public function getKanbanView($option = '', $arraydata = null)
897 {
898 global $langs;
899
900 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
901 $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']);
902 $formatedaccountancycode = (empty($arraydata['formatedaccountancycode']) ? '' : $arraydata['formatedaccountancycode']);
903
904 $return = '<div class="box-flex-item box-flex-grow-zero">';
905 $return .= '<div class="info-box info-box-sm">';
906 $return .= '<span class="info-box-icon bg-infobox-action">';
907 $return .= img_picto('', $this->picto);
908 $return .= '</span>';
909 $return .= '<div class="info-box-content">';
910 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
911 if ($selected >= 0) {
912 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
913 }
914 if (!empty($bankline) && $bankline instanceof AccountLine) {
915 $return .= ' | <span class="info-box-status ">'.$bankline->getNomUrl(1).'</span>';
916 }
917 if (property_exists($this, 'datep')) {
918 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->datep, 'day').'</span>';
919 if ($this->type_payment) {
920 $return .= ' - <span class="info-box-label">'.$this->type_payment.'</span>';
921 }
922 }
923 if (!empty($formatedaccountancycode)) {
924 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">';
925 $return .= $formatedaccountancycode;
926 $return .= '</span>';
927 } elseif (property_exists($this, 'accountancy_code')) {
928 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
929 }
930
931 if (property_exists($this, 'amount')) {
932 $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
933 }
934 $return .= '</div>';
935 $return .= '</div>';
936 $return .= '</div>';
937 return $return;
938 }
939
946 public function lengthAccountg($account)
947 {
948 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
949
950 /*
951 if (isModEnabled('accounting')) {
952 $accountingaccount = new AccountingAccount($db);
953 $accountingaccount->fetch(0, $valuetoshow, 1);
954 }*/
955
956 return length_accountg($account);
957 }
958
965 public function lengthAccounta($account)
966 {
967 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
968
969 return length_accounta($account);
970 }
971}
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
$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.
fetch_optionals($rowid=null, $optionsArray=null)
Function to get extra fields of an object into $this->array_options This method is in most cases call...
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
Class to manage Dolibarr database access.
Class to manage various payments.
update_fk_bank($id_bank)
Update link between payment various and line generate into llx_bank.
getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0, $morecss='')
Send name clickable (with possibly the picto)
initAsSpecimen()
Initialise an instance with random values.
getVentilExportCompta($mode=0)
Return if a various payment linked to a bank line id was dispatched into bookkeeping.
const STATUS_DRAFT
Draft status.
create($user)
Create in database.
lengthAccountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
LibStatut($status, $mode=0)
Return the label of a given status.
fetch($id, $user=null)
Load object in memory from database.
info($id)
Information on record.
lengthAccounta($account)
Return Auxiliary accounting account of thirdparties with defined length.
check()
Check if a miscellaneous payment can be created into database.
__construct(DoliDB $db)
Constructor.
getLibStatut($mode=0)
Return the label of the status.
update($user=null, $notrigger=0)
Update database.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
Class to manage third parties objects (customers, suppliers, prospects...)
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition index.php:169
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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 '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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