dolibarr 18.0.6
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-2023 Frédéric France <frederic.france@netlogic.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Put here all includes required by your class file
26require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27
28
33{
37 public $element = 'payment_various';
38
42 public $table_element = 'payment_various';
43
47 public $picto = 'payment';
48
52 public $id;
53
57 public $ref;
58
62 public $tms;
63 public $datep;
64 public $datev;
65
69 public $sens;
70 public $amount;
71 public $type_payment;
72 public $num_payment;
73 public $chqemetteur;
74 public $chqbank;
75 public $category_transaction;
76
80 public $label;
81
85 public $accountancy_code;
86
90 public $subledger_account;
91
95 public $fk_project;
96
100 public $fk_account;
101
106 public $accountid;
107
111 public $fk_bank;
112
116 public $categorie_transaction;
117
121 public $fk_user_author;
122
126 public $fk_user_modif;
127
128
132 public $fk_type;
133
137 public $rappro;
138
142 public $bank_num_releve;
143
144
170 // BEGIN MODULEBUILDER PROPERTIES
174 public $fields = array(
175 // TODO: fill this array
176 );
177 // END MODULEBUILDER PROPERTIES
178
182 const STATUS_DRAFT = 0;
183
184
190 public function __construct(DoliDB $db)
191 {
192 $this->db = $db;
193 }
194
202 public function update($user = null, $notrigger = 0)
203 {
204 global $conf, $langs;
205
206 $error = 0;
207
208 // Clean parameters
209 $this->amount = trim($this->amount);
210 $this->label = trim($this->label);
211 $this->note = trim($this->note);
212 $this->fk_bank = (int) $this->fk_bank;
213 $this->fk_user_author = (int) $this->fk_user_author;
214 $this->fk_user_modif = (int) $this->fk_user_modif;
215
216 $this->db->begin();
217
218 // Update request
219 $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
220 if ($this->tms) {
221 $sql .= " tms='".$this->db->idate($this->tms)."',";
222 }
223 $sql .= " datep='".$this->db->idate($this->datep)."',";
224 $sql .= " datev='".$this->db->idate($this->datev)."',";
225 $sql .= " sens=".(int) $this->sens.",";
226 $sql .= " amount=".price2num($this->amount).",";
227 $sql .= " fk_typepayment=".(int) $this->type_payment.",";
228 $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
229 $sql .= " label='".$this->db->escape($this->label)."',";
230 $sql .= " note='".$this->db->escape($this->note)."',";
231 $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
232 $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
233 $sql .= " fk_projet='".$this->db->escape($this->fk_project)."',";
234 $sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").",";
235 $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
236 $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
237 $sql .= " WHERE rowid=".((int) $this->id);
238
239 dol_syslog(get_class($this)."::update", LOG_DEBUG);
240 $resql = $this->db->query($sql);
241 if (!$resql) {
242 $this->error = "Error ".$this->db->lasterror();
243 return -1;
244 }
245
246 if (!$notrigger) {
247 // Call trigger
248 $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
249 if ($result < 0) {
250 $error++;
251 }
252 // End call triggers
253 }
254
255 if (!$error) {
256 $this->db->commit();
257 return 1;
258 } else {
259 $this->db->rollback();
260 return -1;
261 }
262 }
263
264
272 public function fetch($id, $user = null)
273 {
274 $sql = "SELECT";
275 $sql .= " v.rowid,";
276 $sql .= " v.tms,";
277 $sql .= " v.datep,";
278 $sql .= " v.datev,";
279 $sql .= " v.sens,";
280 $sql .= " v.amount,";
281 $sql .= " v.fk_typepayment,";
282 $sql .= " v.num_payment,";
283 $sql .= " v.label,";
284 $sql .= " v.note as note_private,";
285 $sql .= " v.accountancy_code,";
286 $sql .= " v.subledger_account,";
287 $sql .= " v.fk_projet as fk_project,";
288 $sql .= " v.fk_bank,";
289 $sql .= " v.fk_user_author,";
290 $sql .= " v.fk_user_modif,";
291 $sql .= " b.fk_account,";
292 $sql .= " b.fk_type,";
293 $sql .= " b.rappro,";
294 $sql .= " b.num_releve as bank_num_releve";
295 $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
296 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
297 $sql .= " WHERE v.rowid = ".((int) $id);
298
299 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
300 $resql = $this->db->query($sql);
301 if ($resql) {
302 if ($this->db->num_rows($resql)) {
303 $obj = $this->db->fetch_object($resql);
304
305 $this->id = $obj->rowid;
306 $this->ref = $obj->rowid;
307 $this->tms = $this->db->jdate($obj->tms);
308 $this->datep = $this->db->jdate($obj->datep);
309 $this->datev = $this->db->jdate($obj->datev);
310 $this->sens = $obj->sens;
311 $this->amount = $obj->amount;
312 $this->type_payment = $obj->fk_typepayment;
313 $this->num_payment = $obj->num_payment;
314 $this->label = $obj->label;
315 $this->note = $obj->note_private; // For backward compatibility
316 $this->note_private = $obj->note_private;
317 $this->subledger_account = $obj->subledger_account;
318 $this->accountancy_code = $obj->accountancy_code;
319 $this->fk_project = $obj->fk_project;
320 $this->fk_bank = $obj->fk_bank;
321 $this->fk_user_author = $obj->fk_user_author;
322 $this->fk_user_modif = $obj->fk_user_modif;
323 $this->fk_account = $obj->fk_account;
324 $this->fk_type = $obj->fk_type;
325 $this->rappro = $obj->rappro;
326 $this->bank_num_releve = $obj->bank_num_releve;
327 }
328 $this->db->free($resql);
329
330 return 1;
331 } else {
332 $this->error = "Error ".$this->db->lasterror();
333 return -1;
334 }
335 }
336
337
344 public function delete($user)
345 {
346 global $conf, $langs;
347
348 $error = 0;
349
350 // Call trigger
351 $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
352 if ($result < 0) {
353 return -1;
354 }
355 // End call triggers
356
357
358 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
359 $sql .= " WHERE rowid=".((int) $this->id);
360
361 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
362 $resql = $this->db->query($sql);
363 if (!$resql) {
364 $this->error = "Error ".$this->db->lasterror();
365 return -1;
366 }
367
368 return 1;
369 }
370
371
379 public function initAsSpecimen()
380 {
381 $this->id = 0;
382
383 $this->tms = '';
384 $this->datep = '';
385 $this->datev = '';
386 $this->sens = '';
387 $this->amount = '';
388 $this->label = '';
389 $this->accountancy_code = '';
390 $this->subledger_account = '';
391 $this->note = '';
392 $this->fk_bank = '';
393 $this->fk_user_author = '';
394 $this->fk_user_modif = '';
395 }
396
402 public function check()
403 {
404 $newamount = price2num($this->amount, 'MT');
405
406 // Validation of parameters
407 if (!($newamount) > 0 || empty($this->datep)) {
408 return false;
409 }
410
411 return true;
412 }
413
420 public function create($user)
421 {
422 global $conf, $langs;
423
424 $error = 0;
425 $now = dol_now();
426
427 // Clean parameters
428 $this->amount = price2num(trim($this->amount));
429 $this->label = trim($this->label);
430 $this->note = trim($this->note);
431 $this->fk_bank = (int) $this->fk_bank;
432 $this->fk_user_author = (int) $this->fk_user_author;
433 $this->fk_user_modif = (int) $this->fk_user_modif;
434 $this->fk_account = (int) $this->fk_account;
435 if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
436 $this->fk_account = $this->accountid;
437 }
438
439 // Check parameters
440 if (!$this->label) {
441 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
442 return -3;
443 }
444 if ($this->amount < 0 || $this->amount == '') {
445 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
446 return -5;
447 }
448 if (isModEnabled("banque") && (empty($this->fk_account) || $this->fk_account <= 0)) {
449 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
450 return -6;
451 }
452 if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0)) {
453 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
454 return -7;
455 }
456
457 $this->db->begin();
458
459 // Insert into llx_payment_various
460 $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
461 $sql .= " datep";
462 $sql .= ", datev";
463 $sql .= ", sens";
464 $sql .= ", amount";
465 $sql .= ", fk_typepayment";
466 $sql .= ", num_payment";
467 if ($this->note) {
468 $sql .= ", note";
469 }
470 $sql .= ", label";
471 $sql .= ", accountancy_code";
472 $sql .= ", subledger_account";
473 $sql .= ", fk_projet";
474 $sql .= ", fk_user_author";
475 $sql .= ", datec";
476 $sql .= ", fk_bank";
477 $sql .= ", entity";
478 $sql .= ")";
479 $sql .= " VALUES (";
480 $sql .= "'".$this->db->idate($this->datep)."'";
481 $sql .= ", '".$this->db->idate($this->datev)."'";
482 $sql .= ", '".$this->db->escape($this->sens)."'";
483 $sql .= ", ".price2num($this->amount);
484 $sql .= ", '".$this->db->escape($this->type_payment)."'";
485 $sql .= ", '".$this->db->escape($this->num_payment)."'";
486 if ($this->note) {
487 $sql .= ", '".$this->db->escape($this->note)."'";
488 }
489 $sql .= ", '".$this->db->escape($this->label)."'";
490 $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
491 $sql .= ", '".$this->db->escape($this->subledger_account)."'";
492 $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
493 $sql .= ", ".((int) $user->id);
494 $sql .= ", '".$this->db->idate($now)."'";
495 $sql .= ", NULL"; // Filled later
496 $sql .= ", ".((int) $conf->entity);
497 $sql .= ")";
498
499 dol_syslog(get_class($this)."::create", LOG_DEBUG);
500 $result = $this->db->query($sql);
501 if ($result) {
502 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
503 $this->ref = $this->id;
504
505 if ($this->id > 0) {
506 if (isModEnabled("banque") && !empty($this->amount)) {
507 // Insert into llx_bank
508 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
509
510 $acc = new Account($this->db);
511 $result = $acc->fetch($this->fk_account);
512 if ($result <= 0) {
513 dol_print_error($this->db);
514 }
515
516 // Insert payment into llx_bank
517 // Add link 'payment_various' in bank_url between payment and bank transaction
518 $sign = 1;
519 if ($this->sens == '0') {
520 $sign = -1;
521 }
522
523 $bank_line_id = $acc->addline(
524 $this->datep,
525 $this->type_payment,
526 $this->label,
527 $sign * abs($this->amount),
528 $this->num_payment,
529 ($this->category_transaction > 0 ? $this->category_transaction : 0),
530 $user,
531 $this->chqemetteur,
532 $this->chqbank,
533 '',
534 $this->datev
535 );
536
537 // Update fk_bank into llx_payment_various
538 // So we know the payment which has generate the banking ecriture
539 if ($bank_line_id > 0) {
540 $this->update_fk_bank($bank_line_id);
541 } else {
542 $this->error = $acc->error;
543 $error++;
544 }
545
546 if (!$error) {
547 // Add link 'payment_various' in bank_url between payment and bank transaction
548 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
549
550 $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
551 if ($result <= 0) {
552 $this->error = $acc->error;
553 $error++;
554 }
555 }
556
557 if ($result <= 0) {
558 $this->error = $acc->error;
559 $error++;
560 }
561 }
562
563 // Call trigger
564 $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
565 if ($result < 0) {
566 $error++;
567 }
568 // End call triggers
569 } else {
570 $error++;
571 }
572
573 if (!$error) {
574 $this->db->commit();
575 return $this->id;
576 } else {
577 $this->db->rollback();
578 return -2;
579 }
580 } else {
581 $this->error = $this->db->error();
582 $this->db->rollback();
583 return -1;
584 }
585 }
586
587 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
594 public function update_fk_bank($id_bank)
595 {
596 // phpcs:enable
597 $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
598 $sql .= " WHERE rowid = ".((int) $this->id);
599 $result = $this->db->query($sql);
600 if ($result) {
601 return 1;
602 } else {
603 dol_print_error($this->db);
604 return -1;
605 }
606 }
607
608
615 public function getLibStatut($mode = 0)
616 {
617 return $this->LibStatut($this->statut, $mode);
618 }
619
620 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
628 public function LibStatut($status, $mode = 0)
629 {
630 // phpcs:enable
631 global $langs;
632
633 if (empty($status)) {
634 $status = 0;
635 }
636
637 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
638 $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
639 //$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
640 //$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
641 $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
642 //$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
643 //$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
644 }
645
646 $statusType = 'status'.$status;
647
648 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
649 }
650
651
662 public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
663 {
664 global $db, $conf, $langs, $hookmanager;
665 global $langs;
666
667 if (!empty($conf->dol_no_mouse_hover)) {
668 $notooltip = 1; // Force disable tooltips
669 }
670
671 $result = '';
672
673 $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
674 $label .= '<br>';
675 $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
676
677 $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
678
679 if ($option != 'nolink') {
680 // Add param to save lastsearch_values or not
681 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
682 if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
683 $add_save_lastsearch_values = 1;
684 }
685 if ($add_save_lastsearch_values) {
686 $url .= '&save_lastsearch_values=1';
687 }
688 }
689
690 $linkclose = '';
691 if (empty($notooltip)) {
692 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
693 $label = $langs->trans("ShowMyObject");
694 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
695 }
696 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
697 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
698 } else {
699 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
700 }
701
702 $linkstart = '<a href="'.$url.'"';
703 $linkstart .= $linkclose.'>';
704 $linkend = '</a>';
705
706 $result .= $linkstart;
707 if ($withpicto) {
708 $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);
709 }
710 if ($withpicto != 2) {
711 $result .= $this->ref;
712 }
713 $result .= $linkend;
714 //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
715
716 global $action;
717 $hookmanager->initHooks(array('variouspayment'));
718 $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
719 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
720 if ($reshook > 0) {
721 $result = $hookmanager->resPrint;
722 } else {
723 $result .= $hookmanager->resPrint;
724 }
725
726 return $result;
727 }
728
735 public function info($id)
736 {
737 $sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
738 $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
739 $sql .= ' WHERE v.rowid = '.((int) $id);
740
741 dol_syslog(get_class($this).'::info', LOG_DEBUG);
742 $result = $this->db->query($sql);
743
744 if ($result) {
745 if ($this->db->num_rows($result)) {
746 $obj = $this->db->fetch_object($result);
747 $this->id = $obj->rowid;
748 if ($obj->fk_user_author) {
749 $cuser = new User($this->db);
750 $cuser->fetch($obj->fk_user_author);
751 $this->user_creation = $cuser;
752 }
753 $this->date_creation = $this->db->jdate($obj->datec);
754 if ($obj->fk_user_modif) {
755 $muser = new User($this->db);
756 $muser->fetch($obj->fk_user_modif);
757 $this->user_modif = $muser;
758 }
759 $this->date_modif = $this->db->jdate($obj->tms);
760 }
761 $this->db->free($result);
762 } else {
763 dol_print_error($this->db);
764 }
765 }
766
772 public function getVentilExportCompta()
773 {
774 $banklineid = $this->fk_bank;
775
776 $alreadydispatched = 0;
777
778 $type = 'bank';
779
780 $sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
781 $resql = $this->db->query($sql);
782 if ($resql) {
783 $obj = $this->db->fetch_object($resql);
784 if ($obj) {
785 $alreadydispatched = $obj->nb;
786 }
787 } else {
788 $this->error = $this->db->lasterror();
789 return -1;
790 }
791
792 if ($alreadydispatched) {
793 return 1;
794 }
795 return 0;
796 }
797
805 public function getKanbanView($option = '', $arraydata = null)
806 {
807 global $langs;
808
809 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
810
811 $return = '<div class="box-flex-item box-flex-grow-zero">';
812 $return .= '<div class="info-box info-box-sm">';
813 $return .= '<span class="info-box-icon bg-infobox-action">';
814 $return .= img_picto('', $this->picto);
815 $return .= '</span>';
816 $return .= '<div class="info-box-content">';
817 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
818 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
819 if (property_exists($this, 'fk_bank')) {
820 $return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
821 }
822 if (property_exists($this, 'datep')) {
823 $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
824 }
825 if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
826 $return .= '<br><span class="opacitymedium">'.$langs->trans("Payment", $this->type_payment).'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
827 }
828 if (property_exists($this, 'accountancy_code')) {
829 $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
830 }
831 if (property_exists($this, 'amount')) {
832 $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
833 }
834 $return .= '</div>';
835 $return .= '</div>';
836 $return .= '</div>';
837 return $return;
838 }
839
846 public function lengthAccountg($account)
847 {
848 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
849
850 /*
851 if (isModEnabled('accounting')) {
852 $accountingaccount = new AccountingAccount($db);
853 $accountingaccount->fetch('', $valuetoshow, 1);
854 }*/
855
856 return length_accountg($account);
857 }
858
865 public function lengthAccounta($account)
866 {
867 include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
868
869 return length_accounta($account);
870 }
871}
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:78
Class to manage bank accounts.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
call_trigger($triggerName, $user)
Call trigger based on this instance.
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 clicable (with possibly the picto)
initAsSpecimen()
Initialise an instance with random values.
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.
getVentilExportCompta()
Return if a various payment linked to a bank line id was dispatched into bookkeeping.
getLibStatut($mode=0)
Return the label of the status.
update($user=null, $notrigger=0)
Update database.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
Class to manage Dolibarr users.
print $langs trans("Ref").' m m m statut
Definition index.php:152
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
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='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.