dolibarr 21.0.0-beta
loan.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 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
25require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
26
27
31class Loan extends CommonObject
32{
36 public $element = 'loan';
37
43 public $table = 'loan';
44
48 public $table_element = 'loan';
49
53 public $picto = 'money-bill-alt';
54
58 public $rowid;
59
63 public $datestart;
64
68 public $dateend;
69
73 public $label;
74
78 public $capital;
79
83 public $nbterm;
84
88 public $rate;
89
93 public $paid;
94
98 public $account_capital;
99
103 public $account_insurance;
104
108 public $account_interest;
109
113 public $accountancy_account_capital;
114
118 public $accountancy_account_insurance;
119
123 public $accountancy_account_interest;
124
128 public $insurance_amount;
129
133 public $fk_bank;
134
138 public $fk_user_creat;
139
143 public $fk_user_modif;
144
148 public $fk_project;
149
153 public $totalpaid;
154
158 const STATUS_UNPAID = 0;
159
163 const STATUS_PAID = 1;
164
168 const STATUS_STARTED = 2;
169
170
176 public function __construct($db)
177 {
178 $this->db = $db;
179 }
180
187 public function fetch($id)
188 {
189 $sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public, l.insurance_amount,";
190 $sql .= " l.paid, l.fk_bank, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project";
191 $sql .= " FROM ".MAIN_DB_PREFIX."loan as l";
192 $sql .= " WHERE l.rowid = ".((int) $id);
193
194 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
195 $resql = $this->db->query($sql);
196 if ($resql) {
197 if ($this->db->num_rows($resql)) {
198 $obj = $this->db->fetch_object($resql);
199
200 $this->id = $obj->rowid;
201 $this->ref = $obj->rowid;
202 $this->datestart = $this->db->jdate($obj->datestart);
203 $this->dateend = $this->db->jdate($obj->dateend);
204 $this->label = $obj->label;
205 $this->capital = $obj->capital;
206 $this->nbterm = $obj->nbterm;
207 $this->rate = $obj->rate;
208 $this->note_private = $obj->note_private;
209 $this->note_public = $obj->note_public;
210 $this->insurance_amount = $obj->insurance_amount;
211 $this->paid = $obj->paid;
212 $this->fk_bank = $obj->fk_bank;
213
214 $this->account_capital = $obj->accountancy_account_capital;
215 $this->account_insurance = $obj->accountancy_account_insurance;
216 $this->account_interest = $obj->accountancy_account_interest;
217 $this->fk_project = $obj->fk_project;
218
219 $this->db->free($resql);
220 return 1;
221 } else {
222 $this->db->free($resql);
223 return 0;
224 }
225 } else {
226 $this->error = $this->db->lasterror();
227 return -1;
228 }
229 }
230
231
238 public function create($user)
239 {
240 global $conf, $langs;
241
242 $error = 0;
243
244 $now = dol_now();
245
246 // clean parameters
247 $newcapital = price2num($this->capital, 'MT');
248 if (empty($this->insurance_amount)) {
249 $this->insurance_amount = 0;
250 }
251 $newinsuranceamount = price2num($this->insurance_amount, 'MT');
252 if (isset($this->note_private)) {
253 $this->note_private = trim($this->note_private);
254 }
255 if (isset($this->note_public)) {
256 $this->note_public = trim($this->note_public);
257 }
258 if (isset($this->account_capital)) {
259 $this->account_capital = trim($this->account_capital);
260 }
261 if (isset($this->account_insurance)) {
262 $this->account_insurance = trim($this->account_insurance);
263 }
264 if (isset($this->account_interest)) {
265 $this->account_interest = trim($this->account_interest);
266 }
267 if (isset($this->fk_bank)) {
268 $this->fk_bank = (int) $this->fk_bank;
269 }
270 if (isset($this->fk_user_creat)) {
271 $this->fk_user_creat = (int) $this->fk_user_creat;
272 }
273 if (isset($this->fk_user_modif)) {
274 $this->fk_user_modif = (int) $this->fk_user_modif;
275 }
276 if (isset($this->fk_project)) {
277 $this->fk_project = (int) $this->fk_project;
278 }
279
280 // Check parameters
281 if (!($newcapital > 0) || empty($this->datestart) || empty($this->dateend)) {
282 $this->error = "ErrorBadParameter";
283 return -2;
284 }
285 if (isModEnabled('accounting') && empty($this->account_capital)) {
286 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyCapitalCode"));
287 return -2;
288 }
289 if (isModEnabled('accounting') && empty($this->account_insurance)) {
290 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInsuranceCode"));
291 return -2;
292 }
293 if (isModEnabled('accounting') && empty($this->account_interest)) {
294 $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInterestCode"));
295 return -2;
296 }
297
298 $this->db->begin();
299
300 $sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,";
301 $sql .= " accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity,";
302 $sql .= " datec, fk_projet, fk_user_author, insurance_amount)";
303 $sql .= " VALUES ('".$this->db->escape($this->label)."',";
304 $sql .= " '".$this->db->escape($this->fk_bank)."',";
305 $sql .= " '".price2num($newcapital)."',";
306 $sql .= " '".$this->db->idate($this->datestart)."',";
307 $sql .= " '".$this->db->idate($this->dateend)."',";
308 $sql .= " '".$this->db->escape($this->nbterm)."',";
309 $sql .= " '".$this->db->escape($this->rate)."',";
310 $sql .= " '".$this->db->escape($this->note_private)."',";
311 $sql .= " '".$this->db->escape($this->note_public)."',";
312 $sql .= " '".$this->db->escape($this->account_capital)."',";
313 $sql .= " '".$this->db->escape($this->account_insurance)."',";
314 $sql .= " '".$this->db->escape($this->account_interest)."',";
315 $sql .= " ".((int) $conf->entity).",";
316 $sql .= " '".$this->db->idate($now)."',";
317 $sql .= " ".(empty($this->fk_project) ? 'NULL' : $this->fk_project).",";
318 $sql .= " ".((int) $user->id).",";
319 $sql .= " '".price2num($newinsuranceamount)."'";
320 $sql .= ")";
321
322 dol_syslog(get_class($this)."::create", LOG_DEBUG);
323 $resql = $this->db->query($sql);
324 if ($resql) {
325 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."loan");
326
327 //dol_syslog("Loans::create this->id=".$this->id);
328 $this->db->commit();
329 return $this->id;
330 } else {
331 $this->error = $this->db->error();
332 $this->db->rollback();
333 return -1;
334 }
335 }
336
337
344 public function delete($user)
345 {
346 $error = 0;
347
348 $this->db->begin();
349
350 // Get bank transaction lines for this loan
351 include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
352 $account = new Account($this->db);
353 $lines_url = $account->get_url(0, $this->id, 'loan');
354
355 // Delete bank urls
356 foreach ($lines_url as $line_url) {
357 if (!$error) {
358 $accountline = new AccountLine($this->db);
359 $accountline->fetch($line_url['fk_bank']);
360 $result = $accountline->delete_urls($user);
361 if ($result < 0) {
362 $error++;
363 }
364 }
365 }
366
367 // Delete payments
368 if (!$error) {
369 $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_loan where fk_loan=".((int) $this->id);
370 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
371 $resql = $this->db->query($sql);
372 if (!$resql) {
373 $error++;
374 $this->error = $this->db->lasterror();
375 }
376 }
377
378 if (!$error) {
379 $sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".((int) $this->id);
380 dol_syslog(get_class($this)."::delete", LOG_DEBUG);
381 $resql = $this->db->query($sql);
382 if (!$resql) {
383 $error++;
384 $this->error = $this->db->lasterror();
385 }
386 }
387
388 if (!$error) {
389 $this->db->commit();
390 return 1;
391 } else {
392 $this->db->rollback();
393 return -1;
394 }
395 }
396
397
404 public function update($user)
405 {
406 $this->db->begin();
407
408 if (!is_numeric($this->nbterm)) {
409 $this->error = 'BadValueForParameterForNbTerm';
410 return -1;
411 }
412
413 $sql = "UPDATE ".MAIN_DB_PREFIX."loan";
414 $sql .= " SET label='".$this->db->escape($this->label)."',";
415 $sql .= " capital='".price2num($this->db->escape($this->capital))."',";
416 $sql .= " datestart='".$this->db->idate($this->datestart)."',";
417 $sql .= " dateend='".$this->db->idate($this->dateend)."',";
418 $sql .= " nbterm=".((float) $this->nbterm).",";
419 $sql .= " rate=".((float) $this->rate).",";
420 $sql .= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',";
421 $sql .= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',";
422 $sql .= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',";
423 $sql .= " fk_projet=".(empty($this->fk_project) ? 'NULL' : ((int) $this->fk_project)).",";
424 $sql .= " fk_user_modif = ".((int) $user->id).",";
425 $sql .= " insurance_amount = '".price2num($this->db->escape($this->insurance_amount))."'";
426 $sql .= " WHERE rowid=".((int) $this->id);
427
428 dol_syslog(get_class($this)."::update", LOG_DEBUG);
429 $resql = $this->db->query($sql);
430 if ($resql) {
431 $this->db->commit();
432 return 1;
433 } else {
434 $this->error = $this->db->error();
435 $this->db->rollback();
436 return -1;
437 }
438 }
439
446 public function setPaid($user)
447 {
448 $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
449 $sql .= " paid = ".((int) $this::STATUS_PAID);
450 $sql .= " WHERE rowid = ".((int) $this->id);
451
452 $return = $this->db->query($sql);
453
454 if ($return) {
455 $this->paid = $this::STATUS_PAID;
456 return 1;
457 } else {
458 $this->error = $this->db->lasterror();
459 return -1;
460 }
461 }
462
463 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
472 public function set_started($user)
473 {
474 // phpcs:enable
475 dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE);
476 return $this->setStarted($user);
477 }
478
485 public function setStarted($user)
486 {
487 $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
488 $sql .= " paid = ".((int) $this::STATUS_STARTED);
489 $sql .= " WHERE rowid = ".((int) $this->id);
490
491 $return = $this->db->query($sql);
492
493 if ($return) {
494 $this->paid = $this::STATUS_STARTED;
495 return 1;
496 } else {
497 $this->error = $this->db->lasterror();
498 return -1;
499 }
500 }
501
508 public function setUnpaid($user)
509 {
510 $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
511 $sql .= " paid = ".((int) $this::STATUS_UNPAID);
512 $sql .= " WHERE rowid = ".((int) $this->id);
513
514 $return = $this->db->query($sql);
515
516 if ($return) {
517 $this->paid = $this::STATUS_UNPAID;
518 return 1;
519 } else {
520 $this->error = $this->db->lasterror();
521 return -1;
522 }
523 }
524
532 public function getLibStatut($mode = 0, $alreadypaid = -1)
533 {
534 return $this->LibStatut($this->paid, $mode, $alreadypaid);
535 }
536
537 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
546 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
547 {
548 // phpcs:enable
549 global $langs;
550
551 // Load translation files required by the page
552 $langs->loadLangs(array("customers", "bills"));
553
554 unset($this->labelStatus); // Force to reset the array of status label, because label can change depending on parameters
555 // Always true because of 'unset':
556 // if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
557 global $langs;
558 $this->labelStatus = array();
559 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
560 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
561 $this->labelStatus[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted");
562 if ($status == 0 && $alreadypaid > 0) {
563 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
564 }
565 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
566 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
567 $this->labelStatusShort[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted");
568 if ($status == 0 && $alreadypaid > 0) {
569 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
570 }
571 // } // End of empty(labelStatus,labelStatusShort)
572
573 $statusType = 'status1';
574 if (($status == 0 && $alreadypaid > 0) || $status == self::STATUS_STARTED) {
575 $statusType = 'status3';
576 }
577 if ($status == 1) {
578 $statusType = 'status6';
579 }
580
581 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
582 }
583
584
596 public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
597 {
598 global $conf, $langs, $hookmanager;
599
600 $result = '';
601
602 $label = '<u>'.$langs->trans("ShowLoan").'</u>';
603 if (!empty($this->ref)) {
604 $label .= '<br><strong>'.$langs->trans('Ref').':</strong> '.$this->ref;
605 }
606 if (!empty($this->label)) {
607 $label .= '<br><strong>'.$langs->trans('Label').':</strong> '.$this->label;
608 }
609 if (isDolTms($this->datestart)) {
610 $label .= '<br><strong>'.$langs->trans("DateStart").':</strong> '.dol_print_date($this->datestart, 'day');
611 }
612 if (isDolTms($this->dateend)) {
613 $label .= '<br><strong>'.$langs->trans("DateEnd").':</strong> '.dol_print_date($this->dateend, 'day');
614 }
615
616 $url = DOL_URL_ROOT.'/loan/card.php?id='.$this->id;
617
618 if ($option != 'nolink') {
619 // Add param to save lastsearch_values or not
620 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
621 if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
622 $add_save_lastsearch_values = 1;
623 }
624 if ($add_save_lastsearch_values) {
625 $url .= '&save_lastsearch_values=1';
626 }
627 }
628
629 $linkclose = '';
630 if (empty($notooltip)) {
631 if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
632 $label = $langs->trans("ShowMyObject");
633 $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
634 }
635 $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
636 $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
637 } else {
638 $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
639 }
640
641 $linkstart = '<a href="'.$url.'"';
642 $linkstart .= $linkclose.'>';
643 $linkend = '</a>';
644
645 $result .= $linkstart;
646 if ($withpicto) {
647 $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);
648 }
649 if ($withpicto != 2) {
650 $result .= ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref);
651 }
652 $result .= $linkend;
653
654 global $action;
655 $hookmanager->initHooks(array($this->element . 'dao'));
656 $parameters = array('id' => $this->id, 'getnomurl' => &$result);
657 $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
658 if ($reshook > 0) {
659 $result = $hookmanager->resPrint;
660 } else {
661 $result .= $hookmanager->resPrint;
662 }
663 return $result;
664 }
665
673 public function initAsSpecimen()
674 {
675 $now = dol_now();
676
677 // Initialise parameters
678 $this->id = 0;
679 $this->fk_bank = 1;
680 $this->label = 'SPECIMEN';
681 $this->specimen = 1;
682 $this->account_capital = '16';
683 $this->account_insurance = '616';
684 $this->account_interest = '518';
685 $this->datestart = $now;
686 $this->dateend = $now + (3600 * 24 * 365);
687 $this->note_public = 'SPECIMEN';
688 $this->capital = 20000.80;
689 $this->nbterm = 48;
690 $this->rate = 4.3;
691
692 return 1;
693 }
694
700 public function getSumPayment()
701 {
702 $table = 'payment_loan';
703 $field = 'fk_loan';
704
705 $sql = 'SELECT sum(amount_capital) as amount';
706 $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
707 $sql .= " WHERE ".$field." = ".((int) $this->id);
708
709 dol_syslog(get_class($this)."::getSumPayment", LOG_DEBUG);
710 $resql = $this->db->query($sql);
711 if ($resql) {
712 $amount = 0;
713
714 $obj = $this->db->fetch_object($resql);
715 if ($obj) {
716 $amount = $obj->amount ? $obj->amount : 0;
717 }
718
719 $this->db->free($resql);
720 return $amount;
721 } else {
722 $this->error = $this->db->lasterror();
723 return -1;
724 }
725 }
726
733 public function info($id)
734 {
735 $sql = 'SELECT l.rowid, l.datec, l.fk_user_author, l.fk_user_modif,';
736 $sql .= ' l.tms as datem';
737 $sql .= ' WHERE l.rowid = '.((int) $id);
738
739 dol_syslog(get_class($this).'::info', LOG_DEBUG);
740 $result = $this->db->query($sql);
741
742 if ($result) {
743 if ($this->db->num_rows($result)) {
744 $obj = $this->db->fetch_object($result);
745
746 $this->id = $obj->rowid;
747
748 $this->user_creation_id = $obj->fk_user_author;
749 $this->user_modification_id = $obj->fk_user_modif;
750 $this->date_creation = $this->db->jdate($obj->datec);
751 $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
752
753 $this->db->free($result);
754 return 1;
755 } else {
756 $this->db->free($result);
757 return 0;
758 }
759 } else {
760 $this->error = $this->db->lasterror();
761 return -1;
762 }
763 }
764
772 public function getKanbanView($option = '', $arraydata = null)
773 {
774 global $langs;
775
776 $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
777
778 $return = '<div class="box-flex-item box-flex-grow-zero">';
779 $return .= '<div class="info-box info-box-sm">';
780 $return .= '<span class="info-box-icon bg-infobox-action">';
781 $return .= img_picto('', $this->picto);
782 $return .= '</span>';
783 $return .= '<div class="info-box-content">';
784 $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.$this->getNomUrl(1).'</span>';
785 if ($selected >= 0) {
786 $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
787 }
788 if (!empty($this->capital)) {
789 $return .= ' | <span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="info-box-label amount">'.price($this->capital).'</span>';
790 }
791 if (isDolTms($this->datestart)) {
792 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateStart").'</span> : <span class="info-box-label">'.dol_print_date($this->datestart, 'day').'</span>';
793 }
794 if (isDolTms($this->dateend)) {
795 $return .= '<br><span class="opacitymedium">'.$langs->trans("DateEnd").'</span> : <span class="info-box-label">'.dol_print_date($this->dateend, 'day').'</span>';
796 }
797
798 $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
799 $return .= '</div>';
800 $return .= '</div>';
801 $return .= '</div>';
802
803 return $return;
804 }
805}
$object ref
Definition info.php:89
Class to manage bank accounts.
Class to manage bank transaction lines.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Loan.
fetch($id)
Load object in memory from database.
setUnpaid($user)
Tag loan as payment as unpaid.
initAsSpecimen()
Initialise an instance with random values.
setPaid($user)
Tag loan as paid completely.
getKanbanView($option='', $arraydata=null)
Return clickable link of object (with eventually picto)
setStarted($user)
Tag loan as payment started.
info($id)
Information on record.
LibStatut($status, $mode=0, $alreadypaid=-1)
Return label for given status.
__construct($db)
Constructor.
getNomUrl($withpicto=0, $maxlen=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return clickable name (with eventually the picto)
update($user)
Update loan.
getSumPayment()
Return amount of payments already done.
create($user)
Create a loan into database.
set_started($user)
Tag loan as payment started.
getLibStatut($mode=0, $alreadypaid=-1)
Return label of loan status (unpaid, paid)
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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 '.
isDolTms($timestamp)
isDolTms check if a timestamp is valid.
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_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79