dolibarr 23.0.4
paymentvarious.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Put here all includes required by your class file
27require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28
29
34{
38 public $element = 'payment_various';
39
43 public $table_element = 'payment_various';
44
48 public $picto = 'payment';
49
53 public $id;
54
58 public $ref;
59
63 public $datep;
64
68 public $datev;
69
73 public $sens;
74
78 public $amount;
79
83 public $type_payment;
84
89 public $num_payment;
90
94 public $chqemetteur;
95
99 public $chqbank;
100
104 public $category_transaction;
105
109 public $label;
110
114 public $accountancy_code;
115
119 public $subledger_account;
120
124 public $fk_project;
125
129 public $fk_account;
130
135 public $accountid;
136
140 public $fk_bank;
141
145 public $categorie_transaction;
146
150 public $fk_user_author;
151
155 public $fk_user_modif;
156
157
161 public $fk_type;
162
166 public $rappro;
167
171 public $bank_num_releve;
172
173
199 // BEGIN MODULEBUILDER PROPERTIES
203 public $fields = array(
204 // TODO: fill this array
205 );
206 // END MODULEBUILDER PROPERTIES
207
211 const STATUS_DRAFT = 0;
212
213
219 public function __construct(DoliDB $db)
220 {
221 $this->db = $db;
222 }
223
231 public function update($user = null, $notrigger = 0)
232 {
233 global $conf, $langs;
234
235 $error = 0;
236
237 // Clean parameters
238 $this->amount = (float) price2num($this->amount);
239 $this->label = trim($this->label);
240 $this->note = trim($this->note);
241 $this->fk_bank = (int) $this->fk_bank;
242 $this->fk_user_author = (int) $this->fk_user_author;
243 $this->fk_user_modif = (int) $this->fk_user_modif;
244
245 $this->db->begin();
246
247 // Update request
248 $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
249 if ($this->tms) {
250 $sql .= " tms='".$this->db->idate($this->tms)."',";
251 }
252 $sql .= " datep='".$this->db->idate($this->datep)."',";
253 $sql .= " datev='".$this->db->idate($this->datev)."',";
254 $sql .= " sens=".(int) $this->sens.",";
255 $sql .= " amount=".price2num($this->amount).",";
256 $sql .= " fk_typepayment=".(int) $this->type_payment.",";
257 $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
258 $sql .= " label='".$this->db->escape($this->label)."',";
259 $sql .= " note='".$this->db->escape($this->note)."',";
260 $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
261 $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
262 $sql .= " fk_projet='".$this->db->escape((string) $this->fk_project)."',";
263 $sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").",";
264 $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
265 $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
266 $sql .= " WHERE rowid=".((int) $this->id);
267
268 dol_syslog(get_class($this)."::update", LOG_DEBUG);
269 $resql = $this->db->query($sql);
270 if (!$resql) {
271 $this->error = "Error ".$this->db->lasterror();
272 return -1;
273 }
274
275 if (!$notrigger) {
276 // Call trigger
277 $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
278 if ($result < 0) {
279 $error++;
280 }
281 // End call triggers
282 }
283
284 if (!$error) {
285 $this->db->commit();
286 return 1;
287 } else {
288 $this->db->rollback();
289 return -1;
290 }
291 }
292
293
301 public function fetch($id, $user = null)
302 {
303 $sql = "SELECT";
304 $sql .= " v.rowid,";
305 $sql .= " v.tms,";
306 $sql .= " v.datep,";
307 $sql .= " v.datev,";
308 $sql .= " v.sens,";
309 $sql .= " v.amount,";
310 $sql .= " v.fk_typepayment,";
311 $sql .= " v.num_payment,";
312 $sql .= " v.label,";
313 $sql .= " v.note as note_private,";
314 $sql .= " v.accountancy_code,";
315 $sql .= " v.subledger_account,";
316 $sql .= " v.fk_projet as fk_project,";
317 $sql .= " v.fk_bank,";
318 $sql .= " v.fk_user_author,";
319 $sql .= " v.fk_user_modif,";
320 $sql .= " b.fk_account,";
321 $sql .= " b.fk_type,";
322 $sql .= " b.rappro,";
323 $sql .= " b.num_releve as bank_num_releve";
324 $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
325 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
326 $sql .= " WHERE v.rowid = ".((int) $id);
327
328 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
329 $resql = $this->db->query($sql);
330 if ($resql) {
331 if ($this->db->num_rows($resql)) {
332 $obj = $this->db->fetch_object($resql);
333
334 $this->id = $obj->rowid;
335 $this->ref = $obj->rowid;
336 $this->tms = $this->db->jdate($obj->tms);
337 $this->datep = $this->db->jdate($obj->datep);
338 $this->datev = $this->db->jdate($obj->datev);
339 $this->sens = $obj->sens;
340 $this->amount = $obj->amount;
341 $this->type_payment = $obj->fk_typepayment;
342 $this->num_payment = $obj->num_payment;
343 $this->label = $obj->label;
344 $this->note = $obj->note_private; // For backward compatibility
345 $this->note_private = $obj->note_private;
346 $this->subledger_account = $obj->subledger_account;
347 $this->accountancy_code = $obj->accountancy_code;
348 $this->fk_project = $obj->fk_project;
349 $this->fk_bank = $obj->fk_bank;
350 $this->fk_user_author = $obj->fk_user_author;
351 $this->fk_user_modif = $obj->fk_user_modif;
352 $this->fk_account = $obj->fk_account;
353 $this->fk_type = $obj->fk_type;
354 $this->rappro = $obj->rappro;
355 $this->bank_num_releve = $obj->bank_num_releve;
356 }
357 $this->db->free($resql);
358
359 return 1;
360 } else {
361 $this->error = "Error ".$this->db->lasterror();
362 return -1;
363 }
364 }
365
366
373 public function delete($user)
374 {
375 global $conf, $langs;
376
377 $error = 0;
378
379 // Call trigger
380 $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
381 if ($result < 0) {
382 return -1;
383 }
384 // End call triggers
385
386
387 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
388 $sql .= " WHERE rowid=".((int) $this->id);
389
390 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
391 $resql = $this->db->query($sql);
392 if (!$resql) {
393 $this->error = "Error ".$this->db->lasterror();
394 return -1;
395 }
396
397 return 1;
398 }
399
400
408 public function initAsSpecimen()
409 {
410 $this->id = 0;
411 $this->tms = dol_now();
412 $this->datep = dol_now();
413 $this->datev = dol_now();
414 $this->sens = 0;
415 $this->amount = 100;
416 $this->label = 'Specimen payment';
417 $this->accountancy_code = '';
418 $this->subledger_account = '';
419 $this->note = '';
420 $this->fk_bank = 0;
421 $this->fk_user_author = 0;
422 $this->fk_user_modif = 0;
423
424 return 1;
425 }
426
432 public function check()
433 {
434 $newamount = price2num($this->amount, 'MT');
435
436 // Validation of parameters
437 if (!($newamount) > 0 || empty($this->datep)) {
438 return false;
439 }
440
441 return true;
442 }
443
450 public function create($user)
451 {
452 global $conf, $langs;
453
454 $error = 0;
455 $now = dol_now();
456
457 // Clean parameters
458 $this->amount = (float) price2num($this->amount);
459 $this->label = trim($this->label);
460 $this->note = trim($this->note);
461 $this->fk_bank = (int) $this->fk_bank;
462 $this->fk_user_author = (int) $this->fk_user_author;
463 $this->fk_user_modif = (int) $this->fk_user_modif;
464 $this->fk_account = (int) $this->fk_account;
465 if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
466 $this->fk_account = $this->accountid;
467 }
468
469 // Check parameters
470 if (!$this->label) {
471 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
472 return -3;
473 }
474 if ($this->amount < 0 || $this->amount == '') {
475 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
476 return -5;
477 }
478 if (isModEnabled("bank") && (empty($this->fk_account) || $this->fk_account <= 0)) {
479 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
480 return -6;
481 }
482 if (isModEnabled("bank") && (empty($this->type_payment) || $this->type_payment <= 0)) {
483 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
484 return -7;
485 }
486
487 $this->db->begin();
488
489 // Insert into llx_payment_various
490 $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
491 $sql .= " datep";
492 $sql .= ", datev";
493 $sql .= ", sens";
494 $sql .= ", amount";
495 $sql .= ", fk_typepayment";
496 $sql .= ", num_payment";
497 if ($this->note) {
498 $sql .= ", note";
499 }
500 $sql .= ", label";
501 $sql .= ", accountancy_code";
502 $sql .= ", subledger_account";
503 $sql .= ", fk_projet";
504 $sql .= ", fk_user_author";
505 $sql .= ", datec";
506 $sql .= ", fk_bank";
507 $sql .= ", entity";
508 $sql .= ")";
509 $sql .= " VALUES (";
510 $sql .= "'".$this->db->idate($this->datep)."'";
511 $sql .= ", '".$this->db->idate($this->datev)."'";
512 $sql .= ", '".$this->db->escape((string) $this->sens)."'";
513 $sql .= ", ".price2num($this->amount);
514 $sql .= ", '".$this->db->escape((string) $this->type_payment)."'";
515 $sql .= ", '".$this->db->escape($this->num_payment)."'";
516 if ($this->note) {
517 $sql .= ", '".$this->db->escape($this->note)."'";
518 }
519 $sql .= ", '".$this->db->escape($this->label)."'";
520 $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
521 $sql .= ", '".$this->db->escape($this->subledger_account)."'";
522 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
523 $sql .= ", ".((int) $user->id);
524 $sql .= ", '".$this->db->idate($now)."'";
525 $sql .= ", NULL"; // Filled later
526 $sql .= ", ".((int) $conf->entity);
527 $sql .= ")";
528
529 dol_syslog(get_class($this)."::create", LOG_DEBUG);
530 $result = $this->db->query($sql);
531 if ($result) {
532 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
533 $this->ref = (string) $this->id;
534
535 if ($this->id > 0) {
536 if (isModEnabled("bank") && !empty($this->amount)) {
537 // Insert into llx_bank
538 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
539
540 $acc = new Account($this->db);
541 $result = $acc->fetch($this->fk_account);
542 if ($result <= 0) {
543 dol_print_error($this->db);
544 }
545
546 // Insert payment into llx_bank
547 // Add link 'payment_various' in bank_url between payment and bank transaction
548 $sign = 1;
549 if ($this->sens == '0') {
550 $sign = -1;
551 }
552
553 $bank_line_id = $acc->addline(
554 $this->datep,
555 (string) $this->type_payment,
556 $this->label,
557 $sign * abs($this->amount),
558 $this->num_payment,
559 ($this->category_transaction > 0 ? $this->category_transaction : 0),
560 $user,
561 $this->chqemetteur,
562 $this->chqbank,
563 '',
564 $this->datev
565 );
566
567 // Update fk_bank into llx_payment_various
568 // So we know the payment which has generate the banking transaction
569 if ($bank_line_id > 0) {
570 $this->update_fk_bank($bank_line_id);
571 } else {
572 $this->error = $acc->error;
573 $error++;
574 }
575
576 if (!$error) {
577 // Add link 'payment_various' in bank_url between payment and bank transaction
578 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
579
580 $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
581 if ($result <= 0) {
582 $this->error = $acc->error;
583 $error++;
584 }
585 }
586
587 if ($result <= 0) {
588 $this->error = $acc->error;
589 $error++;
590 }
591 }
592
593 // Call trigger
594 $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
595 if ($result < 0) {
596 $error++;
597 }
598 // End call triggers
599 } else {
600 $error++;
601 }
602
603 if (!$error) {
604 $this->db->commit();
605 return $this->id;
606 } else {
607 $this->db->rollback();
608 return -2;
609 }
610 } else {
611 $this->error = $this->db->error();
612 $this->db->rollback();
613 return -1;
614 }
615 }
616
617 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
624 public function update_fk_bank($id_bank)
625 {
626 // phpcs:enable
627 $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
628 $sql .= " WHERE rowid = ".((int) $this->id);
629 $result = $this->db->query($sql);
630 if ($result) {
631 // Keep the in memory object in sync, so a trigger called right after create() reports
632 // the real bank line instead of 0 (#40673).
633 $this->fk_bank = (int) $id_bank;
634 return 1;
635 } else {
636 dol_print_error($this->db);
637 return -1;
638 }
639 }
640
641
648 public function getLibStatut($mode = 0)
649 {
650 return $this->LibStatut($this->statut, $mode);
651 }
652
653 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
661 public function LibStatut($status, $mode = 0)
662 {
663 // phpcs:enable
664 global $langs;
665
666 /*
667 if (empty($status)) {
668 $status = 0;
669 }
670
671 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
672 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
673 //$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
674 //$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
675 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
676 //$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
677 //$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
678 }
679
680 $statusType = 'status'.$status;
681
682 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
683 */
684 return '';
685 }
686
687
698 public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
699 {
700 global $db, $conf, $langs, $hookmanager;
701 global $langs;
702
703 if (!empty($conf->dol_no_mouse_hover)) {
704 $notooltip = 1; // Force disable tooltips
705 }
706
707 $result = '';
708
709 $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
710 $label .= '<br>';
711 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
712
713 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
714
715 if ($option != 'nolink') {
716 // Add param to save lastsearch_values or not
717 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
718 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
719 $add_save_lastsearch_values = 1;
720 }
721 if ($add_save_lastsearch_values) {
722 $url .= '&save_lastsearch_values=1';
723 }
724 }
725
726 $linkclose = '';
727 if (empty($notooltip)) {
728 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
729 $label = $langs->trans("ShowMyObject");
730 $linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
731 }
732 $linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
733 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
734 } else {
735 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
736 }
737
738 $linkstart = '<a href="'.$url.'"';
739 $linkstart .= $linkclose.'>';
740 $linkend = '</a>';
741
742 $result .= $linkstart;
743 if ($withpicto) {
744 $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);
745 }
746 if ($withpicto != 2) {
747 $result .= $this->ref;
748 }
749 $result .= $linkend;
750 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
751
752 global $action;
753 $hookmanager->initHooks(array('variouspayment'));
754 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
755 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
756 if ($reshook > 0) {
757 $result = $hookmanager->resPrint;
758 } else {
759 $result .= $hookmanager->resPrint;
760 }
761
762 return $result;
763 }
764
771 public function info($id)
772 {
773 $sql = 'SELECT v.rowid, v.datec, v.fk_user_author, fk_user_modif, tms';
774 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
775 $sql .= ' WHERE v.rowid = '.((int) $id);
776
777 dol_syslog(get_class($this).'::info', LOG_DEBUG);
778 $result = $this->db->query($sql);
779
780 if ($result) {
781 if ($this->db->num_rows($result)) {
782 $obj = $this->db->fetch_object($result);
783
784 $this->id = $obj->rowid;
785 $this->user_creation = $obj->fk_user_author;
786 $this->user_creation_id = $obj->fk_user_author;
787 $this->user_modification_id = $obj->fk_user_modif;
788 $this->date_creation = $this->db->jdate($obj->datec);
789 $this->date_modification = $this->db->jdate($obj->tms);
790 }
791 $this->db->free($result);
792 } else {
793 dol_print_error($this->db);
794 }
795 }
796
803 public function getVentilExportCompta($mode = 0)
804 {
805 $banklineid = $this->fk_bank;
806
807 $alreadydispatched = 0;
808
809 $type = 'bank';
810
811 $sql = " SELECT ".($mode ? 'DISTINCT piece_num' : 'COUNT(ab.rowid)')." as nb";
812 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type = '".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
813 $resql = $this->db->query($sql);
814 if ($resql) {
815 $obj = $this->db->fetch_object($resql);
816 if ($obj) {
817 $alreadydispatched = $obj->nb;
818 }
819 } else {
820 $this->error = $this->db->lasterror();
821 return -1;
822 }
823
824 if ($alreadydispatched) {
825 return $alreadydispatched;
826 }
827 return 0;
828 }
829
837 public function getKanbanView($option = '', $arraydata = null)
838 {
839 global $langs;
840
841 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
842 $bankline = ((empty($arraydata['bankline']) || empty($arraydata['bankline']->id)) ? 0 : $arraydata['bankline']);
843 $formatedaccountancycode = (empty($arraydata['formatedaccountancycode']) ? '' : $arraydata['formatedaccountancycode']);
844
845 $return = '<div class="box-flex-item box-flex-grow-zero">';
846 $return .= '<div class="info-box info-box-sm">';
847 $return .= '<span class="info-box-icon bg-infobox-action">';
848 $return .= img_picto('', $this->picto);
849 $return .= '</span>';
850 $return .= '<div class="info-box-content">';
851 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
852 if ($selected >= 0) {
853 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
854 }
855 if (!empty($bankline) && $bankline instanceof AccountLine) {
856 $return .= ' | <span class="info-box-status ">'.$bankline->getNomUrl(1).'</span>';
857 }
858 if (property_exists($this, 'datep')) {
859 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
860 if ($this->type_payment) {
861 $return .= ' - <span class="info-box-label">'.$this->type_payment.'</span>';
862 }
863 }
864 if (!empty($formatedaccountancycode)) {
865 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">';
866 $return .= $formatedaccountancycode;
867 $return .= '</span>';
868 } elseif (property_exists($this, 'accountancy_code')) {
869 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
870 }
871
872 if (property_exists($this, 'amount')) {
873 $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
874 }
875 $return .= '</div>';
876 $return .= '</div>';
877 $return .= '</div>';
878 return $return;
879 }
880
887 public function lengthAccountg($account)
888 {
889 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
890
891 /*
892 if (isModEnabled('accounting')) {
893 $accountingaccount = new AccountingAccount($db);
894 $accountingaccount->fetch(0, $valuetoshow, 1);
895 }*/
896
897 return length_accountg($account);
898 }
899
906 public function lengthAccounta($account)
907 {
908 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
909
910 return length_accounta($account);
911 }
912}
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,...
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)
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.
if(getDolGlobalString( 'TAKEPOS_SHOW_CUSTOMER')) print $langs trans('Date')." left 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 PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount
Definition receipt.php:471