dolibarr  16.0.5
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-2018 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 
24 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
25 
26 
30 class Loan extends CommonObject
31 {
35  public $element = 'loan';
36 
37  public $table = 'loan';
38 
42  public $table_element = 'loan';
43 
47  public $picto = 'money-bill-alt';
48 
52  public $rowid;
53 
54  public $datestart;
55  public $dateend;
56 
60  public $label;
61 
62  public $capital;
63  public $nbterm;
64  public $rate;
65  public $paid;
66  public $account_capital;
67  public $account_insurance;
68  public $account_interest;
69 
73  public $date_creation;
74 
78  public $date_modification;
79 
83  public $date_validation;
84 
85  public $insurance_amount;
86 
90  public $fk_bank;
91 
95  public $fk_user_creat;
96 
100  public $fk_user_modif;
101 
105  public $fk_project;
106 
107 
108  const STATUS_UNPAID = 0;
109  const STATUS_PAID = 1;
110  const STATUS_STARTED = 2;
111 
112 
118  public function __construct($db)
119  {
120  $this->db = $db;
121  }
122 
129  public function fetch($id)
130  {
131  $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,";
132  $sql .= " l.paid, l.fk_bank, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project";
133  $sql .= " FROM ".MAIN_DB_PREFIX."loan as l";
134  $sql .= " WHERE l.rowid = ".((int) $id);
135 
136  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
137  $resql = $this->db->query($sql);
138  if ($resql) {
139  if ($this->db->num_rows($resql)) {
140  $obj = $this->db->fetch_object($resql);
141 
142  $this->id = $obj->rowid;
143  $this->ref = $obj->rowid;
144  $this->datestart = $this->db->jdate($obj->datestart);
145  $this->dateend = $this->db->jdate($obj->dateend);
146  $this->label = $obj->label;
147  $this->capital = $obj->capital;
148  $this->nbterm = $obj->nbterm;
149  $this->rate = $obj->rate;
150  $this->note_private = $obj->note_private;
151  $this->note_public = $obj->note_public;
152  $this->insurance_amount = $obj->insurance_amount;
153  $this->paid = $obj->paid;
154  $this->fk_bank = $obj->fk_bank;
155 
156  $this->account_capital = $obj->accountancy_account_capital;
157  $this->account_insurance = $obj->accountancy_account_insurance;
158  $this->account_interest = $obj->accountancy_account_interest;
159  $this->fk_project = $obj->fk_project;
160 
161  $this->db->free($resql);
162  return 1;
163  } else {
164  $this->db->free($resql);
165  return 0;
166  }
167  } else {
168  $this->error = $this->db->lasterror();
169  return -1;
170  }
171  }
172 
173 
180  public function create($user)
181  {
182  global $conf, $langs;
183 
184  $error = 0;
185 
186  $now = dol_now();
187 
188  // clean parameters
189  $newcapital = price2num($this->capital, 'MT');
190  if (empty($this->insurance_amount)) {
191  $this->insurance_amount = 0;
192  }
193  $newinsuranceamount = price2num($this->insurance_amount, 'MT');
194  if (isset($this->note_private)) {
195  $this->note_private = trim($this->note_private);
196  }
197  if (isset($this->note_public)) {
198  $this->note_public = trim($this->note_public);
199  }
200  if (isset($this->account_capital)) {
201  $this->account_capital = trim($this->account_capital);
202  }
203  if (isset($this->account_insurance)) {
204  $this->account_insurance = trim($this->account_insurance);
205  }
206  if (isset($this->account_interest)) {
207  $this->account_interest = trim($this->account_interest);
208  }
209  if (isset($this->fk_bank)) {
210  $this->fk_bank = (int) $this->fk_bank;
211  }
212  if (isset($this->fk_user_creat)) {
213  $this->fk_user_creat = (int) $this->fk_user_creat;
214  }
215  if (isset($this->fk_user_modif)) {
216  $this->fk_user_modif = (int) $this->fk_user_modif;
217  }
218  if (isset($this->fk_project)) {
219  $this->fk_project = (int) $this->fk_project;
220  }
221 
222  // Check parameters
223  if (!($newcapital > 0) || empty($this->datestart) || empty($this->dateend)) {
224  $this->error = "ErrorBadParameter";
225  return -2;
226  }
227  if (isModEnabled('accounting') && empty($this->account_capital)) {
228  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyCapitalCode"));
229  return -2;
230  }
231  if (isModEnabled('accounting') && empty($this->account_insurance)) {
232  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInsuranceCode"));
233  return -2;
234  }
235  if (isModEnabled('accounting') && empty($this->account_interest)) {
236  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInterestCode"));
237  return -2;
238  }
239 
240  $this->db->begin();
241 
242  $sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,";
243  $sql .= " accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity,";
244  $sql .= " datec, fk_projet, fk_user_author, insurance_amount)";
245  $sql .= " VALUES ('".$this->db->escape($this->label)."',";
246  $sql .= " '".$this->db->escape($this->fk_bank)."',";
247  $sql .= " '".price2num($newcapital)."',";
248  $sql .= " '".$this->db->idate($this->datestart)."',";
249  $sql .= " '".$this->db->idate($this->dateend)."',";
250  $sql .= " '".$this->db->escape($this->nbterm)."',";
251  $sql .= " '".$this->db->escape($this->rate)."',";
252  $sql .= " '".$this->db->escape($this->note_private)."',";
253  $sql .= " '".$this->db->escape($this->note_public)."',";
254  $sql .= " '".$this->db->escape($this->account_capital)."',";
255  $sql .= " '".$this->db->escape($this->account_insurance)."',";
256  $sql .= " '".$this->db->escape($this->account_interest)."',";
257  $sql .= " ".$conf->entity.",";
258  $sql .= " '".$this->db->idate($now)."',";
259  $sql .= " ".(empty($this->fk_project) ? 'NULL' : $this->fk_project).",";
260  $sql .= " ".$user->id.",";
261  $sql .= " '".price2num($newinsuranceamount)."'";
262  $sql .= ")";
263 
264  dol_syslog(get_class($this)."::create", LOG_DEBUG);
265  $resql = $this->db->query($sql);
266  if ($resql) {
267  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."loan");
268 
269  //dol_syslog("Loans::create this->id=".$this->id);
270  $this->db->commit();
271  return $this->id;
272  } else {
273  $this->error = $this->db->error();
274  $this->db->rollback();
275  return -1;
276  }
277  }
278 
279 
286  public function delete($user)
287  {
288  $error = 0;
289 
290  $this->db->begin();
291 
292  // Get bank transaction lines for this loan
293  include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
294  $account = new Account($this->db);
295  $lines_url = $account->get_url('', $this->id, 'loan');
296 
297  // Delete bank urls
298  foreach ($lines_url as $line_url) {
299  if (!$error) {
300  $accountline = new AccountLine($this->db);
301  $accountline->fetch($line_url['fk_bank']);
302  $result = $accountline->delete_urls($user);
303  if ($result < 0) {
304  $error++;
305  }
306  }
307  }
308 
309  // Delete payments
310  if (!$error) {
311  $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_loan where fk_loan=".((int) $this->id);
312  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
313  $resql = $this->db->query($sql);
314  if (!$resql) {
315  $error++;
316  $this->error = $this->db->lasterror();
317  }
318  }
319 
320  if (!$error) {
321  $sql = "DELETE FROM ".MAIN_DB_PREFIX."loan where rowid=".((int) $this->id);
322  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
323  $resql = $this->db->query($sql);
324  if (!$resql) {
325  $error++;
326  $this->error = $this->db->lasterror();
327  }
328  }
329 
330  if (!$error) {
331  $this->db->commit();
332  return 1;
333  } else {
334  $this->db->rollback();
335  return -1;
336  }
337  }
338 
339 
346  public function update($user)
347  {
348  $this->db->begin();
349 
350  if (!is_numeric($this->nbterm)) {
351  $this->error = 'BadValueForParameterForNbTerm';
352  return -1;
353  }
354 
355  $sql = "UPDATE ".MAIN_DB_PREFIX."loan";
356  $sql .= " SET label='".$this->db->escape($this->label)."',";
357  $sql .= " capital='".price2num($this->db->escape($this->capital))."',";
358  $sql .= " datestart='".$this->db->idate($this->datestart)."',";
359  $sql .= " dateend='".$this->db->idate($this->dateend)."',";
360  $sql .= " nbterm=".((float) $this->nbterm).",";
361  $sql .= " rate=".((float) $this->rate).",";
362  $sql .= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',";
363  $sql .= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',";
364  $sql .= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',";
365  $sql .= " fk_projet=".(empty($this->fk_project) ? 'NULL' : ((int) $this->fk_project)).",";
366  $sql .= " fk_user_modif = ".$user->id.",";
367  $sql .= " insurance_amount = '".price2num($this->db->escape($this->insurance_amount))."'";
368  $sql .= " WHERE rowid=".((int) $this->id);
369 
370  dol_syslog(get_class($this)."::update", LOG_DEBUG);
371  $resql = $this->db->query($sql);
372  if ($resql) {
373  $this->db->commit();
374  return 1;
375  } else {
376  $this->error = $this->db->error();
377  $this->db->rollback();
378  return -1;
379  }
380  }
381 
382  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
391  public function set_paid($user)
392  {
393  // phpcs:enable
394  dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
395  return $this->setPaid($user);
396  }
397 
404  public function setPaid($user)
405  {
406  $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
407  $sql .= " paid = ".$this::STATUS_PAID;
408  $sql .= " WHERE rowid = ".((int) $this->id);
409  $return = $this->db->query($sql);
410  if ($return) {
411  return 1;
412  } else {
413  $this->error = $this->db->lasterror();
414  return -1;
415  }
416  }
417 
418  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
427  public function set_started($user)
428  {
429  // phpcs:enable
430  dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE);
431  return $this->setStarted($user);
432  }
433 
440  public function setStarted($user)
441  {
442  $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
443  $sql .= " paid = ".$this::STATUS_STARTED;
444  $sql .= " WHERE rowid = ".((int) $this->id);
445  $return = $this->db->query($sql);
446  if ($return) {
447  return 1;
448  } else {
449  $this->error = $this->db->lasterror();
450  return -1;
451  }
452  }
453 
454  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
462  public function set_unpaid($user)
463  {
464  // phpcs:enable
465  dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
466  return $this->setUnpaid($user);
467  }
468 
475  public function setUnpaid($user)
476  {
477  $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
478  $sql .= " paid = ".$this::STATUS_UNPAID;
479  $sql .= " WHERE rowid = ".((int) $this->id);
480  $return = $this->db->query($sql);
481  if ($return) {
482  return 1;
483  } else {
484  $this->error = $this->db->lasterror();
485  return -1;
486  }
487  }
488 
496  public function getLibStatut($mode = 0, $alreadypaid = -1)
497  {
498  return $this->LibStatut($this->paid, $mode, $alreadypaid);
499  }
500 
501  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
510  public function LibStatut($status, $mode = 0, $alreadypaid = -1)
511  {
512  // phpcs:enable
513  global $langs;
514 
515  // Load translation files required by the page
516  $langs->loadLangs(array("customers", "bills"));
517 
518  unset($this->labelStatus); // Force to reset the array of status label, because label can change depending on parameters
519  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
520  global $langs;
521  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
522  $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
523  $this->labelStatus[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted");
524  if ($status == 0 && $alreadypaid > 0) {
525  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
526  }
527  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
528  $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Enabled');
529  $this->labelStatusShort[self::STATUS_STARTED] = $langs->transnoentitiesnoconv("BillStatusStarted");
530  if ($status == 0 && $alreadypaid > 0) {
531  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
532  }
533  }
534 
535  $statusType = 'status1';
536  if (($status == 0 && $alreadypaid > 0) || $status == self::STATUS_STARTED) {
537  $statusType = 'status3';
538  }
539  if ($status == 1) {
540  $statusType = 'status6';
541  }
542 
543  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
544  }
545 
546 
558  public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
559  {
560  global $conf, $langs, $hookmanager;
561 
562  $result = '';
563 
564  $label = '<u>'.$langs->trans("ShowLoan").'</u>';
565  if (!empty($this->ref)) {
566  $label .= '<br><strong>'.$langs->trans('Ref').':</strong> '.$this->ref;
567  }
568  if (!empty($this->label)) {
569  $label .= '<br><strong>'.$langs->trans('Label').':</strong> '.$this->label;
570  }
571 
572  $url = DOL_URL_ROOT.'/loan/card.php?id='.$this->id;
573 
574  if ($option != 'nolink') {
575  // Add param to save lastsearch_values or not
576  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
577  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
578  $add_save_lastsearch_values = 1;
579  }
580  if ($add_save_lastsearch_values) {
581  $url .= '&save_lastsearch_values=1';
582  }
583  }
584 
585  $linkclose = '';
586  if (empty($notooltip)) {
587  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
588  $label = $langs->trans("ShowMyObject");
589  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
590  }
591  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
592  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
593  } else {
594  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
595  }
596 
597  $linkstart = '<a href="'.$url.'"';
598  $linkstart .= $linkclose.'>';
599  $linkend = '</a>';
600 
601  $result .= $linkstart;
602  if ($withpicto) {
603  $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);
604  }
605  if ($withpicto != 2) {
606  $result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref);
607  }
608  $result .= $linkend;
609 
610  global $action;
611  $hookmanager->initHooks(array($this->element . 'dao'));
612  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
613  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
614  if ($reshook > 0) {
615  $result = $hookmanager->resPrint;
616  } else {
617  $result .= $hookmanager->resPrint;
618  }
619  return $result;
620  }
621 
629  public function initAsSpecimen()
630  {
631  global $user, $langs, $conf;
632 
633  $now = dol_now();
634 
635  // Initialise parameters
636  $this->id = 0;
637  $this->fk_bank = 1;
638  $this->label = 'SPECIMEN';
639  $this->specimen = 1;
640  $this->socid = 1;
641  $this->account_capital = 16;
642  $this->account_insurance = 616;
643  $this->account_interest = 518;
644  $this->datestart = $now;
645  $this->dateend = $now + (3600 * 24 * 365);
646  $this->note_public = 'SPECIMEN';
647  $this->capital = 20000;
648  $this->nbterm = 48;
649  $this->rate = 4.3;
650  }
651 
657  public function getSumPayment()
658  {
659  $table = 'payment_loan';
660  $field = 'fk_loan';
661 
662  $sql = 'SELECT sum(amount_capital) as amount';
663  $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
664  $sql .= " WHERE ".$field." = ".((int) $this->id);
665 
666  dol_syslog(get_class($this)."::getSumPayment", LOG_DEBUG);
667  $resql = $this->db->query($sql);
668  if ($resql) {
669  $amount = 0;
670 
671  $obj = $this->db->fetch_object($resql);
672  if ($obj) {
673  $amount = $obj->amount ? $obj->amount : 0;
674  }
675 
676  $this->db->free($resql);
677  return $amount;
678  } else {
679  $this->error = $this->db->lasterror();
680  return -1;
681  }
682  }
683 
690  public function info($id)
691  {
692  $sql = 'SELECT l.rowid, l.datec, l.fk_user_author, l.fk_user_modif,';
693  $sql .= ' l.tms as datem';
694  $sql .= ' WHERE l.rowid = '.((int) $id);
695 
696  dol_syslog(get_class($this).'::info', LOG_DEBUG);
697  $result = $this->db->query($sql);
698 
699  if ($result) {
700  if ($this->db->num_rows($result)) {
701  $obj = $this->db->fetch_object($result);
702  $this->id = $obj->rowid;
703 
704  $this->user_creation_id = $obj->fk_user_author;
705  $this->user_modification_id = $obj->fk_user_modif;
706  $this->date_creation = $this->db->jdate($obj->datec);
707  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
708 
709  $this->db->free($result);
710  return 1;
711  } else {
712  $this->db->free($result);
713  return 0;
714  }
715  } else {
716  $this->error = $this->db->lasterror();
717  return -1;
718  }
719  }
720 }
Loan\setStarted
setStarted($user)
Tag loan as payment started.
Definition: loan.class.php:440
db
$conf db
API class for accounts.
Definition: inc.php:41
dol_trunc
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.
Definition: functions.lib.php:3805
Loan\getNomUrl
getNomUrl($withpicto=0, $maxlen=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Return clicable name (with eventually the picto)
Definition: loan.class.php:558
Loan\__construct
__construct($db)
Constructor.
Definition: loan.class.php:118
ref
$object ref
Definition: info.php:77
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:44
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
Loan
Loan.
Definition: loan.class.php:30
Loan\getLibStatut
getLibStatut($mode=0, $alreadypaid=-1)
Return label of loan status (unpaid, paid)
Definition: loan.class.php:496
Loan\initAsSpecimen
initAsSpecimen()
Initialise an instance with random values.
Definition: loan.class.php:629
Loan\set_started
set_started($user)
Tag loan as payment started.
Definition: loan.class.php:427
Loan\getSumPayment
getSumPayment()
Return amount of payments already done.
Definition: loan.class.php:657
Loan\setUnpaid
setUnpaid($user)
Tag loan as payement as unpaid.
Definition: loan.class.php:475
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
Loan\info
info($id)
Information on record.
Definition: loan.class.php:690
Loan\create
create($user)
Create a loan into database.
Definition: loan.class.php:180
Loan\set_unpaid
set_unpaid($user)
Tag loan as payement as unpaid.
Definition: loan.class.php:462
Loan\setPaid
setPaid($user)
Tag loan as paid completely.
Definition: loan.class.php:404
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
dolGetStatus
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
Definition: functions.lib.php:10338
Loan\set_paid
set_paid($user)
Tag loan as paid completely.
Definition: loan.class.php:391
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4211
Loan\update
update($user)
Update loan.
Definition: loan.class.php:346
AccountLine
Class to manage bank transaction lines.
Definition: account.class.php:1779
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
Account
Class to manage bank accounts.
Definition: account.class.php:38
Loan\fetch
fetch($id)
Load object in memory from database.
Definition: loan.class.php:129
Loan\LibStatut
LibStatut($status, $mode=0, $alreadypaid=-1)
Return label for given status.
Definition: loan.class.php:510