dolibarr 24.0.0-beta
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 $categorie_transaction;
147
151 public $fk_user_author;
152
156 public $fk_user_modif;
157
158
162 public $fk_type;
163
167 public $rappro;
168
172 public $bank_num_releve;
173
174
200 // BEGIN MODULEBUILDER PROPERTIES
204 public $fields = array(
205 // TODO: fill this array
206 );
207 // END MODULEBUILDER PROPERTIES
208
212 const STATUS_DRAFT = 0;
213
214
220 public function __construct(DoliDB $db)
221 {
222 $this->db = $db;
223 }
224
232 public function update($user = null, $notrigger = 0)
233 {
234 global $conf, $langs;
235
236 $error = 0;
237
238 // Clean parameters
239 $this->amount = (float) price2num($this->amount);
240 $this->label = trim($this->label);
241 $this->note = trim($this->note);
242 $this->fk_bank = (int) $this->fk_bank;
243 $this->fk_user_author = (int) $this->fk_user_author;
244 $this->fk_user_modif = (int) $this->fk_user_modif;
245
246 $this->db->begin();
247
248 // Update request
249 $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
250 if ($this->tms) {
251 $sql .= " tms='".$this->db->idate($this->tms)."',";
252 }
253 $sql .= " datep='".$this->db->idate($this->datep)."',";
254 $sql .= " datev='".$this->db->idate($this->datev)."',";
255 $sql .= " sens=".(int) $this->sens.",";
256 $sql .= " amount=".price2num($this->amount).",";
257 $sql .= " fk_typepayment=".(int) $this->type_payment.",";
258 $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
259 $sql .= " label='".$this->db->escape($this->label)."',";
260 $sql .= " note='".$this->db->escape($this->note)."',";
261 $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
262 $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
263 $sql .= " fk_projet='".$this->db->escape((string) $this->fk_project)."',";
264 $sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").",";
265 $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
266 $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
267 $sql .= " WHERE rowid=".((int) $this->id);
268
269 dol_syslog(get_class($this)."::update", LOG_DEBUG);
270 $resql = $this->db->query($sql);
271 if (!$resql) {
272 $this->error = "Error ".$this->db->lasterror();
273 return -1;
274 }
275
276 // Actions on extra fields
277 $result = $this->insertExtraFields();
278 if ($result < 0) {
279 $error++;
280 }
281
282 if (!$error && !$notrigger) {
283 // Call trigger
284 $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
285 if ($result < 0) {
286 $error++;
287 }
288 // End call triggers
289 }
290
291 if (!$error) {
292 $this->db->commit();
293 return 1;
294 } else {
295 $this->db->rollback();
296 return -1;
297 }
298 }
299
300
308 public function fetch($id, $user = null)
309 {
310 $sql = "SELECT";
311 $sql .= " v.rowid,";
312 $sql .= " v.tms,";
313 $sql .= " v.datep,";
314 $sql .= " v.datev,";
315 $sql .= " v.sens,";
316 $sql .= " v.amount,";
317 $sql .= " v.fk_typepayment,";
318 $sql .= " v.num_payment,";
319 $sql .= " v.label,";
320 $sql .= " v.note as note_private,";
321 $sql .= " v.accountancy_code,";
322 $sql .= " v.subledger_account,";
323 $sql .= " v.fk_projet as fk_project,";
324 $sql .= " v.fk_bank,";
325 $sql .= " v.fk_user_author,";
326 $sql .= " v.fk_user_modif,";
327 $sql .= " b.fk_account,";
328 $sql .= " b.fk_type,";
329 $sql .= " b.rappro,";
330 $sql .= " b.num_releve as bank_num_releve";
331 $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
332 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
333 $sql .= " WHERE v.rowid = ".((int) $id);
334
335 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
336 $resql = $this->db->query($sql);
337 if ($resql) {
338 if ($this->db->num_rows($resql)) {
339 $obj = $this->db->fetch_object($resql);
340
341 $this->id = $obj->rowid;
342 $this->ref = $obj->rowid;
343 $this->tms = $this->db->jdate($obj->tms);
344 $this->datep = $this->db->jdate($obj->datep);
345 $this->datev = $this->db->jdate($obj->datev);
346 $this->sens = $obj->sens;
347 $this->amount = $obj->amount;
348 $this->type_payment = $obj->fk_typepayment;
349 $this->num_payment = $obj->num_payment;
350 $this->label = $obj->label;
351 $this->note = $obj->note_private; // For backward compatibility
352 $this->note_private = $obj->note_private;
353 $this->subledger_account = $obj->subledger_account;
354 $this->accountancy_code = $obj->accountancy_code;
355 $this->fk_project = $obj->fk_project;
356 $this->fk_bank = $obj->fk_bank;
357 $this->fk_user_author = $obj->fk_user_author;
358 $this->fk_user_modif = $obj->fk_user_modif;
359 $this->fk_account = $obj->fk_account;
360 $this->fk_type = $obj->fk_type;
361 $this->rappro = $obj->rappro;
362 $this->bank_num_releve = $obj->bank_num_releve;
363 }
364
365 // Fetch extrafields
366 $this->fetch_optionals();
367
368 $this->db->free($resql);
369
370 return 1;
371 } else {
372 $this->error = "Error ".$this->db->lasterror();
373 return -1;
374 }
375 }
376
377
384 public function delete($user)
385 {
386 global $conf, $langs;
387
388 $error = 0;
389
390 // Call trigger
391 $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
392 if ($result < 0) {
393 return -1;
394 }
395 // End call triggers
396
397
398 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
399 $sql .= " WHERE rowid=".((int) $this->id);
400
401 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
402 $resql = $this->db->query($sql);
403 if (!$resql) {
404 $this->error = "Error ".$this->db->lasterror();
405 return -1;
406 }
407
408 return 1;
409 }
410
411
419 public function initAsSpecimen()
420 {
421 $this->id = 0;
422 $this->tms = dol_now();
423 $this->datep = dol_now();
424 $this->datev = dol_now();
425 $this->sens = 0;
426 $this->amount = 100;
427 $this->label = 'Specimen payment';
428 $this->accountancy_code = '';
429 $this->subledger_account = '';
430 $this->note = '';
431 $this->fk_bank = 0;
432 $this->fk_user_author = 0;
433 $this->fk_user_modif = 0;
434
435 return 1;
436 }
437
443 public function check()
444 {
445 $newamount = price2num($this->amount, 'MT');
446
447 // Validation of parameters
448 if (!($newamount) > 0 || empty($this->datep)) {
449 return false;
450 }
451
452 return true;
453 }
454
461 public function create($user)
462 {
463 global $conf, $langs;
464
465 $error = 0;
466 $now = dol_now();
467
468 // Clean parameters
469 $this->amount = (float) price2num($this->amount);
470 $this->label = trim($this->label);
471 $this->note = trim($this->note);
472 $this->fk_bank = (int) $this->fk_bank;
473 $this->fk_user_author = (int) $this->fk_user_author;
474 $this->fk_user_modif = (int) $this->fk_user_modif;
475 $this->fk_account = (int) $this->fk_account;
476 if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
477 $this->fk_account = $this->accountid;
478 }
479
480 // Check parameters
481 if (!$this->label) {
482 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
483 return -3;
484 }
485 if ($this->amount < 0 || $this->amount == '') {
486 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
487 return -5;
488 }
489 if (isModEnabled("bank") && (empty($this->fk_account) || $this->fk_account <= 0)) {
490 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
491 return -6;
492 }
493 if (isModEnabled("bank") && (empty($this->type_payment) || $this->type_payment <= 0)) {
494 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
495 return -7;
496 }
497
498 $this->db->begin();
499
500 // Insert into llx_payment_various
501 $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
502 $sql .= " datep";
503 $sql .= ", datev";
504 $sql .= ", sens";
505 $sql .= ", amount";
506 $sql .= ", fk_typepayment";
507 $sql .= ", num_payment";
508 if ($this->note) {
509 $sql .= ", note";
510 }
511 $sql .= ", label";
512 $sql .= ", accountancy_code";
513 $sql .= ", subledger_account";
514 $sql .= ", fk_projet";
515 $sql .= ", fk_user_author";
516 $sql .= ", datec";
517 $sql .= ", fk_bank";
518 $sql .= ", entity";
519 $sql .= ")";
520 $sql .= " VALUES (";
521 $sql .= "'".$this->db->idate($this->datep)."'";
522 $sql .= ", '".$this->db->idate($this->datev)."'";
523 $sql .= ", '".$this->db->escape((string) $this->sens)."'";
524 $sql .= ", ".price2num($this->amount);
525 $sql .= ", '".$this->db->escape((string) $this->type_payment)."'";
526 $sql .= ", '".$this->db->escape($this->num_payment)."'";
527 if ($this->note) {
528 $sql .= ", '".$this->db->escape($this->note)."'";
529 }
530 $sql .= ", '".$this->db->escape($this->label)."'";
531 $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
532 $sql .= ", '".$this->db->escape($this->subledger_account)."'";
533 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
534 $sql .= ", ".((int) $user->id);
535 $sql .= ", '".$this->db->idate($now)."'";
536 $sql .= ", NULL"; // Filled later
537 $sql .= ", ".((int) $conf->entity);
538 $sql .= ")";
539
540 dol_syslog(get_class($this)."::create", LOG_DEBUG);
541 $result = $this->db->query($sql);
542 if ($result) {
543 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
544 $this->ref = (string) $this->id;
545
546 if ($this->id > 0) {
547 // Insert extrafields
548 $result = $this->insertExtraFields();
549 if ($result < 0) {
550 $error++;
551 }
552
553 if (isModEnabled("bank") && !empty($this->amount)) {
554 // Insert into llx_bank
555 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
556
557 $acc = new Account($this->db);
558 $result = $acc->fetch($this->fk_account);
559 if ($result <= 0) {
560 dol_print_error($this->db);
561 }
562
563 // Insert payment into llx_bank
564 // Add link 'payment_various' in bank_url between payment and bank transaction
565 $sign = 1;
566 if ($this->sens == '0') {
567 $sign = -1;
568 }
569
570 $bank_line_id = $acc->addline(
571 $this->datep,
572 (string) $this->type_payment,
573 $this->label,
574 $sign * abs($this->amount),
575 $this->num_payment,
576 ($this->category_transaction > 0 ? $this->category_transaction : 0),
577 $user,
578 $this->chqemetteur,
579 $this->chqbank,
580 '',
581 $this->datev
582 );
583
584 // Update fk_bank into llx_payment_various
585 // So we know the payment which has generate the banking transaction
586 if ($bank_line_id > 0) {
587 $this->update_fk_bank($bank_line_id);
588 } else {
589 $this->error = $acc->error;
590 $error++;
591 }
592
593 if (!$error) {
594 // Add link 'payment_various' in bank_url between payment and bank transaction
595 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
596
597 $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
598 if ($result <= 0) {
599 $this->error = $acc->error;
600 $error++;
601 }
602 }
603
604 if ($result <= 0) {
605 $this->error = $acc->error;
606 $error++;
607 }
608 }
609
610 // Call trigger
611 $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
612 if ($result < 0) {
613 $error++;
614 }
615 // End call triggers
616 } else {
617 $error++;
618 }
619
620 if (!$error) {
621 $this->db->commit();
622 return $this->id;
623 } else {
624 $this->db->rollback();
625 return -2;
626 }
627 } else {
628 $this->error = $this->db->error();
629 $this->db->rollback();
630 return -1;
631 }
632 }
633
634 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
641 public function update_fk_bank($id_bank)
642 {
643 // phpcs:enable
644 $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
645 $sql .= " WHERE rowid = ".((int) $this->id);
646 $result = $this->db->query($sql);
647 if ($result) {
648 return 1;
649 } else {
650 dol_print_error($this->db);
651 return -1;
652 }
653 }
654
655
662 public function getLibStatut($mode = 0)
663 {
664 return $this->LibStatut($this->statut, $mode);
665 }
666
667 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
675 public function LibStatut($status, $mode = 0)
676 {
677 // phpcs:enable
678 global $langs;
679
680 /*
681 if (empty($status)) {
682 $status = 0;
683 }
684
685 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
686 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
687 //$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
688 //$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
689 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
690 //$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
691 //$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
692 }
693
694 $statusType = 'status'.$status;
695
696 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
697 */
698 return '';
699 }
700
701
712 public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
713 {
714 global $db, $conf, $langs, $hookmanager;
715 global $langs;
716
717 if (!empty($conf->dol_no_mouse_hover)) {
718 $notooltip = 1; // Force disable tooltips
719 }
720
721 $result = '';
722
723 $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
724 $label .= '<br>';
725 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
726
727 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
728
729 if ($option != 'nolink') {
730 // Add param to save lastsearch_values or not
731 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
732 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
733 $add_save_lastsearch_values = 1;
734 }
735 if ($add_save_lastsearch_values) {
736 $url .= '&save_lastsearch_values=1';
737 }
738 }
739
740 $linkclose = '';
741 if (empty($notooltip)) {
742 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
743 $label = $langs->trans("ShowMyObject");
744 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
745 }
746 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
747 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
748 } else {
749 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
750 }
751
752 $linkstart = '<a href="'.$url.'"';
753 $linkstart .= $linkclose.'>';
754 $linkend = '</a>';
755
756 $result .= $linkstart;
757 if ($withpicto) {
758 $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);
759 }
760 if ($withpicto != 2) {
761 $result .= $this->ref;
762 }
763 $result .= $linkend;
764 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
765
766 global $action;
767 $hookmanager->initHooks(array('variouspayment'));
768 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
769 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
770 if ($reshook > 0) {
771 $result = $hookmanager->resPrint;
772 } else {
773 $result .= $hookmanager->resPrint;
774 }
775
776 return $result;
777 }
778
785 public function info($id)
786 {
787 $sql = 'SELECT v.rowid, v.datec, v.fk_user_author, fk_user_modif, tms';
788 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
789 $sql .= ' WHERE v.rowid = '.((int) $id);
790
791 dol_syslog(get_class($this).'::info', LOG_DEBUG);
792 $result = $this->db->query($sql);
793
794 if ($result) {
795 if ($this->db->num_rows($result)) {
796 $obj = $this->db->fetch_object($result);
797
798 $this->id = $obj->rowid;
799 $this->user_creation = $obj->fk_user_author;
800 $this->user_creation_id = $obj->fk_user_author;
801 $this->user_modification_id = $obj->fk_user_modif;
802 $this->date_creation = $this->db->jdate($obj->datec);
803 $this->date_modification = $this->db->jdate($obj->tms);
804 }
805 $this->db->free($result);
806 } else {
807 dol_print_error($this->db);
808 }
809 }
810
817 public function getVentilExportCompta($mode = 0)
818 {
819 $banklineid = $this->fk_bank;
820
821 $alreadydispatched = 0;
822
823 $type = 'bank';
824
825 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
826 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
827 $resql = $this->db->query($sql);
828 if ($resql) {
829 $obj = $this->db->fetch_object($resql);
830 if ($obj) {
831 $alreadydispatched = $obj->nb;
832 }
833 } else {
834 $this->error = $this->db->lasterror();
835 return -1;
836 }
837
838 if ($alreadydispatched) {
839 return $alreadydispatched;
840 }
841 return 0;
842 }
843
851 public function getKanbanView($option = '', $arraydata = null)
852 {
853 global $langs;
854
855 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
856 $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']);
857 $formatedaccountancycode = (empty($arraydata['formatedaccountancycode']) ? '' : $arraydata['formatedaccountancycode']);
858
859 $return = '<div class="box-flex-item box-flex-grow-zero">';
860 $return .= '<div class="info-box info-box-sm">';
861 $return .= '<span class="info-box-icon bg-infobox-action">';
862 $return .= img_picto('', $this->picto);
863 $return .= '</span>';
864 $return .= '<div class="info-box-content">';
865 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
866 if ($selected >= 0) {
867 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
868 }
869 if (!empty($bankline) && $bankline instanceof AccountLine) {
870 $return .= ' | <span class="info-box-status ">'.$bankline->getNomUrl(1).'</span>';
871 }
872 if (property_exists($this, 'datep')) {
873 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->datep, 'day').'</span>';
874 if ($this->type_payment) {
875 $return .= ' - <span class="info-box-label">'.$this->type_payment.'</span>';
876 }
877 }
878 if (!empty($formatedaccountancycode)) {
879 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">';
880 $return .= $formatedaccountancycode;
881 $return .= '</span>';
882 } elseif (property_exists($this, 'accountancy_code')) {
883 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
884 }
885
886 if (property_exists($this, 'amount')) {
887 $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
888 }
889 $return .= '</div>';
890 $return .= '</div>';
891 $return .= '</div>';
892 return $return;
893 }
894
901 public function lengthAccountg($account)
902 {
903 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
904
905 /*
906 if (isModEnabled('accounting')) {
907 $accountingaccount = new AccountingAccount($db);
908 $accountingaccount->fetch(0, $valuetoshow, 1);
909 }*/
910
911 return length_accountg($account);
912 }
913
920 public function lengthAccounta($account)
921 {
922 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
923
924 return length_accounta($account);
925 }
926}
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.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
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)
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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:489