29require_once DOL_DOCUMENT_ROOT.
'/core/class/commonobject.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/modules/salaries/modules_salary.php';
41 public $element =
'salary';
51 public $table_element =
'salary';
56 public $module =
'salaries';
61 public $picto =
'salary';
66 protected $childtables = array(
'payment_salary' => array(
'name' =>
'SalaryPayment',
'fk_element' =>
'fk_salary'));
107 public $type_payment;
111 public $type_payment_code;
152 public $fk_user_author;
157 public $fk_user_modif;
175 const STATUS_UNPAID = 0;
176 const STATUS_PAID = 1;
179 public $fields = array(
180 'rowid' => array(
'type' =>
'integer',
'label' =>
'TechnicalID',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'index' => 1,
'position' => 1,
'comment' =>
'Id'),
181 'ref' => array(
'type' =>
'varchar(128)',
'label' =>
'Ref',
'enabled' => 1,
'position' => 10,
'visible' => 1,
'index' => 1,
'comment' =>
"Reference of object"),
182 'ref_ext' => array(
'type' =>
'varchar(128)',
'label' =>
'RefExt',
'enabled' => 1,
'visible' => 0,
'position' => 11),
183 'label' => array(
'type' =>
'varchar(255)',
'label' =>
'Label',
'enabled' => 1,
'position' => 12,
'notnull' => 0,
'visible' => 1),
184 'datec' => array(
'type' =>
'datetime',
'label' =>
'DateCreation',
'enabled' => 1,
'visible' => 0,
'position' => 30),
185 'datep' => array(
'type' =>
'date',
'label' =>
'Date',
'enabled' => 1,
'visible' => 0,
'position' => 40,
'comment' =>
'Date'),
186 'datev' => array(
'type' =>
'date',
'label' =>
'Date',
'enabled' => 1,
'visible' => 0,
'position' => 50,
'comment' =>
'Date'),
187 'fk_user' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'Employee',
'enabled' => 1,
'position' => 15,
'notnull' => 1,
'visible' => 1,
'picto' =>
'user'),
188 'tms' => array(
'type' =>
'timestamp',
'label' =>
'DateModification',
'enabled' => 1,
'visible' => 0,
'notnull' => 1,
'position' => 20),
189 'salary' => array(
'type' =>
'double(24,8)',
'label' =>
'salary',
'enabled' => 1,
'visible' => 0,
'position' => 70),
190 'amount' => array(
'type' =>
'double(24,8)',
'label' =>
'Amount',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'position' => 80),
191 'fk_projet' => array(
'type' =>
'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)',
'label' =>
'Project',
'enabled' =>
"isModEnabled('project')",
'visible' => 0,
'position' => 90),
192 'fk_typepayment' => array(
'type' =>
'typepayment',
'label' =>
'DefaultPaymentMode',
'enabled' => 1,
'visible' => 1,
'position' => 100,
'comment' =>
'Payment type'),
193 'num_payment' => array(
'type' =>
'string',
'label' =>
'Reference',
'enabled' => 1,
'visible' => 0,
'position' => 110,
'comment' =>
'Reference'),
194 'datesp' => array(
'type' =>
'date',
'label' =>
'DateStart',
'enabled' => 1,
'visible' => 1,
'position' => 130,
'comment' =>
'Date'),
195 'dateep' => array(
'type' =>
'date',
'label' =>
'DateEnd',
'enabled' => 1,
'visible' => 1,
'position' => 140,
'comment' =>
'Date'),
196 'entity' => array(
'type' =>
'integer',
'label' =>
'Entity',
'default' =>
'1',
'enabled' => 1,
'visible' => 0,
'position' => 150,
'index' => 1),
197 'note' => array(
'type' =>
'text',
'label' =>
'Note',
'enabled' => 1,
'position' => 160,
'visible' => 0,),
198 'fk_bank' => array(
'type' =>
'integer',
'label' =>
'BankId',
'enabled' => 1,
'visible' => 0,
'position' => 170),
199 'paye' => array(
'type' =>
'smallint(6)',
'label' =>
'Status',
'enabled' => 1,
'visible' => 1,
'notnull' => 1,
'position' => 180),
200 'fk_user_author' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserAuthor',
'enabled' => 1,
'visible' => 0,
'position' => 190),
201 'fk_user_modif' => array(
'type' =>
'integer:User:user/class/user.class.php',
'label' =>
'UserModif',
'enabled' => 1,
'position' => 200,
'visible' => 0,),
202 'note_public' => array(
'type' =>
'text',
'label' =>
'NotePublic',
'enabled' => 1,
'visible' => 0,
'position' => 220),
214 $this->element =
'salary';
215 $this->table_element =
'salary';
216 $this->isextrafieldmanaged = 1;
218 $this->fields[
'ref_ext'][
'visible'] =
getDolGlobalInt(
'MAIN_LIST_SHOW_REF_EXT');
232 public function generateDocument($model, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = array())
234 global
$conf, $langs;
237 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Model"));
238 $this->errors[] = $this->error;
242 $modelpath =
'core/modules/salaries/doc/';
243 $modelfile = $modelpath.
"pdf_".$model.
".modules.php";
246 if (file_exists(DOL_DOCUMENT_ROOT.
'/'.$modelfile)) {
247 require_once DOL_DOCUMENT_ROOT.
'/'.$modelfile;
249 $classname =
'pdf_'.$model;
250 if (class_exists($classname)) {
251 $module =
new $classname($this->db);
255 $result = $module->writeFile($this, $outputlangs);
259 $this->error = $module->error;
260 $this->errors = $module->errors;
264 $this->error =
'Failed to load class '.$classname;
265 $this->errors[] = $this->error;
269 $this->error = $langs->trans(
"ErrorModuleNotFound", $model);
270 $this->errors[] = $this->error;
282 public function update($user =
null, $notrigger = 0)
288 $this->label = trim((
string) $this->label);
289 $this->note = trim((
string) $this->note);
290 $this->note_private = trim((
string) $this->note_private);
291 $this->note_public = trim((
string) $this->note_public);
294 if (empty($this->fk_user) || $this->fk_user < 0) {
295 $this->error =
'ErrorBadParameter';
302 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
303 $sql .=
" tms='".$this->db->idate(
dol_now()).
"',";
304 $sql .=
" fk_user=".((int) $this->fk_user).
",";
307 $sql .=
" amount=".price2num($this->amount).
",";
308 $sql .=
" fk_projet=".($this->fk_project > 0 ? ((int) $this->fk_project) :
"null").
",";
309 $sql .=
" fk_typepayment=".((int) $this->type_payment).
",";
310 $sql .=
" label='".$this->db->escape($this->label).
"',";
311 $sql .=
" datesp='".$this->db->idate($this->datesp).
"',";
312 $sql .=
" dateep='".$this->db->idate($this->dateep).
"',";
313 $sql .=
" note='".$this->db->escape($this->note).
"',";
314 $sql .=
" fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank :
"null").
",";
315 $sql .=
" fk_user_author=".((int) $this->fk_user_author).
",";
316 $sql .=
" fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
317 $sql .=
" WHERE rowid=".((int) $this->
id);
319 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
320 $resql = $this->db->query($sql);
322 $this->error =
"Error ".$this->db->lasterror();
334 $result = $this->call_trigger(
'SALARY_MODIFY', $user);
345 $this->db->rollback();
358 public function fetch($id, $user =
null)
363 $sql .=
" s.fk_user,";
366 $sql .=
" s.amount,";
367 $sql .=
" s.fk_projet as fk_project,";
368 $sql .=
" s.fk_typepayment,";
370 $sql .=
" s.datesp,";
371 $sql .=
" s.dateep,";
372 $sql .=
" s.note as note_private,";
373 $sql .=
" s.note_public,";
375 $sql .=
" s.fk_bank,";
376 $sql .=
" s.fk_user_author,";
377 $sql .=
" s.fk_user_modif,";
378 $sql .=
" s.fk_account,";
379 $sql .=
" cp.code as type_payment_code";
380 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
381 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON s.fk_bank = b.rowid";
382 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON s.fk_typepayment = cp.id";
383 $sql .=
" WHERE s.rowid = ".((int) $id);
385 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
387 $resql = $this->db->query($sql);
389 if ($this->db->num_rows($resql)) {
390 $obj = $this->db->fetch_object($resql);
392 $this->
id = $obj->rowid;
393 $this->
ref = $obj->rowid;
394 $this->tms = $this->db->jdate($obj->tms);
395 $this->fk_user = $obj->fk_user;
396 $this->datep = $this->db->jdate($obj->datep);
397 $this->datev = $this->db->jdate($obj->datev);
398 $this->
amount = $obj->amount;
399 $this->fk_project = $obj->fk_project;
400 $this->type_payment = $obj->fk_typepayment;
401 $this->type_payment_code = $obj->type_payment_code;
402 $this->label = $obj->label;
403 $this->datesp = $this->db->jdate($obj->datesp);
404 $this->dateep = $this->db->jdate($obj->dateep);
405 $this->note = $obj->note_private;
406 $this->note_private = $obj->note_private;
407 $this->note_public = $obj->note_public;
408 $this->paye = $obj->paye;
409 $this->
status = $obj->paye;
410 $this->fk_bank = $obj->fk_bank;
411 $this->fk_user_author = $obj->fk_user_author;
412 $this->fk_user_modif = $obj->fk_user_modif;
413 $this->fk_account = $obj->fk_account;
414 $this->accountid = $obj->fk_account;
420 $this->db->free($resql);
424 $this->error =
"Error ".$this->db->lasterror();
437 public function delete($user, $notrigger = 0)
464 $this->fk_user_author = 0;
465 $this->fk_user_modif = 0;
478 global
$conf, $langs;
485 $this->label = trim((
string) $this->label);
486 $this->note = trim((
string) $this->note);
487 $this->fk_bank = (int) $this->fk_bank;
488 $this->fk_user_author = (int) $this->fk_user_author;
489 $this->fk_user_modif = (int) $this->fk_user_modif;
490 $this->accountid = (int) $this->accountid;
491 $this->paye = (int) $this->paye;
495 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label"));
498 if ($this->fk_user < 0 || $this->fk_user ==
'') {
499 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Employee"));
502 if ($this->amount ==
'') {
503 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount"));
510 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"salary (fk_user";
514 $sql .=
", fk_projet";
516 $sql .=
", fk_typepayment";
517 $sql .=
", fk_account";
524 $sql .=
", fk_user_author";
530 $sql .= ((int) $this->fk_user);
533 $sql .=
", ".((float) $this->amount);
534 $sql .=
", ".($this->fk_project > 0 ? ((int) $this->fk_project) :
"null");
535 $sql .=
", ".($this->salary > 0 ? ((float) $this->salary) :
"null");
536 $sql .=
", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
537 $sql .=
", ".($this->accountid > 0 ? ((int) $this->accountid) :
"null");
539 $sql .=
", '".$this->db->escape($this->note).
"'";
541 $sql .=
", '".$this->db->escape($this->label).
"'";
542 $sql .=
", '".$this->db->idate($this->datesp).
"'";
543 $sql .=
", '".$this->db->idate($this->dateep).
"'";
544 $sql .=
", ".((int) $user->id);
545 $sql .=
", '".$this->db->idate($now).
"'";
547 $sql .=
", ".((int)
$conf->entity);
550 dol_syslog(get_class($this).
"::create", LOG_DEBUG);
551 $result = $this->db->query($sql);
553 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"salary");
563 $result = $this->call_trigger(
'SALARY_CREATE', $user);
576 $this->db->rollback();
580 $this->error = $this->db->error();
581 $this->db->rollback();
596 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'salary SET fk_bank = '.((int) $id_bank);
597 $sql .=
" WHERE rowid = ".((int) $this->
id);
598 $result = $this->db->query($sql);
602 dol_print_error($this->db);
617 $langs->loadLangs([
'salaries']);
620 if (!empty($params[
'fromajaxtooltip']) && !isset($this->totalpaid)) {
627 $datas[
'picto'] =
'<u>'.$langs->trans(
"Salary").
'</u>';
628 if (isset($this->
status) && isset($this->totalpaid)) {
629 $datas[
'picto'] .=
' '.$this->getLibStatut(5, $this->totalpaid);
631 $datas[
'ref'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
646 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
648 global
$conf, $langs, $hookmanager;
650 if (!empty(
$conf->dol_no_mouse_hover)) {
657 'objecttype' => $this->element,
660 $classfortooltip =
'classfortooltip';
663 $classfortooltip =
'classforajaxtooltip';
664 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
670 $url = DOL_URL_ROOT.
'/salaries/card.php?id='.$this->id;
672 if ($option !=
'nolink') {
674 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
675 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
676 $add_save_lastsearch_values = 1;
678 if ($add_save_lastsearch_values) {
679 $url .=
'&save_lastsearch_values=1';
684 if (empty($notooltip)) {
686 $label = $langs->trans(
"ShowMyObject");
687 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
689 $linkclose .= ($label ?
' title="'.dolPrintHTMLForAttribute($label).
'"' :
' title="tocomplete"');
690 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
692 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
695 $linkstart =
'<a href="'.$url.
'"';
696 $linkstart .= $linkclose.
'>';
699 $result .= $linkstart;
701 $result .= img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'"'), 0, 0, $notooltip ? 0 : 1);
703 if ($withpicto != 2) {
704 $result .= $this->ref;
709 global $action, $hookmanager;
710 $hookmanager->initHooks(array(
'salarypayment'));
711 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
712 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
714 $result = $hookmanager->resPrint;
716 $result .= $hookmanager->resPrint;
730 $sql =
"SELECT sum(amount) as amount";
732 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_salary";
733 $sql .=
" WHERE fk_salary = ".((int) $this->
id);
735 dol_syslog(get_class($this).
"::getSommePaiement for salary id=".((
int) $this->
id), LOG_DEBUG);
737 $resql = $this->db->query($sql);
740 $obj = $this->db->fetch_object($resql);
742 $this->db->free($resql);
745 if ($multicurrency < 0) {
750 } elseif ($multicurrency) {
756 return (
float) $obj->amount;
762 $this->error = $this->db->lasterror();
775 $sql =
'SELECT ps.rowid, ps.datec, ps.tms as datem, ps.fk_user_author, ps.fk_user_modif';
776 $sql .=
' FROM '.MAIN_DB_PREFIX.
'salary as ps';
777 $sql .=
' WHERE ps.rowid = '.((int) $id);
779 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
780 $result = $this->db->query($sql);
783 if ($this->db->num_rows($result)) {
784 $obj = $this->db->fetch_object($result);
786 $this->
id = $obj->rowid;
788 $this->user_creation_id = $obj->fk_user_author;
789 $this->user_modification_id = $obj->fk_user_modif;
790 $this->date_creation = $this->db->jdate($obj->datec);
791 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
793 $this->db->free($result);
795 dol_print_error($this->db);
811 dol_syslog(get_class($this).
"::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
823 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
825 $sql .=
" WHERE rowid = ".((int) $this->
id);
827 $return = $this->db->query($sql);
847 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
849 $sql .=
" WHERE rowid = ".((int) $this->
id);
851 $return = $this->db->query($sql);
871 return $this->
LibStatut($this->paye, $mode, $alreadypaid);
883 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
889 $langs->loadLangs(array(
"customers",
"bills"));
892 $this->labelStatus = array();
893 $this->labelStatusShort = array();
895 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
898 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
899 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv(
'BillStatusPaid');
900 if ($status == self::STATUS_UNPAID && $alreadypaid != 0) {
901 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
"BillStatusStarted");
903 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
904 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv(
'BillStatusPaid');
905 if ($status == self::STATUS_UNPAID && $alreadypaid != 0) {
906 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
"BillStatusStarted");
910 $statusType =
'status1';
911 if ($status == 0 && $alreadypaid != 0) {
912 $statusType =
'status3';
915 $statusType =
'status6';
918 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
928 public function getKanbanView($option =
'', $arraydata =
null)
932 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
934 $return =
'<div class="box-flex-item box-flex-grow-zero">';
935 $return .=
'<div class="info-box info-box-sm">';
936 $return .=
'<span class="info-box-icon bg-infobox-action">';
937 $return .= img_picto(
'', $this->picto);
938 $return .=
'</span>';
939 $return .=
'<div class="info-box-content">';
940 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->
getNomUrl(1) .
'</span>';
941 if ($selected >= 0) {
942 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
944 if (!empty($arraydata[
'user']) && is_object($arraydata[
'user'])) {
945 $user = $arraydata[
'user'];
946 '@phan-var-force User $user';
948 $return .=
'<br><span class="info-box-label">'.$user->getNomUrl(empty($arraydata[
'user']->photo) ? 1 : -1,
'', 0, 0, 16, 0,
'',
'maxwidth100').
'</span>';
950 $return .=
'<br><span class="info-box-label amount">'.price($this->
amount).
'</span>';
951 if (!empty($this->type_payment)) {
952 $return .=
' <span class="info-box-label opacitymedium small">';
953 if ($langs->trans(
"PaymentTypeShort".$this->type_payment) !=
"PaymentTypeShort".$this->type_payment) {
954 $return .= $langs->trans(
"PaymentTypeShort".$this->type_payment);
955 } elseif ($langs->trans(
"PaymentType".$this->type_payment) !=
"PaymentType".$this->type_payment) {
956 $return .= $langs->trans(
"PaymentType".$this->type_payment);
958 $return .=
'</span>';
960 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3, $this->totalpaid).
'</div>';
980 public function demande_prelevement($fuser, $amount = 0, $type =
'direct-debit', $sourcetype =
'salaire', $checkduplicateamongall = 0)
987 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
988 if ($this->paye == 0) {
989 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
992 $bac->fetch(0,
'',
$mysoc->id);
994 $sql =
"SELECT count(rowid) as nb";
995 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
996 if ($type ==
'salaire') {
997 $sql .=
" WHERE fk_salary = ".((int) $this->
id);
999 $sql .=
" WHERE fk_facture = ".((int) $this->
id);
1001 $sql .=
" AND type = 'ban'";
1002 if (empty($checkduplicateamongall)) {
1003 $sql .=
" AND traite = 0";
1006 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
1008 $resql = $this->db->query($sql);
1010 $obj = $this->db->fetch_object($resql);
1011 if ($obj && $obj->nb == 0) {
1027 if (is_numeric($amount) && $amount != 0) {
1028 $sql =
'INSERT INTO '.$this->db->prefix().
'prelevement_demande(';
1029 if ($type ==
'salaire') {
1030 $sql .=
'fk_salary, ';
1032 $sql .=
'fk_facture, ';
1034 $sql .=
' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, type, entity)';
1035 $sql .=
" VALUES (".((int) $this->
id);
1036 $sql .=
", ".((float)
price2num($amount));
1037 $sql .=
", '".$this->db->idate($now).
"'";
1038 $sql .=
", ".((int) $fuser->id);
1039 $sql .=
", '".$this->db->escape($bac->code_banque).
"'";
1040 $sql .=
", '".$this->db->escape($bac->code_guichet).
"'";
1041 $sql .=
", '".$this->db->escape($bac->number).
"'";
1042 $sql .=
", '".$this->db->escape($bac->cle_rib).
"'";
1043 $sql .=
", '".$this->db->escape($sourcetype).
"'";
1045 $sql .=
", ".((int)
$conf->entity);
1048 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
1049 $resql = $this->db->query($sql);
1051 $this->error = $this->db->lasterror();
1052 dol_syslog(get_class($this).
'::demandeprelevement Erreur');
1056 $this->error =
'WithdrawRequestErrorNilAmount';
1057 dol_syslog(get_class($this).
'::demandeprelevement WithdrawRequestErrorNilAmount');
1063 $payment_mode_id =
dol_getIdFromCode($this->db, (($type ==
'bank-transfer' || $type ==
'salaire') ?
'VIR' :
'PRE'),
'c_paiement',
'code',
'id', 1);
1064 if ($payment_mode_id > 0) {
1074 $this->error =
"A request already exists";
1075 dol_syslog(get_class($this).
'::demandeprelevement Can t create a request to generate a direct debit, a request already exists.');
1079 $this->error = $this->db->error();
1080 dol_syslog(get_class($this).
'::demandeprelevement Error -2');
1084 $this->error =
"Status of invoice does not allow this";
1085 dol_syslog(get_class($this).
"::demandeprelevement ".$this->error.
" $this->status, $this->paye, $this->mode_reglement_id");
1101 $sql =
'DELETE FROM '.$this->db->prefix().
'prelevement_demande';
1102 $sql .=
' WHERE rowid = '.((int) $did);
1103 $sql .=
' AND traite = 0';
1104 if ($this->db->query($sql)) {
1107 $this->error = $this->db->lasterror();
1108 dol_syslog(get_class($this).
'::demande_prelevement_delete Error '.$this->error);
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.
setPaymentMethods($id)
Change the payments methods.
deleteCommon(User $user, $notrigger=0, $forcechilddeletion=0)
Delete object in database.
Class to manage bank accounts description of third parties.
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
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 paid completely.
generateDocument($model, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=array())
Generate a document from a model.
demande_prelevement_delete($fuser, $did)
Remove a direct debit request or a credit transfer request.
getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
Send name clickable (with possibly the picto)
set_unpaid($user)
Remove tag paid on social contribution.
create($user)
Create in database.
getSommePaiement($multicurrency=0)
Return amount of payments already done.
getLibStatut($mode=0, $alreadypaid=-1)
Return label of current status.
info($id)
Information on record.
__construct($db)
Constructor.
setPaid($user)
Tag social contribution as paid completely.
demande_prelevement($fuser, $amount=0, $type='direct-debit', $sourcetype='salaire', $checkduplicateamongall=0)
Create a withdrawal request for a direct debit order or a credit transfer order.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
dol_now($mode='gmt')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as p p num_paiement as f pf amount as amount