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 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Model")),
null,
'errors');
241 $modelpath =
'core/modules/salaries/doc/';
242 $modelfile = $modelpath.
"pdf_".$model.
".modules.php";
245 if (file_exists(DOL_DOCUMENT_ROOT.
'/'.$modelfile)) {
246 require_once DOL_DOCUMENT_ROOT.
'/'.$modelfile;
248 $classname =
'pdf_'.$model;
249 if (class_exists($classname)) {
250 $module =
new $classname($this->db);
254 $result = $module->writeFile($this, $outputlangs);
266 setEventMessages($langs->trans(
"ErrorModuleNotFound", $model),
null,
'errors');
278 public function update($user =
null, $notrigger = 0)
284 $this->label = trim($this->label);
285 $this->note = trim($this->note);
286 $this->note_private = trim($this->note_private);
287 $this->note_public = trim($this->note_public);
290 if (empty($this->fk_user) || $this->fk_user < 0) {
291 $this->error =
'ErrorBadParameter';
298 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
299 $sql .=
" tms='".$this->db->idate(
dol_now()).
"',";
300 $sql .=
" fk_user=".((int) $this->fk_user).
",";
303 $sql .=
" amount=".price2num($this->
amount).
",";
304 $sql .=
" fk_projet=".((int) $this->fk_project).
",";
305 $sql .=
" fk_typepayment=".((int) $this->type_payment).
",";
306 $sql .=
" label='".$this->db->escape($this->label).
"',";
307 $sql .=
" datesp='".$this->db->idate($this->datesp).
"',";
308 $sql .=
" dateep='".$this->db->idate($this->dateep).
"',";
309 $sql .=
" note='".$this->db->escape($this->note).
"',";
310 $sql .=
" fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank :
"null").
",";
311 $sql .=
" fk_user_author=".((int) $this->fk_user_author).
",";
312 $sql .=
" fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
313 $sql .=
" WHERE rowid=".((int) $this->
id);
315 dol_syslog(get_class($this).
"::update", LOG_DEBUG);
316 $resql = $this->db->query($sql);
318 $this->error =
"Error ".$this->db->lasterror();
330 $result = $this->call_trigger(
'SALARY_MODIFY', $user);
341 $this->db->rollback();
354 public function fetch($id, $user =
null)
359 $sql .=
" s.fk_user,";
362 $sql .=
" s.amount,";
363 $sql .=
" s.fk_projet as fk_project,";
364 $sql .=
" s.fk_typepayment,";
366 $sql .=
" s.datesp,";
367 $sql .=
" s.dateep,";
368 $sql .=
" s.note as note_private,";
369 $sql .=
" s.note_public,";
371 $sql .=
" s.fk_bank,";
372 $sql .=
" s.fk_user_author,";
373 $sql .=
" s.fk_user_modif,";
374 $sql .=
" s.fk_account,";
375 $sql .=
" cp.code as type_payment_code";
376 $sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
377 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON s.fk_bank = b.rowid";
378 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as cp ON s.fk_typepayment = cp.id";
379 $sql .=
" WHERE s.rowid = ".((int) $id);
381 dol_syslog(get_class($this).
"::fetch", LOG_DEBUG);
383 $resql = $this->db->query($sql);
385 if ($this->db->num_rows($resql)) {
386 $obj = $this->db->fetch_object($resql);
388 $this->
id = $obj->rowid;
389 $this->
ref = $obj->rowid;
390 $this->tms = $this->db->jdate($obj->tms);
391 $this->fk_user = $obj->fk_user;
392 $this->datep = $this->db->jdate($obj->datep);
393 $this->datev = $this->db->jdate($obj->datev);
394 $this->
amount = $obj->amount;
395 $this->fk_project = $obj->fk_project;
396 $this->type_payment = $obj->fk_typepayment;
397 $this->type_payment_code = $obj->type_payment_code;
398 $this->label = $obj->label;
399 $this->datesp = $this->db->jdate($obj->datesp);
400 $this->dateep = $this->db->jdate($obj->dateep);
401 $this->note = $obj->note_private;
402 $this->note_private = $obj->note_private;
403 $this->note_public = $obj->note_public;
404 $this->paye = $obj->paye;
405 $this->
status = $obj->paye;
406 $this->fk_bank = $obj->fk_bank;
407 $this->fk_user_author = $obj->fk_user_author;
408 $this->fk_user_modif = $obj->fk_user_modif;
409 $this->fk_account = $obj->fk_account;
410 $this->accountid = $obj->fk_account;
416 $this->db->free($resql);
420 $this->error =
"Error ".$this->db->lasterror();
433 public function delete($user, $notrigger = 0)
460 $this->fk_user_author = 0;
461 $this->fk_user_modif = 0;
474 global
$conf, $langs;
481 $this->label = trim($this->label);
482 $this->note = trim($this->note);
483 $this->fk_bank = (int) $this->fk_bank;
484 $this->fk_user_author = (int) $this->fk_user_author;
485 $this->fk_user_modif = (int) $this->fk_user_modif;
486 $this->accountid = (int) $this->accountid;
487 $this->paye = (int) $this->paye;
491 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label"));
494 if ($this->fk_user < 0 || $this->fk_user ==
'') {
495 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Employee"));
498 if ($this->
amount ==
'') {
499 $this->error = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount"));
506 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"salary (fk_user";
510 $sql .=
", fk_projet";
512 $sql .=
", fk_typepayment";
513 $sql .=
", fk_account";
520 $sql .=
", fk_user_author";
526 $sql .=
"'".((int) $this->fk_user).
"'";
529 $sql .=
", ".((float) $this->
amount);
530 $sql .=
", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
531 $sql .=
", ".($this->salary > 0 ? ((float) $this->salary) :
"null");
532 $sql .=
", ".($this->type_payment > 0 ? ((int) $this->type_payment) : 0);
533 $sql .=
", ".($this->accountid > 0 ? ((int) $this->accountid) :
"null");
535 $sql .=
", '".$this->db->escape($this->note).
"'";
537 $sql .=
", '".$this->db->escape($this->label).
"'";
538 $sql .=
", '".$this->db->idate($this->datesp).
"'";
539 $sql .=
", '".$this->db->idate($this->dateep).
"'";
540 $sql .=
", '".((int) $user->id).
"'";
541 $sql .=
", '".$this->db->idate($now).
"'";
543 $sql .=
", ".((int)
$conf->entity);
546 dol_syslog(get_class($this).
"::create", LOG_DEBUG);
547 $result = $this->db->query($sql);
549 $this->
id = $this->db->last_insert_id(MAIN_DB_PREFIX.
"salary");
559 $result = $this->call_trigger(
'SALARY_CREATE', $user);
572 $this->db->rollback();
576 $this->error = $this->db->error();
577 $this->db->rollback();
592 $sql =
'UPDATE '.MAIN_DB_PREFIX.
'salary SET fk_bank = '.((int) $id_bank);
593 $sql .=
" WHERE rowid = ".((int) $this->
id);
594 $result = $this->db->query($sql);
613 $langs->loadLangs([
'salaries']);
616 if (!empty($params[
'fromajaxtooltip']) && !isset($this->alreadypaid)) {
623 $datas[
'picto'] =
'<u>'.$langs->trans(
"Salary").
'</u>';
624 if (isset($this->
status) && isset($this->alreadypaid)) {
625 $datas[
'picto'] .=
' '.$this->getLibStatut(5, $this->alreadypaid);
627 $datas[
'ref'] =
'<br><b>'.$langs->trans(
'Ref').
':</b> '.$this->ref;
642 public function getNomUrl($withpicto = 0, $option =
'', $notooltip = 0, $morecss =
'', $save_lastsearch_value = -1)
644 global
$conf, $langs, $hookmanager;
646 if (!empty(
$conf->dol_no_mouse_hover)) {
653 'objecttype' => $this->element,
656 $classfortooltip =
'classfortooltip';
659 $classfortooltip =
'classforajaxtooltip';
660 $dataparams =
' data-params="'.dol_escape_htmltag(json_encode($params)).
'"';
666 $url = DOL_URL_ROOT.
'/salaries/card.php?id='.$this->id;
668 if ($option !=
'nolink') {
670 $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
671 if ($save_lastsearch_value == -1 && isset($_SERVER[
"PHP_SELF"]) && preg_match(
'/list\.php/', $_SERVER[
"PHP_SELF"])) {
672 $add_save_lastsearch_values = 1;
674 if ($add_save_lastsearch_values) {
675 $url .=
'&save_lastsearch_values=1';
680 if (empty($notooltip)) {
682 $label = $langs->trans(
"ShowMyObject");
683 $linkclose .=
' alt="'.dolPrintHTMLForAttribute($label).
'"';
685 $linkclose .= ($label ?
' title="'.dolPrintHTMLForAttribute($label).
'"' :
' title="tocomplete"');
686 $linkclose .= $dataparams.
' class="'.$classfortooltip.($morecss ?
' '.$morecss :
'').
'"';
688 $linkclose = ($morecss ?
' class="'.$morecss.
'"' :
'');
691 $linkstart =
'<a href="'.$url.
'"';
692 $linkstart .= $linkclose.
'>';
695 $result .= $linkstart;
697 $result .=
img_object(($notooltip ?
'' : $label), ($this->picto ? $this->picto :
'generic'), ($notooltip ? (($withpicto != 2) ?
'class="paddingright"' :
'') :
'class="'.(($withpicto != 2) ?
'paddingright ' :
'').
'"'), 0, 0, $notooltip ? 0 : 1);
699 if ($withpicto != 2) {
700 $result .= $this->ref;
705 global $action, $hookmanager;
706 $hookmanager->initHooks(array(
'salarypayment'));
707 $parameters = array(
'id' => $this->
id,
'getnomurl' => &$result);
708 $reshook = $hookmanager->executeHooks(
'getNomUrl', $parameters, $this, $action);
710 $result = $hookmanager->resPrint;
712 $result .= $hookmanager->resPrint;
726 $sql =
"SELECT sum(amount) as amount";
728 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_salary";
729 $sql .=
" WHERE fk_salary = ".((int) $this->
id);
731 dol_syslog(get_class($this).
"::getSommePaiement for salary id=".((
int) $this->
id), LOG_DEBUG);
733 $resql = $this->db->query($sql);
736 $obj = $this->db->fetch_object($resql);
738 $this->db->free($resql);
741 if ($multicurrency < 0) {
746 } elseif ($multicurrency) {
752 return (
float) $obj->amount;
758 $this->error = $this->db->lasterror();
771 $sql =
'SELECT ps.rowid, ps.datec, ps.tms as datem, ps.fk_user_author, ps.fk_user_modif';
772 $sql .=
' FROM '.MAIN_DB_PREFIX.
'salary as ps';
773 $sql .=
' WHERE ps.rowid = '.((int) $id);
775 dol_syslog(get_class($this).
'::info', LOG_DEBUG);
776 $result = $this->db->query($sql);
779 if ($this->db->num_rows($result)) {
780 $obj = $this->db->fetch_object($result);
782 $this->
id = $obj->rowid;
784 $this->user_creation_id = $obj->fk_user_author;
785 $this->user_modification_id = $obj->fk_user_modif;
786 $this->date_creation = $this->db->jdate($obj->datec);
787 $this->date_modification = empty($obj->datem) ?
'' : $this->db->jdate($obj->datem);
789 $this->db->free($result);
807 dol_syslog(get_class($this).
"::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
819 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
821 $sql .=
" WHERE rowid = ".((int) $this->
id);
823 $return = $this->db->query($sql);
843 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"salary SET";
845 $sql .=
" WHERE rowid = ".((int) $this->
id);
847 $return = $this->db->query($sql);
867 return $this->
LibStatut($this->paye, $mode, $alreadypaid);
879 public function LibStatut($status, $mode = 0, $alreadypaid = -1)
885 $langs->loadLangs(array(
"customers",
"bills"));
888 $this->labelStatus = array();
889 $this->labelStatusShort = array();
891 if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
894 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
895 $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv(
'BillStatusPaid');
896 if ($status == self::STATUS_UNPAID && $alreadypaid != 0) {
897 $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
"BillStatusStarted");
899 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
900 $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv(
'BillStatusPaid');
901 if ($status == self::STATUS_UNPAID && $alreadypaid != 0) {
902 $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv(
"BillStatusStarted");
906 $statusType =
'status1';
907 if ($status == 0 && $alreadypaid != 0) {
908 $statusType =
'status3';
911 $statusType =
'status6';
914 return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status],
'', $statusType, $mode);
924 public function getKanbanView($option =
'', $arraydata =
null)
928 $selected = (empty($arraydata[
'selected']) ? 0 : $arraydata[
'selected']);
930 $return =
'<div class="box-flex-item box-flex-grow-zero">';
931 $return .=
'<div class="info-box info-box-sm">';
932 $return .=
'<span class="info-box-icon bg-infobox-action">';
934 $return .=
'</span>';
935 $return .=
'<div class="info-box-content">';
936 $return .=
'<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->
getNomUrl(1) .
'</span>';
937 if ($selected >= 0) {
938 $return .=
'<input id="cb'.$this->id.
'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->
id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
940 if (!empty($arraydata[
'user']) && is_object($arraydata[
'user'])) {
941 $user = $arraydata[
'user'];
942 '@phan-var-force User $user';
944 $return .=
'<br><span class="info-box-label">'.$user->getNomUrl(empty($arraydata[
'user']->photo) ? 1 : -1,
'', 0, 0, 16, 0,
'',
'maxwidth100').
'</span>';
946 $return .=
'<br><span class="info-box-label amount">'.price($this->
amount).
'</span>';
947 if (!empty($this->type_payment)) {
948 $return .=
' <span class="info-box-label opacitymedium small">';
949 if ($langs->trans(
"PaymentTypeShort".$this->type_payment) !=
"PaymentTypeShort".$this->type_payment) {
950 $return .= $langs->trans(
"PaymentTypeShort".$this->type_payment);
951 } elseif ($langs->trans(
"PaymentType".$this->type_payment) !=
"PaymentType".$this->type_payment) {
952 $return .= $langs->trans(
"PaymentType".$this->type_payment);
954 $return .=
'</span>';
956 $return .=
'<br><div class="info-box-status">'.$this->getLibStatut(3, isset($this->alreadypaid) ? $this->alreadypaid : $this->totalpaid).
'</div>';
976 public function demande_prelevement($fuser, $amount = 0, $type =
'direct-debit', $sourcetype =
'salaire', $checkduplicateamongall = 0)
983 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
984 if ($this->paye == 0) {
985 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
988 $bac->fetch(0,
'',
$mysoc->id);
990 $sql =
"SELECT count(rowid) as nb";
991 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
992 if ($type ==
'salaire') {
993 $sql .=
" WHERE fk_salary = ".((int) $this->
id);
995 $sql .=
" WHERE fk_facture = ".((int) $this->
id);
997 $sql .=
" AND type = 'ban'";
998 if (empty($checkduplicateamongall)) {
999 $sql .=
" AND traite = 0";
1002 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
1004 $resql = $this->db->query($sql);
1006 $obj = $this->db->fetch_object($resql);
1007 if ($obj && $obj->nb == 0) {
1023 if (is_numeric($amount) && $amount != 0) {
1024 $sql =
'INSERT INTO '.$this->db->prefix().
'prelevement_demande(';
1025 if ($type ==
'salaire') {
1026 $sql .=
'fk_salary, ';
1028 $sql .=
'fk_facture, ';
1030 $sql .=
' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, type, entity)';
1031 $sql .=
" VALUES (".((int) $this->
id);
1032 $sql .=
", ".((float)
price2num($amount));
1033 $sql .=
", '".$this->db->idate($now).
"'";
1034 $sql .=
", ".((int) $fuser->id);
1035 $sql .=
", '".$this->db->escape($bac->code_banque).
"'";
1036 $sql .=
", '".$this->db->escape($bac->code_guichet).
"'";
1037 $sql .=
", '".$this->db->escape($bac->number).
"'";
1038 $sql .=
", '".$this->db->escape($bac->cle_rib).
"'";
1039 $sql .=
", '".$this->db->escape($sourcetype).
"'";
1041 $sql .=
", ".((int)
$conf->entity);
1044 dol_syslog(get_class($this).
"::demande_prelevement", LOG_DEBUG);
1045 $resql = $this->db->query($sql);
1047 $this->error = $this->db->lasterror();
1048 dol_syslog(get_class($this).
'::demandeprelevement Erreur');
1052 $this->error =
'WithdrawRequestErrorNilAmount';
1053 dol_syslog(get_class($this).
'::demandeprelevement WithdrawRequestErrorNilAmount');
1059 $payment_mode_id =
dol_getIdFromCode($this->db, (($type ==
'bank-transfer' || $type ==
'salaire') ?
'VIR' :
'PRE'),
'c_paiement',
'code',
'id', 1);
1060 if ($payment_mode_id > 0) {
1070 $this->error =
"A request already exists";
1071 dol_syslog(get_class($this).
'::demandeprelevement Can t create a request to generate a direct debit, a request already exists.');
1075 $this->error = $this->db->error();
1076 dol_syslog(get_class($this).
'::demandeprelevement Error -2');
1080 $this->error =
"Status of invoice does not allow this";
1081 dol_syslog(get_class($this).
"::demandeprelevement ".$this->error.
" $this->status, $this->paye, $this->mode_reglement_id");
1097 $sql =
'DELETE FROM '.$this->db->prefix().
'prelevement_demande';
1098 $sql .=
' WHERE rowid = '.((int) $did);
1099 $sql .=
' AND traite = 0';
1100 if ($this->db->query($sql)) {
1103 $this->error = $this->db->lasterror();
1104 dol_syslog(get_class($this).
'::demande_prelevement_delete Error '.$this->error);
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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