dolibarr  17.0.4
salary.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
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
27 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28 
29 
33 class Salary extends CommonObject
34 {
38  public $element = 'salary';
39 
43  public $table_element = 'salary';
44 
48  public $picto = 'salary';
49 
50  public $tms;
51 
55  public $fk_user;
56 
57  public $datep;
58  public $datev;
59 
60  public $salary;
61  public $amount;
65  public $fk_project;
66 
67  public $type_payment;
68 
72  public $label;
73 
74  public $datesp;
75  public $dateep;
76 
80  public $fk_bank;
81 
85  public $fk_user_author;
86 
90  public $fk_user_modif;
91 
95  public $user;
96 
100  public $paye;
101 
102  const STATUS_UNPAID = 0;
103  const STATUS_PAID = 1;
104 
105 
111  public function __construct($db)
112  {
113  $this->db = $db;
114  $this->element = 'salary';
115  $this->table_element = 'salary';
116  }
117 
125  public function update($user = null, $notrigger = 0)
126  {
127  global $conf, $langs;
128 
129  $error = 0;
130 
131  // Clean parameters
132  $this->amount = trim($this->amount);
133  $this->label = trim($this->label);
134  $this->note = trim($this->note);
135 
136  // Check parameters
137  if (empty($this->fk_user) || $this->fk_user < 0) {
138  $this->error = 'ErrorBadParameter';
139  return -1;
140  }
141 
142  $this->db->begin();
143 
144  // Update request
145  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
146  $sql .= " tms='".$this->db->idate(dol_now())."',";
147  $sql .= " fk_user=".((int) $this->fk_user).",";
148  /*$sql .= " datep='".$this->db->idate($this->datep)."',";
149  $sql .= " datev='".$this->db->idate($this->datev)."',";*/
150  $sql .= " amount=".price2num($this->amount).",";
151  $sql .= " fk_projet=".((int) $this->fk_project).",";
152  $sql .= " fk_typepayment=".((int) $this->type_payment).",";
153  $sql .= " label='".$this->db->escape($this->label)."',";
154  $sql .= " datesp='".$this->db->idate($this->datesp)."',";
155  $sql .= " dateep='".$this->db->idate($this->dateep)."',";
156  $sql .= " note='".$this->db->escape($this->note)."',";
157  $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").",";
158  $sql .= " fk_user_author=".((int) $this->fk_user_author).",";
159  $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
160  $sql .= " WHERE rowid=".((int) $this->id);
161 
162  dol_syslog(get_class($this)."::update", LOG_DEBUG);
163  $resql = $this->db->query($sql);
164  if (!$resql) {
165  $this->error = "Error ".$this->db->lasterror();
166  return -1;
167  }
168 
169  // Update extrafield
170  if (!$error) {
171  if (!$error) {
172  $result = $this->insertExtraFields();
173  if ($result < 0) {
174  $error++;
175  }
176  }
177  }
178 
179  if (!$notrigger) {
180  // Call trigger
181  $result = $this->call_trigger('SALARY_MODIFY', $user);
182  if ($result < 0) $error++;
183  // End call triggers
184  }
185 
186  if (!$error) {
187  $this->db->commit();
188  return 1;
189  } else {
190  $this->db->rollback();
191  return -1;
192  }
193  }
194 
195 
203  public function fetch($id, $user = null)
204  {
205  global $langs;
206  $sql = "SELECT";
207  $sql .= " s.rowid,";
208 
209  $sql .= " s.tms,";
210  $sql .= " s.fk_user,";
211  $sql .= " s.datep,";
212  $sql .= " s.datev,";
213  $sql .= " s.amount,";
214  $sql .= " s.fk_projet as fk_project,";
215  $sql .= " s.fk_typepayment,";
216  $sql .= " s.label,";
217  $sql .= " s.datesp,";
218  $sql .= " s.dateep,";
219  $sql .= " s.note,";
220  $sql .= " s.paye,";
221  $sql .= " s.fk_bank,";
222  $sql .= " s.fk_user_author,";
223  $sql .= " s.fk_user_modif,";
224  $sql .= " s.fk_account";
225 
226  $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
227  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
228  $sql .= " WHERE s.rowid = ".((int) $id);
229 
230  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
231  $resql = $this->db->query($sql);
232  if ($resql) {
233  if ($this->db->num_rows($resql)) {
234  $obj = $this->db->fetch_object($resql);
235 
236  $this->id = $obj->rowid;
237  $this->ref = $obj->rowid;
238  $this->tms = $this->db->jdate($obj->tms);
239  $this->fk_user = $obj->fk_user;
240  $this->datep = $this->db->jdate($obj->datep);
241  $this->datev = $this->db->jdate($obj->datev);
242  $this->amount = $obj->amount;
243  $this->fk_project = $obj->fk_project;
244  $this->type_payment = $obj->fk_typepayment;
245  $this->label = $obj->label;
246  $this->datesp = $this->db->jdate($obj->datesp);
247  $this->dateep = $this->db->jdate($obj->dateep);
248  $this->note = $obj->note;
249  $this->paye = $obj->paye;
250  $this->fk_bank = $obj->fk_bank;
251  $this->fk_user_author = $obj->fk_user_author;
252  $this->fk_user_modif = $obj->fk_user_modif;
253  $this->fk_account = $this->accountid = $obj->fk_account;
254 
255  // Retrieve all extrafield
256  // fetch optionals attributes and labels
257  $this->fetch_optionals();
258  }
259  $this->db->free($resql);
260 
261  return 1;
262  } else {
263  $this->error = "Error ".$this->db->lasterror();
264  return -1;
265  }
266  }
267 
268 
275  public function delete($user)
276  {
277  global $conf, $langs;
278 
279  $error = 0;
280 
281  // Call trigger
282  $result = $this->call_trigger('SALARY_DELETE', $user);
283  if ($result < 0) return -1;
284  // End call triggers
285 
286  // Delete extrafields
287  /*if (!$error)
288  {
289  $sql = "DELETE FROM ".MAIN_DB_PREFIX."salary_extrafields";
290  $sql .= " WHERE fk_object = ".((int) $this->id);
291 
292  $resql = $this->db->query($sql);
293  if (!$resql)
294  {
295  $this->errors[] = $this->db->lasterror();
296  $error++;
297  }
298  }*/
299 
300  $sql = "DELETE FROM ".MAIN_DB_PREFIX."salary";
301  $sql .= " WHERE rowid=".((int) $this->id);
302 
303  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
304  $resql = $this->db->query($sql);
305  if (!$resql) {
306  $this->error = "Error ".$this->db->lasterror();
307  return -1;
308  }
309 
310  return 1;
311  }
312 
313 
321  public function initAsSpecimen()
322  {
323  $this->id = 0;
324 
325  $this->tms = '';
326  $this->fk_user = '';
327  $this->datep = '';
328  $this->datev = '';
329  $this->amount = '';
330  $this->label = '';
331  $this->datesp = '';
332  $this->dateep = '';
333  $this->note = '';
334  $this->fk_bank = '';
335  $this->fk_user_author = '';
336  $this->fk_user_modif = '';
337  }
338 
345  public function create($user)
346  {
347  global $conf, $langs;
348 
349  $error = 0;
350  $now = dol_now();
351 
352  // Clean parameters
353  $this->amount = price2num(trim($this->amount));
354  $this->label = trim($this->label);
355  $this->note = trim($this->note);
356  $this->fk_bank = trim($this->fk_bank);
357  $this->fk_user_author = trim($this->fk_user_author);
358  $this->fk_user_modif = trim($this->fk_user_modif);
359  $this->accountid = trim($this->accountid);
360  $this->paye = trim($this->paye);
361 
362  // Check parameters
363  if (!$this->label) {
364  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
365  return -3;
366  }
367  if ($this->fk_user < 0 || $this->fk_user == '') {
368  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee"));
369  return -4;
370  }
371  if ($this->amount == '') {
372  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
373  return -5;
374  }
375  /* if (isModEnabled("banque") && (empty($this->accountid) || $this->accountid <= 0))
376  {
377  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
378  return -6;
379  }
380  if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0))
381  {
382  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
383  return -7;
384  }*/
385 
386  $this->db->begin();
387 
388  // Insert into llx_salary
389  $sql = "INSERT INTO ".MAIN_DB_PREFIX."salary (fk_user";
390  //$sql .= ", datep";
391  //$sql .= ", datev";
392  $sql .= ", amount";
393  $sql .= ", fk_projet";
394  $sql .= ", salary";
395  $sql .= ", fk_typepayment";
396  $sql .= ", fk_account";
397  if ($this->note) $sql .= ", note";
398  $sql .= ", label";
399  $sql .= ", datesp";
400  $sql .= ", dateep";
401  $sql .= ", fk_user_author";
402  $sql .= ", datec";
403  $sql .= ", fk_bank";
404  $sql .= ", entity";
405  $sql .= ") ";
406  $sql .= " VALUES (";
407  $sql .= "'".$this->db->escape($this->fk_user)."'";
408  //$sql .= ", '".$this->db->idate($this->datep)."'";
409  //$sql .= ", '".$this->db->idate($this->datev)."'";
410  $sql .= ", ".((double) $this->amount);
411  $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
412  $sql .= ", ".($this->salary > 0 ? ((double) $this->salary) : "null");
413  $sql .= ", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
414  $sql .= ", ".($this->accountid > 0 ? ((int) $this->accountid) : "null");
415  if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
416  $sql .= ", '".$this->db->escape($this->label)."'";
417  $sql .= ", '".$this->db->idate($this->datesp)."'";
418  $sql .= ", '".$this->db->idate($this->dateep)."'";
419  $sql .= ", '".$this->db->escape($user->id)."'";
420  $sql .= ", '".$this->db->idate($now)."'";
421  $sql .= ", NULL";
422  $sql .= ", ".((int) $conf->entity);
423  $sql .= ")";
424 
425  dol_syslog(get_class($this)."::create", LOG_DEBUG);
426  $result = $this->db->query($sql);
427  if ($result) {
428  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salary");
429 
430  if ($this->id > 0) {
431  // Update extrafield
432  if (!$error) {
433  if (!$error) {
434  $result = $this->insertExtraFields();
435  if ($result < 0) {
436  $error++;
437  }
438  }
439  }
440 
441  // Call trigger
442  $result = $this->call_trigger('SALARY_CREATE', $user);
443  if ($result < 0) $error++;
444  // End call triggers
445  } else $error++;
446 
447  if (!$error) {
448  $this->db->commit();
449  return $this->id;
450  } else {
451  $this->db->rollback();
452  return -2;
453  }
454  } else {
455  $this->error = $this->db->error();
456  $this->db->rollback();
457  return -1;
458  }
459  }
460 
461  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
468  public function update_fk_bank($id_bank)
469  {
470  // phpcs:enable
471  $sql = 'UPDATE '.MAIN_DB_PREFIX.'salary SET fk_bank = '.((int) $id_bank);
472  $sql .= " WHERE rowid = ".((int) $this->id);
473  $result = $this->db->query($sql);
474  if ($result) {
475  return 1;
476  } else {
477  dol_print_error($this->db);
478  return -1;
479  }
480  }
481 
482 
493  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
494  {
495  global $db, $conf, $langs, $hookmanager;
496  global $dolibarr_main_authentication, $dolibarr_main_demo;
497  global $menumanager;
498 
499  if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
500 
501  $result = '';
502 
503  $label = '<u>'.$langs->trans("Salary").'</u>';
504  $label .= '<br>';
505  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
506  if ($this->label) {
507  $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
508  }
509  if ($this->datesp && $this->dateep) {
510  $label .= '<br><b>'.$langs->trans('Period').':</b> '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day');
511  }
512  if (isset($this->amount)) {
513  $label .= '<br><b>'.$langs->trans('Amount').':</b> '.price($this->amount);
514  }
515 
516  $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
517 
518  if ($option != 'nolink') {
519  // Add param to save lastsearch_values or not
520  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
521  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
522  if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
523  }
524 
525  $linkclose = '';
526  if (empty($notooltip)) {
527  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
528  $label = $langs->trans("ShowMyObject");
529  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
530  }
531  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
532  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
533 
534  /*
535  $hookmanager->initHooks(array('myobjectdao'));
536  $parameters=array('id'=>$this->id);
537  $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
538  if ($reshook > 0) $linkclose = $hookmanager->resPrint;
539  */
540  } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
541 
542  $linkstart = '<a href="'.$url.'"';
543  $linkstart .= $linkclose.'>';
544  $linkend = '</a>';
545 
546  $result .= $linkstart;
547  if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1);
548  if ($withpicto != 2) $result .= $this->ref;
549  $result .= $linkend;
550  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
551 
552  global $action, $hookmanager;
553  $hookmanager->initHooks(array('salarypayment'));
554  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
555  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
556  if ($reshook > 0) $result = $hookmanager->resPrint;
557  else $result .= $hookmanager->resPrint;
558 
559  return $result;
560  }
561 
567  public function getSommePaiement()
568  {
569  $table = 'payment_salary';
570  $field = 'fk_salary';
571 
572  $sql = 'SELECT sum(amount) as amount';
573  $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
574  $sql .= " WHERE ".$field." = ".((int) $this->id);
575 
576  dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
577  $resql = $this->db->query($sql);
578 
579  if ($resql) {
580  $amount = 0;
581 
582  $obj = $this->db->fetch_object($resql);
583  if ($obj) $amount = $obj->amount ? $obj->amount : 0;
584 
585  $this->db->free($resql);
586  return $amount;
587  } else {
588  return -1;
589  }
590  }
591 
598  public function info($id)
599  {
600  $sql = 'SELECT ps.rowid, ps.datec, ps.tms as datem, ps.fk_user_author, ps.fk_user_modif';
601  $sql .= ' FROM '.MAIN_DB_PREFIX.'salary as ps';
602  $sql .= ' WHERE ps.rowid = '.((int) $id);
603 
604  dol_syslog(get_class($this).'::info', LOG_DEBUG);
605  $result = $this->db->query($sql);
606 
607  if ($result) {
608  if ($this->db->num_rows($result)) {
609  $obj = $this->db->fetch_object($result);
610  $this->id = $obj->rowid;
611 
612  $this->user_creation_id = $obj->fk_user_author;
613  $this->user_modification_id = $obj->fk_user_modif;
614  $this->date_creation = $this->db->jdate($obj->datec);
615  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
616  }
617  $this->db->free($result);
618  } else {
619  dol_print_error($this->db);
620  }
621  }
622 
623  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
630  public function set_paid($user)
631  {
632  // phpcs:enable
633  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
634  $sql .= " paye = 1";
635  $sql .= " WHERE rowid = ".((int) $this->id);
636  $return = $this->db->query($sql);
637  if ($return) return 1;
638  else return -1;
639  }
640 
641  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
648  public function set_unpaid($user)
649  {
650  // phpcs:enable
651  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
652  $sql .= " paye = 0";
653  $sql .= " WHERE rowid = ".((int) $this->id);
654  $return = $this->db->query($sql);
655  if ($return) return 1;
656  else return -1;
657  }
658 
659 
667  public function getLibStatut($mode = 0, $alreadypaid = -1)
668  {
669  return $this->LibStatut($this->paye, $mode, $alreadypaid);
670  }
671 
672  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
681  public function LibStatut($status, $mode = 0, $alreadypaid = -1)
682  {
683  // phpcs:enable
684  global $langs;
685 
686  // Load translation files required by the page
687  $langs->loadLangs(array("customers", "bills"));
688 
689  // We reinit status array to force to redefine them because label may change according to properties values.
690  $this->labelStatus = array();
691  $this->labelStatusShort = array();
692 
693  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
694  global $langs;
695  //$langs->load("mymodule");
696  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
697  $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
698  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
699  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
700  $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
701  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
702  }
703 
704  $statusType = 'status1';
705  if ($status == 0 && $alreadypaid <> 0) $statusType = 'status3';
706  if ($status == 1) $statusType = 'status6';
707 
708  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
709  }
710 }
$object ref
Definition: info.php:78
Parent class of all other business classes (invoices, contracts, proposals, orders,...
fetch_optionals($rowid=null, $optionsArray=null)
Function to get extra fields of an object into $this->array_options This method is in most cases call...
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage salary payments.
fetch($id, $user=null)
Load object in memory from database.
initAsSpecimen()
Initialise an instance with random values.
update($user=null, $notrigger=0)
Update database.
update_fk_bank($id_bank)
Update link between payment salary and line generate into llx_bank.
LibStatut($status, $mode=0, $alreadypaid=-1)
Renvoi le libelle d'un statut donne.
set_paid($user)
Tag social contribution as payed completely.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Send name clicable (with possibly the picto)
set_unpaid($user)
Remove tag payed on social contribution.
create($user)
Create in database.
getLibStatut($mode=0, $alreadypaid=-1)
Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
$paye
1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
info($id)
Information on record.
__construct($db)
Constructor.
getSommePaiement()
Return amount of payments already done.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
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.
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.
Definition: inc.php:41