dolibarr  18.0.0
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 
52  // /**
53  // * @var array List of child tables. To test if we can delete object.
54  // */
55  protected $childtables = array('payment_salary' => array('name'=>'SalaryPayment', 'fk_element'=>'fk_salary'));
56 
57  // /**
58  // * @var array List of child tables. To know object to delete on cascade.
59  // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
60  // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
61  // */
62  //protected $childtablesoncascade = array('mymodule_myobjectdet');
63 
64 
68  public $fk_user;
69 
70  public $datep;
71  public $datev;
72 
73  public $salary;
74  public $amount;
78  public $fk_project;
79 
80  public $type_payment;
81 
85  public $label;
86 
87  public $datesp;
88  public $dateep;
89 
93  public $fk_bank;
94 
99  public $fk_account;
100 
104  public $accountid;
105 
109  public $fk_user_author;
110 
114  public $fk_user_modif;
115 
119  public $user;
120 
124  public $paye;
125 
126  const STATUS_UNPAID = 0;
127  const STATUS_PAID = 1;
128 
129 
135  public function __construct($db)
136  {
137  $this->db = $db;
138  $this->element = 'salary';
139  $this->table_element = 'salary';
140  }
141 
149  public function update($user = null, $notrigger = 0)
150  {
151  $error = 0;
152 
153  // Clean parameters
154  $this->amount = trim($this->amount);
155  $this->label = trim($this->label);
156  $this->note = trim($this->note);
157 
158  // Check parameters
159  if (empty($this->fk_user) || $this->fk_user < 0) {
160  $this->error = 'ErrorBadParameter';
161  return -1;
162  }
163 
164  $this->db->begin();
165 
166  // Update request
167  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
168  $sql .= " tms='".$this->db->idate(dol_now())."',";
169  $sql .= " fk_user=".((int) $this->fk_user).",";
170  /*$sql .= " datep='".$this->db->idate($this->datep)."',";
171  $sql .= " datev='".$this->db->idate($this->datev)."',";*/
172  $sql .= " amount=".price2num($this->amount).",";
173  $sql .= " fk_projet=".((int) $this->fk_project).",";
174  $sql .= " fk_typepayment=".((int) $this->type_payment).",";
175  $sql .= " label='".$this->db->escape($this->label)."',";
176  $sql .= " datesp='".$this->db->idate($this->datesp)."',";
177  $sql .= " dateep='".$this->db->idate($this->dateep)."',";
178  $sql .= " note='".$this->db->escape($this->note)."',";
179  $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").",";
180  $sql .= " fk_user_author=".((int) $this->fk_user_author).",";
181  $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
182  $sql .= " WHERE rowid=".((int) $this->id);
183 
184  dol_syslog(get_class($this)."::update", LOG_DEBUG);
185  $resql = $this->db->query($sql);
186  if (!$resql) {
187  $this->error = "Error ".$this->db->lasterror();
188  return -1;
189  }
190 
191  // Update extrafield
192  if (!$error) {
193  if (!$error) {
194  $result = $this->insertExtraFields();
195  if ($result < 0) {
196  $error++;
197  }
198  }
199  }
200 
201  if (!$notrigger) {
202  // Call trigger
203  $result = $this->call_trigger('SALARY_MODIFY', $user);
204  if ($result < 0) $error++;
205  // End call triggers
206  }
207 
208  if (!$error) {
209  $this->db->commit();
210  return 1;
211  } else {
212  $this->db->rollback();
213  return -1;
214  }
215  }
216 
217 
225  public function fetch($id, $user = null)
226  {
227  $sql = "SELECT";
228  $sql .= " s.rowid,";
229  $sql .= " s.tms,";
230  $sql .= " s.fk_user,";
231  $sql .= " s.datep,";
232  $sql .= " s.datev,";
233  $sql .= " s.amount,";
234  $sql .= " s.fk_projet as fk_project,";
235  $sql .= " s.fk_typepayment,";
236  $sql .= " s.label,";
237  $sql .= " s.datesp,";
238  $sql .= " s.dateep,";
239  $sql .= " s.note,";
240  $sql .= " s.paye,";
241  $sql .= " s.fk_bank,";
242  $sql .= " s.fk_user_author,";
243  $sql .= " s.fk_user_modif,";
244  $sql .= " s.fk_account";
245  $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
246  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
247  $sql .= " WHERE s.rowid = ".((int) $id);
248 
249  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
250  $resql = $this->db->query($sql);
251  if ($resql) {
252  if ($this->db->num_rows($resql)) {
253  $obj = $this->db->fetch_object($resql);
254 
255  $this->id = $obj->rowid;
256  $this->ref = $obj->rowid;
257  $this->tms = $this->db->jdate($obj->tms);
258  $this->fk_user = $obj->fk_user;
259  $this->datep = $this->db->jdate($obj->datep);
260  $this->datev = $this->db->jdate($obj->datev);
261  $this->amount = $obj->amount;
262  $this->fk_project = $obj->fk_project;
263  $this->type_payment = $obj->fk_typepayment;
264  $this->label = $obj->label;
265  $this->datesp = $this->db->jdate($obj->datesp);
266  $this->dateep = $this->db->jdate($obj->dateep);
267  $this->note = $obj->note;
268  $this->paye = $obj->paye;
269  $this->fk_bank = $obj->fk_bank;
270  $this->fk_user_author = $obj->fk_user_author;
271  $this->fk_user_modif = $obj->fk_user_modif;
272  $this->fk_account = $obj->fk_account;
273  $this->accountid = $obj->fk_account;
274 
275  // Retrieve all extrafield
276  // fetch optionals attributes and labels
277  $this->fetch_optionals();
278  }
279  $this->db->free($resql);
280 
281  return 1;
282  } else {
283  $this->error = "Error ".$this->db->lasterror();
284  return -1;
285  }
286  }
287 
288 
296  public function delete($user, $notrigger = 0)
297  {
298  return $this->deleteCommon($user, $notrigger);
299  }
300 
301 
309  public function initAsSpecimen()
310  {
311  $this->id = 0;
312 
313  $this->tms = '';
314  $this->fk_user = '';
315  $this->datep = '';
316  $this->datev = '';
317  $this->amount = '';
318  $this->label = '';
319  $this->datesp = '';
320  $this->dateep = '';
321  $this->note = '';
322  $this->fk_bank = '';
323  $this->fk_user_author = '';
324  $this->fk_user_modif = '';
325  }
326 
333  public function create($user)
334  {
335  global $conf, $langs;
336 
337  $error = 0;
338  $now = dol_now();
339 
340  // Clean parameters
341  $this->amount = price2num(trim($this->amount));
342  $this->label = trim($this->label);
343  $this->note = trim($this->note);
344  $this->fk_bank = trim($this->fk_bank);
345  $this->fk_user_author = trim($this->fk_user_author);
346  $this->fk_user_modif = trim($this->fk_user_modif);
347  $this->accountid = trim($this->accountid);
348  $this->paye = trim($this->paye);
349 
350  // Check parameters
351  if (!$this->label) {
352  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
353  return -3;
354  }
355  if ($this->fk_user < 0 || $this->fk_user == '') {
356  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee"));
357  return -4;
358  }
359  if ($this->amount == '') {
360  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
361  return -5;
362  }
363  /* if (isModEnabled("banque") && (empty($this->accountid) || $this->accountid <= 0))
364  {
365  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
366  return -6;
367  }
368  if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0))
369  {
370  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
371  return -7;
372  }*/
373 
374  $this->db->begin();
375 
376  // Insert into llx_salary
377  $sql = "INSERT INTO ".MAIN_DB_PREFIX."salary (fk_user";
378  //$sql .= ", datep";
379  //$sql .= ", datev";
380  $sql .= ", amount";
381  $sql .= ", fk_projet";
382  $sql .= ", salary";
383  $sql .= ", fk_typepayment";
384  $sql .= ", fk_account";
385  if ($this->note) $sql .= ", note";
386  $sql .= ", label";
387  $sql .= ", datesp";
388  $sql .= ", dateep";
389  $sql .= ", fk_user_author";
390  $sql .= ", datec";
391  $sql .= ", fk_bank";
392  $sql .= ", entity";
393  $sql .= ") ";
394  $sql .= " VALUES (";
395  $sql .= "'".$this->db->escape($this->fk_user)."'";
396  //$sql .= ", '".$this->db->idate($this->datep)."'";
397  //$sql .= ", '".$this->db->idate($this->datev)."'";
398  $sql .= ", ".((double) $this->amount);
399  $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
400  $sql .= ", ".($this->salary > 0 ? ((double) $this->salary) : "null");
401  $sql .= ", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
402  $sql .= ", ".($this->accountid > 0 ? ((int) $this->accountid) : "null");
403  if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
404  $sql .= ", '".$this->db->escape($this->label)."'";
405  $sql .= ", '".$this->db->idate($this->datesp)."'";
406  $sql .= ", '".$this->db->idate($this->dateep)."'";
407  $sql .= ", '".$this->db->escape($user->id)."'";
408  $sql .= ", '".$this->db->idate($now)."'";
409  $sql .= ", NULL";
410  $sql .= ", ".((int) $conf->entity);
411  $sql .= ")";
412 
413  dol_syslog(get_class($this)."::create", LOG_DEBUG);
414  $result = $this->db->query($sql);
415  if ($result) {
416  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salary");
417 
418  if ($this->id > 0) {
419  // Update extrafield
420  if (!$error) {
421  if (!$error) {
422  $result = $this->insertExtraFields();
423  if ($result < 0) {
424  $error++;
425  }
426  }
427  }
428 
429  // Call trigger
430  $result = $this->call_trigger('SALARY_CREATE', $user);
431  if ($result < 0) $error++;
432  // End call triggers
433  } else $error++;
434 
435  if (!$error) {
436  $this->db->commit();
437  return $this->id;
438  } else {
439  $this->db->rollback();
440  return -2;
441  }
442  } else {
443  $this->error = $this->db->error();
444  $this->db->rollback();
445  return -1;
446  }
447  }
448 
449  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
456  public function update_fk_bank($id_bank)
457  {
458  // phpcs:enable
459  $sql = 'UPDATE '.MAIN_DB_PREFIX.'salary SET fk_bank = '.((int) $id_bank);
460  $sql .= " WHERE rowid = ".((int) $this->id);
461  $result = $this->db->query($sql);
462  if ($result) {
463  return 1;
464  } else {
465  dol_print_error($this->db);
466  return -1;
467  }
468  }
469 
476  public function getTooltipContentArray($params)
477  {
478  global $conf, $langs, $user;
479 
480  $langs->loadLangs(['salaries']);
481 
482  $datas = [];
483  $option = $params['option'] ?? '';
484  $datas['picto'] = '<u>'.$langs->trans("Salary").'</u>';
485  $datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
486 
487  return $datas;
488  }
489 
500  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
501  {
502  global $db, $conf, $langs, $hookmanager;
503  global $dolibarr_main_authentication, $dolibarr_main_demo;
504  global $menumanager;
505 
506  if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
507 
508  $result = '';
509  $params = [
510  'id' => $this->id,
511  'objecttype' => $this->element,
512  'option' => $option,
513  ];
514  $classfortooltip = 'classfortooltip';
515  $dataparams = '';
516  if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
517  $classfortooltip = 'classforajaxtooltip';
518  $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
519  $label = '';
520  } else {
521  $label = implode($this->getTooltipContentArray($params));
522  }
523 
524  $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
525 
526  if ($option != 'nolink') {
527  // Add param to save lastsearch_values or not
528  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
529  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
530  $add_save_lastsearch_values = 1;
531  }
532  if ($add_save_lastsearch_values) {
533  $url .= '&save_lastsearch_values=1';
534  }
535  }
536 
537  $linkclose = '';
538  if (empty($notooltip)) {
539  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
540  $label = $langs->trans("ShowMyObject");
541  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
542  }
543  $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
544  $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
545  } else {
546  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
547  }
548 
549  $linkstart = '<a href="'.$url.'"';
550  $linkstart .= $linkclose.'>';
551  $linkend = '</a>';
552 
553  $result .= $linkstart;
554  if ($withpicto) {
555  $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.' pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1);
556  }
557  if ($withpicto != 2) {
558  $result .= $this->ref;
559  }
560  $result .= $linkend;
561  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
562 
563  global $action, $hookmanager;
564  $hookmanager->initHooks(array('salarypayment'));
565  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
566  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
567  if ($reshook > 0) $result = $hookmanager->resPrint;
568  else $result .= $hookmanager->resPrint;
569 
570  return $result;
571  }
572 
578  public function getSommePaiement()
579  {
580  $table = 'payment_salary';
581  $field = 'fk_salary';
582 
583  $sql = "SELECT sum(amount) as amount";
584  $sql .= " FROM ".MAIN_DB_PREFIX.$table;
585  $sql .= " WHERE ".$field." = ".((int) $this->id);
586 
587  dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
588  $resql = $this->db->query($sql);
589 
590  if ($resql) {
591  $amount = 0;
592 
593  $obj = $this->db->fetch_object($resql);
594  if ($obj) $amount = $obj->amount ? $obj->amount : 0;
595 
596  $this->db->free($resql);
597  return $amount;
598  } else {
599  return -1;
600  }
601  }
602 
609  public function info($id)
610  {
611  $sql = 'SELECT ps.rowid, ps.datec, ps.tms as datem, ps.fk_user_author, ps.fk_user_modif';
612  $sql .= ' FROM '.MAIN_DB_PREFIX.'salary as ps';
613  $sql .= ' WHERE ps.rowid = '.((int) $id);
614 
615  dol_syslog(get_class($this).'::info', LOG_DEBUG);
616  $result = $this->db->query($sql);
617 
618  if ($result) {
619  if ($this->db->num_rows($result)) {
620  $obj = $this->db->fetch_object($result);
621  $this->id = $obj->rowid;
622 
623  $this->user_creation_id = $obj->fk_user_author;
624  $this->user_modification_id = $obj->fk_user_modif;
625  $this->date_creation = $this->db->jdate($obj->datec);
626  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
627  }
628  $this->db->free($result);
629  } else {
630  dol_print_error($this->db);
631  }
632  }
633 
634  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
641  public function set_paid($user)
642  {
643  // phpcs:enable
644  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
645  $sql .= " paye = 1";
646  $sql .= " WHERE rowid = ".((int) $this->id);
647 
648  $return = $this->db->query($sql);
649 
650  if ($return) {
651  $this->paye = 1;
652  return 1;
653  } else {
654  return -1;
655  }
656  }
657 
658  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
665  public function set_unpaid($user)
666  {
667  // phpcs:enable
668  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
669  $sql .= " paye = 0";
670  $sql .= " WHERE rowid = ".((int) $this->id);
671 
672  $return = $this->db->query($sql);
673 
674  if ($return) {
675  $this->paye = 0;
676  return 1;
677  } else {
678  return -1;
679  }
680  }
681 
682 
690  public function getLibStatut($mode = 0, $alreadypaid = -1)
691  {
692  return $this->LibStatut($this->paye, $mode, $alreadypaid);
693  }
694 
695  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
704  public function LibStatut($status, $mode = 0, $alreadypaid = -1)
705  {
706  // phpcs:enable
707  global $langs;
708 
709  // Load translation files required by the page
710  $langs->loadLangs(array("customers", "bills"));
711 
712  // We reinit status array to force to redefine them because label may change according to properties values.
713  $this->labelStatus = array();
714  $this->labelStatusShort = array();
715 
716  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
717  global $langs;
718  //$langs->load("mymodule");
719  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
720  $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
721  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
722  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
723  $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
724  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
725  }
726 
727  $statusType = 'status1';
728  if ($status == 0 && $alreadypaid <> 0) $statusType = 'status3';
729  if ($status == 1) $statusType = 'status6';
730 
731  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
732  }
733 
741  public function getKanbanView($option = '', $arraydata = null)
742  {
743  global $langs;
744 
745  $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
746 
747  $return = '<div class="box-flex-item box-flex-grow-zero">';
748  $return .= '<div class="info-box info-box-sm">';
749  $return .= '<span class="info-box-icon bg-infobox-action">';
750  $return .= img_picto('', $this->picto);
751  $return .= '</span>';
752  $return .= '<div class="info-box-content">';
753  $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
754  $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
755  if (!empty($arraydata['user']) && is_object($arraydata['user'])) {
756  $return .= '<br><span class="info-box-label">'.$arraydata['user']->getNomUrl(1, '', 0, 0, 16, 0, '', 'maxwidth100').'</span>';
757  }
758  if (property_exists($this, 'amount')) {
759  $return .= '<br><span class="info-box-label amount">'.price($this->amount).'</span>';
760  if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
761  $return .= ' <span class="info-box-label opacitymedium small">';
762  if ($langs->trans("PaymentTypeShort".$this->type_payment) != "PaymentTypeShort".$this->type_payment) {
763  $return .= $langs->trans("PaymentTypeShort".$this->type_payment);
764  } elseif ($langs->trans("PaymentType".$this->type_payment) != "PaymentType".$this->type_payment) {
765  $return .= $langs->trans("PaymentType".$this->type_payment);
766  }
767  $return .= '</span>';
768  }
769  }
770  if (method_exists($this, 'LibStatut')) {
771  $return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
772  }
773  $return .= '</div>';
774  $return .= '</div>';
775  $return .= '</div>';
776  return $return;
777  }
778 }
$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...
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
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.
getTooltipContentArray($params)
getTooltipContentArray
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
update_fk_bank($id_bank)
Update link between payment salary and line generate into llx_bank.
LibStatut($status, $mode=0, $alreadypaid=-1)
Return label of a given status.
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)
Return label of current status.
$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') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
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)
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.