dolibarr  18.0.0-beta
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  global $conf, $langs;
152 
153  $error = 0;
154 
155  // Clean parameters
156  $this->amount = trim($this->amount);
157  $this->label = trim($this->label);
158  $this->note = trim($this->note);
159 
160  // Check parameters
161  if (empty($this->fk_user) || $this->fk_user < 0) {
162  $this->error = 'ErrorBadParameter';
163  return -1;
164  }
165 
166  $this->db->begin();
167 
168  // Update request
169  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
170  $sql .= " tms='".$this->db->idate(dol_now())."',";
171  $sql .= " fk_user=".((int) $this->fk_user).",";
172  /*$sql .= " datep='".$this->db->idate($this->datep)."',";
173  $sql .= " datev='".$this->db->idate($this->datev)."',";*/
174  $sql .= " amount=".price2num($this->amount).",";
175  $sql .= " fk_projet=".((int) $this->fk_project).",";
176  $sql .= " fk_typepayment=".((int) $this->type_payment).",";
177  $sql .= " label='".$this->db->escape($this->label)."',";
178  $sql .= " datesp='".$this->db->idate($this->datesp)."',";
179  $sql .= " dateep='".$this->db->idate($this->dateep)."',";
180  $sql .= " note='".$this->db->escape($this->note)."',";
181  $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").",";
182  $sql .= " fk_user_author=".((int) $this->fk_user_author).",";
183  $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
184  $sql .= " WHERE rowid=".((int) $this->id);
185 
186  dol_syslog(get_class($this)."::update", LOG_DEBUG);
187  $resql = $this->db->query($sql);
188  if (!$resql) {
189  $this->error = "Error ".$this->db->lasterror();
190  return -1;
191  }
192 
193  // Update extrafield
194  if (!$error) {
195  if (!$error) {
196  $result = $this->insertExtraFields();
197  if ($result < 0) {
198  $error++;
199  }
200  }
201  }
202 
203  if (!$notrigger) {
204  // Call trigger
205  $result = $this->call_trigger('SALARY_MODIFY', $user);
206  if ($result < 0) $error++;
207  // End call triggers
208  }
209 
210  if (!$error) {
211  $this->db->commit();
212  return 1;
213  } else {
214  $this->db->rollback();
215  return -1;
216  }
217  }
218 
219 
227  public function fetch($id, $user = null)
228  {
229  global $langs;
230  $sql = "SELECT";
231  $sql .= " s.rowid,";
232 
233  $sql .= " s.tms,";
234  $sql .= " s.fk_user,";
235  $sql .= " s.datep,";
236  $sql .= " s.datev,";
237  $sql .= " s.amount,";
238  $sql .= " s.fk_projet as fk_project,";
239  $sql .= " s.fk_typepayment,";
240  $sql .= " s.label,";
241  $sql .= " s.datesp,";
242  $sql .= " s.dateep,";
243  $sql .= " s.note,";
244  $sql .= " s.paye,";
245  $sql .= " s.fk_bank,";
246  $sql .= " s.fk_user_author,";
247  $sql .= " s.fk_user_modif,";
248  $sql .= " s.fk_account";
249 
250  $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
251  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
252  $sql .= " WHERE s.rowid = ".((int) $id);
253 
254  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
255  $resql = $this->db->query($sql);
256  if ($resql) {
257  if ($this->db->num_rows($resql)) {
258  $obj = $this->db->fetch_object($resql);
259 
260  $this->id = $obj->rowid;
261  $this->ref = $obj->rowid;
262  $this->tms = $this->db->jdate($obj->tms);
263  $this->fk_user = $obj->fk_user;
264  $this->datep = $this->db->jdate($obj->datep);
265  $this->datev = $this->db->jdate($obj->datev);
266  $this->amount = $obj->amount;
267  $this->fk_project = $obj->fk_project;
268  $this->type_payment = $obj->fk_typepayment;
269  $this->label = $obj->label;
270  $this->datesp = $this->db->jdate($obj->datesp);
271  $this->dateep = $this->db->jdate($obj->dateep);
272  $this->note = $obj->note;
273  $this->paye = $obj->paye;
274  $this->fk_bank = $obj->fk_bank;
275  $this->fk_user_author = $obj->fk_user_author;
276  $this->fk_user_modif = $obj->fk_user_modif;
277  $this->fk_account = $obj->fk_account;
278  $this->accountid = $obj->fk_account;
279 
280  // Retrieve all extrafield
281  // fetch optionals attributes and labels
282  $this->fetch_optionals();
283  }
284  $this->db->free($resql);
285 
286  return 1;
287  } else {
288  $this->error = "Error ".$this->db->lasterror();
289  return -1;
290  }
291  }
292 
293 
301  public function delete($user, $notrigger = 0)
302  {
303  return $this->deleteCommon($user, $notrigger);
304  }
305 
306 
314  public function initAsSpecimen()
315  {
316  $this->id = 0;
317 
318  $this->tms = '';
319  $this->fk_user = '';
320  $this->datep = '';
321  $this->datev = '';
322  $this->amount = '';
323  $this->label = '';
324  $this->datesp = '';
325  $this->dateep = '';
326  $this->note = '';
327  $this->fk_bank = '';
328  $this->fk_user_author = '';
329  $this->fk_user_modif = '';
330  }
331 
338  public function create($user)
339  {
340  global $conf, $langs;
341 
342  $error = 0;
343  $now = dol_now();
344 
345  // Clean parameters
346  $this->amount = price2num(trim($this->amount));
347  $this->label = trim($this->label);
348  $this->note = trim($this->note);
349  $this->fk_bank = trim($this->fk_bank);
350  $this->fk_user_author = trim($this->fk_user_author);
351  $this->fk_user_modif = trim($this->fk_user_modif);
352  $this->accountid = trim($this->accountid);
353  $this->paye = trim($this->paye);
354 
355  // Check parameters
356  if (!$this->label) {
357  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
358  return -3;
359  }
360  if ($this->fk_user < 0 || $this->fk_user == '') {
361  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Employee"));
362  return -4;
363  }
364  if ($this->amount == '') {
365  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
366  return -5;
367  }
368  /* if (isModEnabled("banque") && (empty($this->accountid) || $this->accountid <= 0))
369  {
370  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account"));
371  return -6;
372  }
373  if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0))
374  {
375  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
376  return -7;
377  }*/
378 
379  $this->db->begin();
380 
381  // Insert into llx_salary
382  $sql = "INSERT INTO ".MAIN_DB_PREFIX."salary (fk_user";
383  //$sql .= ", datep";
384  //$sql .= ", datev";
385  $sql .= ", amount";
386  $sql .= ", fk_projet";
387  $sql .= ", salary";
388  $sql .= ", fk_typepayment";
389  $sql .= ", fk_account";
390  if ($this->note) $sql .= ", note";
391  $sql .= ", label";
392  $sql .= ", datesp";
393  $sql .= ", dateep";
394  $sql .= ", fk_user_author";
395  $sql .= ", datec";
396  $sql .= ", fk_bank";
397  $sql .= ", entity";
398  $sql .= ") ";
399  $sql .= " VALUES (";
400  $sql .= "'".$this->db->escape($this->fk_user)."'";
401  //$sql .= ", '".$this->db->idate($this->datep)."'";
402  //$sql .= ", '".$this->db->idate($this->datev)."'";
403  $sql .= ", ".((double) $this->amount);
404  $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
405  $sql .= ", ".($this->salary > 0 ? ((double) $this->salary) : "null");
406  $sql .= ", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
407  $sql .= ", ".($this->accountid > 0 ? ((int) $this->accountid) : "null");
408  if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
409  $sql .= ", '".$this->db->escape($this->label)."'";
410  $sql .= ", '".$this->db->idate($this->datesp)."'";
411  $sql .= ", '".$this->db->idate($this->dateep)."'";
412  $sql .= ", '".$this->db->escape($user->id)."'";
413  $sql .= ", '".$this->db->idate($now)."'";
414  $sql .= ", NULL";
415  $sql .= ", ".((int) $conf->entity);
416  $sql .= ")";
417 
418  dol_syslog(get_class($this)."::create", LOG_DEBUG);
419  $result = $this->db->query($sql);
420  if ($result) {
421  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salary");
422 
423  if ($this->id > 0) {
424  // Update extrafield
425  if (!$error) {
426  if (!$error) {
427  $result = $this->insertExtraFields();
428  if ($result < 0) {
429  $error++;
430  }
431  }
432  }
433 
434  // Call trigger
435  $result = $this->call_trigger('SALARY_CREATE', $user);
436  if ($result < 0) $error++;
437  // End call triggers
438  } else $error++;
439 
440  if (!$error) {
441  $this->db->commit();
442  return $this->id;
443  } else {
444  $this->db->rollback();
445  return -2;
446  }
447  } else {
448  $this->error = $this->db->error();
449  $this->db->rollback();
450  return -1;
451  }
452  }
453 
454  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
461  public function update_fk_bank($id_bank)
462  {
463  // phpcs:enable
464  $sql = 'UPDATE '.MAIN_DB_PREFIX.'salary SET fk_bank = '.((int) $id_bank);
465  $sql .= " WHERE rowid = ".((int) $this->id);
466  $result = $this->db->query($sql);
467  if ($result) {
468  return 1;
469  } else {
470  dol_print_error($this->db);
471  return -1;
472  }
473  }
474 
481  public function getTooltipContentArray($params)
482  {
483  global $conf, $langs, $user;
484 
485  $langs->loadLangs(['salaries']);
486 
487  $datas = [];
488  $option = $params['option'] ?? '';
489  $datas['picto'] = '<u>'.$langs->trans("Salary").'</u>';
490  $datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
491 
492  return $datas;
493  }
494 
505  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
506  {
507  global $db, $conf, $langs, $hookmanager;
508  global $dolibarr_main_authentication, $dolibarr_main_demo;
509  global $menumanager;
510 
511  if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
512 
513  $result = '';
514  $params = [
515  'id' => $this->id,
516  'objecttype' => $this->element,
517  'option' => $option,
518  ];
519  $classfortooltip = 'classfortooltip';
520  $dataparams = '';
521  if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
522  $classfortooltip = 'classforajaxtooltip';
523  $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
524  $label = '';
525  } else {
526  $label = implode($this->getTooltipContentArray($params));
527  }
528 
529  $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id;
530 
531  if ($option != 'nolink') {
532  // Add param to save lastsearch_values or not
533  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
534  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
535  $add_save_lastsearch_values = 1;
536  }
537  if ($add_save_lastsearch_values) {
538  $url .= '&save_lastsearch_values=1';
539  }
540  }
541 
542  $linkclose = '';
543  if (empty($notooltip)) {
544  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
545  $label = $langs->trans("ShowMyObject");
546  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
547  }
548  $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
549  $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
550  } else {
551  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
552  }
553 
554  $linkstart = '<a href="'.$url.'"';
555  $linkstart .= $linkclose.'>';
556  $linkend = '</a>';
557 
558  $result .= $linkstart;
559  if ($withpicto) {
560  $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);
561  }
562  if ($withpicto != 2) {
563  $result .= $this->ref;
564  }
565  $result .= $linkend;
566  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
567 
568  global $action, $hookmanager;
569  $hookmanager->initHooks(array('salarypayment'));
570  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
571  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
572  if ($reshook > 0) $result = $hookmanager->resPrint;
573  else $result .= $hookmanager->resPrint;
574 
575  return $result;
576  }
577 
583  public function getSommePaiement()
584  {
585  $table = 'payment_salary';
586  $field = 'fk_salary';
587 
588  $sql = "SELECT sum(amount) as amount";
589  $sql .= " FROM ".MAIN_DB_PREFIX.$table;
590  $sql .= " WHERE ".$field." = ".((int) $this->id);
591 
592  dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
593  $resql = $this->db->query($sql);
594 
595  if ($resql) {
596  $amount = 0;
597 
598  $obj = $this->db->fetch_object($resql);
599  if ($obj) $amount = $obj->amount ? $obj->amount : 0;
600 
601  $this->db->free($resql);
602  return $amount;
603  } else {
604  return -1;
605  }
606  }
607 
614  public function info($id)
615  {
616  $sql = 'SELECT ps.rowid, ps.datec, ps.tms as datem, ps.fk_user_author, ps.fk_user_modif';
617  $sql .= ' FROM '.MAIN_DB_PREFIX.'salary as ps';
618  $sql .= ' WHERE ps.rowid = '.((int) $id);
619 
620  dol_syslog(get_class($this).'::info', LOG_DEBUG);
621  $result = $this->db->query($sql);
622 
623  if ($result) {
624  if ($this->db->num_rows($result)) {
625  $obj = $this->db->fetch_object($result);
626  $this->id = $obj->rowid;
627 
628  $this->user_creation_id = $obj->fk_user_author;
629  $this->user_modification_id = $obj->fk_user_modif;
630  $this->date_creation = $this->db->jdate($obj->datec);
631  $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
632  }
633  $this->db->free($result);
634  } else {
635  dol_print_error($this->db);
636  }
637  }
638 
639  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
646  public function set_paid($user)
647  {
648  // phpcs:enable
649  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
650  $sql .= " paye = 1";
651  $sql .= " WHERE rowid = ".((int) $this->id);
652  $return = $this->db->query($sql);
653  if ($return) return 1;
654  else return -1;
655  }
656 
657  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
664  public function set_unpaid($user)
665  {
666  // phpcs:enable
667  $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET";
668  $sql .= " paye = 0";
669  $sql .= " WHERE rowid = ".((int) $this->id);
670  $return = $this->db->query($sql);
671  if ($return) return 1;
672  else return -1;
673  }
674 
675 
683  public function getLibStatut($mode = 0, $alreadypaid = -1)
684  {
685  return $this->LibStatut($this->paye, $mode, $alreadypaid);
686  }
687 
688  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
697  public function LibStatut($status, $mode = 0, $alreadypaid = -1)
698  {
699  // phpcs:enable
700  global $langs;
701 
702  // Load translation files required by the page
703  $langs->loadLangs(array("customers", "bills"));
704 
705  // We reinit status array to force to redefine them because label may change according to properties values.
706  $this->labelStatus = array();
707  $this->labelStatusShort = array();
708 
709  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
710  global $langs;
711  //$langs->load("mymodule");
712  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
713  $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
714  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
715  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('BillStatusNotPaid');
716  $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('BillStatusPaid');
717  if ($status == self::STATUS_UNPAID && $alreadypaid <> 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
718  }
719 
720  $statusType = 'status1';
721  if ($status == 0 && $alreadypaid <> 0) $statusType = 'status3';
722  if ($status == 1) $statusType = 'status6';
723 
724  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
725  }
726 
734  public function getKanbanView($option = '', $arraydata = null)
735  {
736  global $langs;
737 
738  $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
739 
740  $return = '<div class="box-flex-item box-flex-grow-zero">';
741  $return .= '<div class="info-box info-box-sm">';
742  $return .= '<span class="info-box-icon bg-infobox-action">';
743  $return .= img_picto('', $this->picto);
744  $return .= '</span>';
745  $return .= '<div class="info-box-content">';
746  $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
747  $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
748  if (!empty($arraydata['user']) && is_object($arraydata['user'])) {
749  $return .= '<br><span class="info-box-label">'.$arraydata['user']->getNomUrl(1, '', 0, 0, 16, 0, '', 'maxwidth100').'</span>';
750  }
751  if (property_exists($this, 'amount')) {
752  $return .= '<br><span class="info-box-label amount">'.price($this->amount).'</span>';
753  if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
754  $return .= ' <span class="info-box-label opacitymedium small">';
755  if ($langs->trans("PaymentTypeShort".$this->type_payment) != "PaymentTypeShort".$this->type_payment) {
756  $return .= $langs->trans("PaymentTypeShort".$this->type_payment);
757  } elseif ($langs->trans("PaymentType".$this->type_payment) != "PaymentType".$this->type_payment) {
758  $return .= $langs->trans("PaymentType".$this->type_payment);
759  }
760  $return .= '</span>';
761  }
762  }
763  if (method_exists($this, 'LibStatut')) {
764  $return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3, $this->alreadypaid).'</div>';
765  }
766  $return .= '</div>';
767  $return .= '</div>';
768  $return .= '</div>';
769  return $return;
770  }
771 }
CommonObject\deleteCommon
deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0)
Delete object in database.
Definition: commonobject.class.php:9539
Salary\getKanbanView
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
Definition: salary.class.php:734
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:5096
Salary\getTooltipContentArray
getTooltipContentArray($params)
getTooltipContentArray
Definition: salary.class.php:481
Salary\set_paid
set_paid($user)
Tag social contribution as payed completely.
Definition: salary.class.php:646
Salary\getSommePaiement
getSommePaiement()
Return amount of payments already done.
Definition: salary.class.php:583
CommonObject
Parent class of all other business classes (invoices, contracts, proposals, orders,...
Definition: commonobject.class.php:45
Salary\update
update($user=null, $notrigger=0)
Update database.
Definition: salary.class.php:149
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5943
Salary\$paye
$paye
1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code)
Definition: salary.class.php:124
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4125
Salary\initAsSpecimen
initAsSpecimen()
Initialise an instance with random values.
Definition: salary.class.php:314
Salary\update_fk_bank
update_fk_bank($id_bank)
Update link between payment salary and line generate into llx_bank.
Definition: salary.class.php:461
CommonObject\insertExtraFields
insertExtraFields($trigger='', $userused=null)
Add/Update all extra fields values for the current object.
Definition: commonobject.class.php:6110
$sql
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') && $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
Salary\getNomUrl
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Send name clicable (with possibly the picto)
Definition: salary.class.php:505
Salary\create
create($user)
Create in database.
Definition: salary.class.php:338
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1732
Salary\info
info($id)
Information on record.
Definition: salary.class.php:614
Salary\set_unpaid
set_unpaid($user)
Remove tag payed on social contribution.
Definition: salary.class.php:664
CommonObject\fetch_optionals
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...
Definition: commonobject.class.php:5959
ref
$object ref
Definition: info.php:78
Salary\LibStatut
LibStatut($status, $mode=0, $alreadypaid=-1)
Return label of a given status.
Definition: salary.class.php:697
dolGetStatus
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
Definition: functions.lib.php:10932
Salary\__construct
__construct($db)
Constructor.
Definition: salary.class.php:135
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:4462
Salary
Class to manage salary payments.
Definition: salary.class.php:33
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:3046
CommonObject\call_trigger
call_trigger($triggerName, $user)
Call trigger based on this instance.
Definition: commonobject.class.php:5743
Salary\getLibStatut
getLibStatut($mode=0, $alreadypaid=-1)
Return label of current status.
Definition: salary.class.php:683
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
Salary\fetch
fetch($id, $user=null)
Load object in memory from database.
Definition: salary.class.php:227