dolibarr 25.0.0-alpha
paymentvarious.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017-2021 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_account;
131
136 public $accountid;
137
141 public $fk_bank;
142
146 public $socid;
147
151 public $categorie_transaction;
152
156 public $fk_user_author;
157
161 public $fk_user_modif;
162
163
167 public $fk_type;
168
172 public $rappro;
173
177 public $bank_num_releve;
178
179
205 // BEGIN MODULEBUILDER PROPERTIES
209 public $fields = array(
210 // TODO: fill this array
211 );
212 // END MODULEBUILDER PROPERTIES
213
217 const STATUS_DRAFT = 0;
218
219
225 public function __construct(DoliDB $db)
226 {
227 $this->db = $db;
228 }
229
237 public function update($user = null, $notrigger = 0)
238 {
239 global $conf, $langs;
240
241 $error = 0;
242
243 // Clean parameters
244 $this->amount = (float) price2num($this->amount);
245 $this->label = trim($this->label);
246 $this->note = trim($this->note);
247 $this->fk_bank = (int) $this->fk_bank;
248 $this->fk_user_author = (int) $this->fk_user_author;
249 $this->fk_user_modif = (int) $this->fk_user_modif;
250
251 $this->db->begin();
252
253 // Update request
254 $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
255 if ($this->tms) {
256 $sql .= " tms='".$this->db->idate($this->tms)."',";
257 }
258 $sql .= " datep='".$this->db->idate($this->datep)."',";
259 $sql .= " datev='".$this->db->idate($this->datev)."',";
260 $sql .= " sens=".(int) $this->sens.",";
261 $sql .= " amount=".price2num($this->amount).",";
262 $sql .= " fk_typepayment=".(int) $this->type_payment.",";
263 $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
264 $sql .= " label='".$this->db->escape($this->label)."',";
265 $sql .= " note='".$this->db->escape($this->note)."',";
266 $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
267 $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
268 $sql .= " fk_projet='".$this->db->escape((string) $this->fk_project)."',";
269 $sql .= " fk_bank=".($this->fk_bank > 0 ? ((int) $this->fk_bank) : "null").",";
270 $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
271 $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
272 $sql .= " WHERE rowid=".((int) $this->id);
273
274 dol_syslog(get_class($this)."::update", LOG_DEBUG);
275 $resql = $this->db->query($sql);
276 if (!$resql) {
277 $this->error = "Error ".$this->db->lasterror();
278 return -1;
279 }
280
281 // Actions on extra fields
282 $result = $this->insertExtraFields();
283 if ($result < 0) {
284 $error++;
285 }
286
287 if (!$error && !$notrigger) {
288 // Call trigger
289 $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
290 if ($result < 0) {
291 $error++;
292 }
293 // End call triggers
294 }
295
296 if (!$error) {
297 $this->db->commit();
298 return 1;
299 } else {
300 $this->db->rollback();
301 return -1;
302 }
303 }
304
305
313 public function fetch($id, $user = null)
314 {
315 $sql = "SELECT";
316 $sql .= " v.rowid,";
317 $sql .= " v.tms,";
318 $sql .= " v.datep,";
319 $sql .= " v.datev,";
320 $sql .= " v.sens,";
321 $sql .= " v.amount,";
322 $sql .= " v.fk_typepayment,";
323 $sql .= " v.num_payment,";
324 $sql .= " v.label,";
325 $sql .= " v.note as note_private,";
326 $sql .= " v.accountancy_code,";
327 $sql .= " v.subledger_account,";
328 $sql .= " v.fk_projet as fk_project,";
329 $sql .= " v.fk_bank,";
330 $sql .= " v.fk_user_author,";
331 $sql .= " v.fk_user_modif,";
332 $sql .= " b.fk_account,";
333 $sql .= " b.fk_type,";
334 $sql .= " b.rappro,";
335 $sql .= " b.num_releve as bank_num_releve";
336 $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
337 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
338 $sql .= " WHERE v.rowid = ".((int) $id);
339
340 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
341 $resql = $this->db->query($sql);
342 if ($resql) {
343 if ($this->db->num_rows($resql)) {
344 $obj = $this->db->fetch_object($resql);
345
346 $this->id = $obj->rowid;
347 $this->ref = $obj->rowid;
348 $this->tms = $this->db->jdate($obj->tms);
349 $this->datep = $this->db->jdate($obj->datep);
350 $this->datev = $this->db->jdate($obj->datev);
351 $this->sens = $obj->sens;
352 $this->amount = $obj->amount;
353 $this->type_payment = $obj->fk_typepayment;
354 $this->num_payment = $obj->num_payment;
355 $this->label = $obj->label;
356 $this->note = $obj->note_private; // For backward compatibility
357 $this->note_private = $obj->note_private;
358 $this->subledger_account = $obj->subledger_account;
359 $this->accountancy_code = $obj->accountancy_code;
360 $this->fk_project = $obj->fk_project;
361 $this->fk_bank = $obj->fk_bank;
362 $this->fk_user_author = $obj->fk_user_author;
363 $this->fk_user_modif = $obj->fk_user_modif;
364 $this->fk_account = $obj->fk_account;
365 $this->fk_type = $obj->fk_type;
366 $this->rappro = $obj->rappro;
367 $this->bank_num_releve = $obj->bank_num_releve;
368 }
369
370 // Fetch extrafields
371 $this->fetch_optionals();
372
373 $this->db->free($resql);
374
375 return 1;
376 } else {
377 $this->error = "Error ".$this->db->lasterror();
378 return -1;
379 }
380 }
381
382
389 public function delete($user)
390 {
391 global $conf, $langs;
392
393 $error = 0;
394
395 // Call trigger
396 $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
397 if ($result < 0) {
398 return -1;
399 }
400 // End call triggers
401
402
403 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
404 $sql .= " WHERE rowid=".((int) $this->id);
405
406 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
407 $resql = $this->db->query($sql);
408 if (!$resql) {
409 $this->error = "Error ".$this->db->lasterror();
410 return -1;
411 }
412
413 return 1;
414 }
415
416
424 public function initAsSpecimen()
425 {
426 $this->id = 0;
427 $this->tms = dol_now();
428 $this->datep = dol_now();
429 $this->datev = dol_now();
430 $this->sens = 0;
431 $this->amount = 100;
432 $this->label = 'Specimen payment';
433 $this->accountancy_code = '';
434 $this->subledger_account = '';
435 $this->note = '';
436 $this->fk_bank = 0;
437 $this->fk_user_author = 0;
438 $this->fk_user_modif = 0;
439
440 return 1;
441 }
442
448 public function check()
449 {
450 $newamount = price2num($this->amount, 'MT');
451
452 // Validation of parameters
453 if (!($newamount) > 0 || empty($this->datep)) {
454 return false;
455 }
456
457 return true;
458 }
459
466 public function create($user)
467 {
468 global $conf, $langs;
469
470 $error = 0;
471 $now = dol_now();
472
473 // Clean parameters
474 $this->amount = (float) price2num($this->amount);
475 $this->label = trim($this->label);
476 $this->note = trim($this->note);
477 $this->fk_bank = (int) $this->fk_bank;
478 $this->fk_user_author = (int) $this->fk_user_author;
479 $this->fk_user_modif = (int) $this->fk_user_modif;
480 $this->fk_account = (int) $this->fk_account;
481 if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
482 $this->fk_account = $this->accountid;
483 }
484
485 // Check parameters
486 if (!$this->label) {
487 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
488 return -3;
489 }
490 if ($this->amount < 0 || $this->amount == '') {
491 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
492 return -5;
493 }
494 if (isModEnabled("bank") && (empty($this->fk_account) || $this->fk_account <= 0)) {
495 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
496 return -6;
497 }
498 if (isModEnabled("bank") && (empty($this->type_payment) || $this->type_payment <= 0)) {
499 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
500 return -7;
501 }
502
503 $this->db->begin();
504
505 // Insert into llx_payment_various
506 $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
507 $sql .= " datep";
508 $sql .= ", datev";
509 $sql .= ", sens";
510 $sql .= ", amount";
511 $sql .= ", fk_typepayment";
512 $sql .= ", num_payment";
513 if ($this->note) {
514 $sql .= ", note";
515 }
516 $sql .= ", label";
517 $sql .= ", accountancy_code";
518 $sql .= ", subledger_account";
519 $sql .= ", fk_projet";
520 $sql .= ", fk_user_author";
521 $sql .= ", datec";
522 $sql .= ", fk_bank";
523 $sql .= ", entity";
524 $sql .= ")";
525 $sql .= " VALUES (";
526 $sql .= "'".$this->db->idate($this->datep)."'";
527 $sql .= ", '".$this->db->idate($this->datev)."'";
528 $sql .= ", '".$this->db->escape((string) $this->sens)."'";
529 $sql .= ", ".price2num($this->amount);
530 $sql .= ", '".$this->db->escape((string) $this->type_payment)."'";
531 $sql .= ", '".$this->db->escape($this->num_payment)."'";
532 if ($this->note) {
533 $sql .= ", '".$this->db->escape($this->note)."'";
534 }
535 $sql .= ", '".$this->db->escape($this->label)."'";
536 $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
537 $sql .= ", '".$this->db->escape($this->subledger_account)."'";
538 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
539 $sql .= ", ".((int) $user->id);
540 $sql .= ", '".$this->db->idate($now)."'";
541 $sql .= ", NULL"; // Filled later
542 $sql .= ", ".((int) $conf->entity);
543 $sql .= ")";
544
545 dol_syslog(get_class($this)."::create", LOG_DEBUG);
546 $result = $this->db->query($sql);
547 if ($result) {
548 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
549 $this->ref = (string) $this->id;
550
551 if ($this->id > 0) {
552 // Insert extrafields
553 $result = $this->insertExtraFields();
554 if ($result < 0) {
555 $error++;
556 }
557
558 if (isModEnabled("bank") && !empty($this->amount)) {
559 // Insert into llx_bank
560 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
561
562 $acc = new Account($this->db);
563 $result = $acc->fetch($this->fk_account);
564 if ($result <= 0) {
565 dol_print_error($this->db);
566 }
567
568 // Insert payment into llx_bank
569 // Add link 'payment_various' in bank_url between payment and bank transaction
570 $sign = 1;
571 if ($this->sens == '0') {
572 $sign = -1;
573 }
574
575 $bank_line_id = $acc->addline(
576 $this->datep,
577 (string) $this->type_payment,
578 $this->label,
579 $sign * abs($this->amount),
580 $this->num_payment,
581 ($this->category_transaction > 0 ? $this->category_transaction : 0),
582 $user,
583 $this->chqemetteur,
584 $this->chqbank,
585 '',
586 $this->datev
587 );
588
589 // Update fk_bank into llx_payment_various
590 // So we know the payment which has generate the banking transaction
591 if ($bank_line_id > 0) {
592 $this->update_fk_bank($bank_line_id);
593 } else {
594 $this->error = $acc->error;
595 $error++;
596 }
597
598 if (!$error) {
599 // Add link 'payment_various' in bank_url between payment and bank transaction
600 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
601
602 $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
603 if ($result <= 0) {
604 $this->error = $acc->error;
605 $error++;
606 }
607 }
608
609 if ($result <= 0) {
610 $this->error = $acc->error;
611 $error++;
612 }
613 }
614
615 // Call trigger
616 $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
617 if ($result < 0) {
618 $error++;
619 }
620 // End call triggers
621 } else {
622 $error++;
623 }
624
625 if (!$error) {
626 $this->db->commit();
627 return $this->id;
628 } else {
629 $this->db->rollback();
630 return -2;
631 }
632 } else {
633 $this->error = $this->db->error();
634 $this->db->rollback();
635 return -1;
636 }
637 }
638
639 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
646 public function update_fk_bank($id_bank)
647 {
648 // phpcs:enable
649 $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
650 $sql .= " WHERE rowid = ".((int) $this->id);
651 $result = $this->db->query($sql);
652 if ($result) {
653 // Keep the in memory object in sync, so a trigger called right after create() reports
654 // the real bank line instead of 0 (#40673).
655 $this->fk_bank = (int) $id_bank;
656 return 1;
657 } else {
658 dol_print_error($this->db);
659 return -1;
660 }
661 }
662
663
670 public function getLibStatut($mode = 0)
671 {
672 return $this->LibStatut($this->status, $mode);
673 }
674
675 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
683 public function LibStatut($status, $mode = 0)
684 {
685 // phpcs:enable
686 global $langs;
687
688 /*
689 if (empty($status)) {
690 $status = 0;
691 }
692
693 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
694 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
695 //$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
696 //$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
697 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
698 //$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
699 //$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
700 }
701
702 $statusType = 'status'.$status;
703
704 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
705 */
706 return '';
707 }
708
709
720 public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
721 {
722 global $db, $conf, $langs, $hookmanager;
723 global $langs;
724
725 if (!empty($conf->dol_no_mouse_hover)) {
726 $notooltip = 1; // Force disable tooltips
727 }
728
729 $result = '';
730
731 $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
732 $label .= '<br>';
733 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
734
735 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
736
737 if ($option != 'nolink') {
738 // Add param to save lastsearch_values or not
739 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
740 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
741 $add_save_lastsearch_values = 1;
742 }
743 if ($add_save_lastsearch_values) {
744 $url .= '&save_lastsearch_values=1';
745 }
746 }
747
748 $linkclose = '';
749 if (empty($notooltip)) {
750 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
751 $label = $langs->trans("ShowMyObject");
752 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
753 }
754 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
755 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
756 } else {
757 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
758 }
759
760 $linkstart = '<a href="'.$url.'"';
761 $linkstart .= $linkclose.'>';
762 $linkend = '</a>';
763
764 $result .= $linkstart;
765 if ($withpicto) {
766 $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);
767 }
768 if ($withpicto != 2) {
769 $result .= $this->ref;
770 }
771 $result .= $linkend;
772 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
773
774 global $action;
775 $hookmanager->initHooks(array('variouspayment'));
776 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
777 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
778 if ($reshook > 0) {
779 $result = $hookmanager->resPrint;
780 } else {
781 $result .= $hookmanager->resPrint;
782 }
783
784 return $result;
785 }
786
793 public function info($id)
794 {
795 $sql = 'SELECT v.rowid, v.datec, v.fk_user_author, fk_user_modif, tms';
796 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
797 $sql .= ' WHERE v.rowid = '.((int) $id);
798
799 dol_syslog(get_class($this).'::info', LOG_DEBUG);
800 $result = $this->db->query($sql);
801
802 if ($result) {
803 if ($this->db->num_rows($result)) {
804 $obj = $this->db->fetch_object($result);
805
806 $this->id = $obj->rowid;
807 $this->user_creation = $obj->fk_user_author;
808 $this->user_creation_id = $obj->fk_user_author;
809 $this->user_modification_id = $obj->fk_user_modif;
810 $this->date_creation = $this->db->jdate($obj->datec);
811 $this->date_modification = $this->db->jdate($obj->tms);
812 }
813 $this->db->free($result);
814 } else {
815 dol_print_error($this->db);
816 }
817 }
818
825 public function getVentilExportCompta($mode = 0)
826 {
827 $banklineid = $this->fk_bank;
828
829 $alreadydispatched = 0;
830
831 $type = 'bank';
832
833 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
834 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
835 $resql = $this->db->query($sql);
836 if ($resql) {
837 $obj = $this->db->fetch_object($resql);
838 if ($obj) {
839 $alreadydispatched = $obj->nb;
840 }
841 } else {
842 $this->error = $this->db->lasterror();
843 return -1;
844 }
845
846 if ($alreadydispatched) {
847 return $alreadydispatched;
848 }
849 return 0;
850 }
851
859 public function getKanbanView($option = '', $arraydata = null)
860 {
861 global $langs;
862
863 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
864 $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']);
865 $formatedaccountancycode = (empty($arraydata['formatedaccountancycode']) ? '' : $arraydata['formatedaccountancycode']);
866
867 $return = '<div class="box-flex-item box-flex-grow-zero">';
868 $return .= '<div class="info-box info-box-sm">';
869 $return .= '<span class="info-box-icon bg-infobox-action">';
870 $return .= img_picto('', $this->picto);
871 $return .= '</span>';
872 $return .= '<div class="info-box-content">';
873 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
874 if ($selected >= 0) {
875 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
876 }
877 if (!empty($bankline) && $bankline instanceof AccountLine) {
878 $return .= ' | <span class="info-box-status ">'.$bankline->getNomUrl(1).'</span>';
879 }
880 if (property_exists($this, 'datep')) {
881 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->datep, 'day').'</span>';
882 if ($this->type_payment) {
883 $return .= ' - <span class="info-box-label">'.$this->type_payment.'</span>';
884 }
885 }
886 if (!empty($formatedaccountancycode)) {
887 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">';
888 $return .= $formatedaccountancycode;
889 $return .= '</span>';
890 } elseif (property_exists($this, 'accountancy_code')) {
891 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
892 }
893
894 if (property_exists($this, 'amount')) {
895 $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
896 }
897 $return .= '</div>';
898 $return .= '</div>';
899 $return .= '</div>';
900 return $return;
901 }
902
909 public function lengthAccountg($account)
910 {
911 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
912
913 /*
914 if (isModEnabled('accounting')) {
915 $accountingaccount = new AccountingAccount($db);
916 $accountingaccount->fetch(0, $valuetoshow, 1);
917 }*/
918
919 return length_accountg($account);
920 }
921
928 public function lengthAccounta($account)
929 {
930 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
931
932 return length_accounta($account);
933 }
934}
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
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)
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
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 '.
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