dolibarr  19.0.0-dev
paymentvarious.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
3  * Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 // Put here all includes required by your class file
26 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
27 
28 
33 {
37  public $element = 'payment_various';
38 
42  public $table_element = 'payment_various';
43 
47  public $picto = 'payment';
48 
52  public $id;
53 
57  public $ref;
58 
62  public $tms;
63  public $datep;
64  public $datev;
65 
69  public $sens;
70  public $amount;
71  public $type_payment;
72  public $num_payment;
73  public $chqemetteur;
74  public $chqbank;
75  public $category_transaction;
76 
80  public $label;
81 
85  public $accountancy_code;
86 
90  public $subledger_account;
91 
95  public $fk_project;
96 
100  public $fk_account;
101 
106  public $accountid;
107 
111  public $fk_bank;
112 
116  public $categorie_transaction;
117 
121  public $fk_user_author;
122 
126  public $fk_user_modif;
127 
128 
132  public $fk_type;
133 
137  public $rappro;
138 
142  public $bank_num_releve;
143 
144 
170  // BEGIN MODULEBUILDER PROPERTIES
174  public $fields = array(
175  // TODO: fill this array
176  );
177  // END MODULEBUILDER PROPERTIES
178 
184  public function __construct(DoliDB $db)
185  {
186  $this->db = $db;
187  }
188 
196  public function update($user = null, $notrigger = 0)
197  {
198  global $conf, $langs;
199 
200  $error = 0;
201 
202  // Clean parameters
203  $this->amount = trim($this->amount);
204  $this->label = trim($this->label);
205  $this->note = trim($this->note);
206  $this->fk_bank = (int) $this->fk_bank;
207  $this->fk_user_author = (int) $this->fk_user_author;
208  $this->fk_user_modif = (int) $this->fk_user_modif;
209 
210  $this->db->begin();
211 
212  // Update request
213  $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
214  if ($this->tms) {
215  $sql .= " tms='".$this->db->idate($this->tms)."',";
216  }
217  $sql .= " datep='".$this->db->idate($this->datep)."',";
218  $sql .= " datev='".$this->db->idate($this->datev)."',";
219  $sql .= " sens=".(int) $this->sens.",";
220  $sql .= " amount=".price2num($this->amount).",";
221  $sql .= " fk_typepayment=".(int) $this->type_payment.",";
222  $sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
223  $sql .= " label='".$this->db->escape($this->label)."',";
224  $sql .= " note='".$this->db->escape($this->note)."',";
225  $sql .= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
226  $sql .= " subledger_account='".$this->db->escape($this->subledger_account)."',";
227  $sql .= " fk_projet='".$this->db->escape($this->fk_project)."',";
228  $sql .= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank : "null").",";
229  $sql .= " fk_user_author=".(int) $this->fk_user_author.",";
230  $sql .= " fk_user_modif=".(int) $this->fk_user_modif;
231  $sql .= " WHERE rowid=".((int) $this->id);
232 
233  dol_syslog(get_class($this)."::update", LOG_DEBUG);
234  $resql = $this->db->query($sql);
235  if (!$resql) {
236  $this->error = "Error ".$this->db->lasterror();
237  return -1;
238  }
239 
240  if (!$notrigger) {
241  // Call trigger
242  $result = $this->call_trigger('PAYMENT_VARIOUS_MODIFY', $user);
243  if ($result < 0) {
244  $error++;
245  }
246  // End call triggers
247  }
248 
249  if (!$error) {
250  $this->db->commit();
251  return 1;
252  } else {
253  $this->db->rollback();
254  return -1;
255  }
256  }
257 
258 
266  public function fetch($id, $user = null)
267  {
268  $sql = "SELECT";
269  $sql .= " v.rowid,";
270  $sql .= " v.tms,";
271  $sql .= " v.datep,";
272  $sql .= " v.datev,";
273  $sql .= " v.sens,";
274  $sql .= " v.amount,";
275  $sql .= " v.fk_typepayment,";
276  $sql .= " v.num_payment,";
277  $sql .= " v.label,";
278  $sql .= " v.note as note_private,";
279  $sql .= " v.accountancy_code,";
280  $sql .= " v.subledger_account,";
281  $sql .= " v.fk_projet as fk_project,";
282  $sql .= " v.fk_bank,";
283  $sql .= " v.fk_user_author,";
284  $sql .= " v.fk_user_modif,";
285  $sql .= " b.fk_account,";
286  $sql .= " b.fk_type,";
287  $sql .= " b.rappro,";
288  $sql .= " b.num_releve as bank_num_releve";
289  $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
290  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
291  $sql .= " WHERE v.rowid = ".((int) $id);
292 
293  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
294  $resql = $this->db->query($sql);
295  if ($resql) {
296  if ($this->db->num_rows($resql)) {
297  $obj = $this->db->fetch_object($resql);
298 
299  $this->id = $obj->rowid;
300  $this->ref = $obj->rowid;
301  $this->tms = $this->db->jdate($obj->tms);
302  $this->datep = $this->db->jdate($obj->datep);
303  $this->datev = $this->db->jdate($obj->datev);
304  $this->sens = $obj->sens;
305  $this->amount = $obj->amount;
306  $this->type_payment = $obj->fk_typepayment;
307  $this->num_payment = $obj->num_payment;
308  $this->label = $obj->label;
309  $this->note = $obj->note_private; // For backward compatibility
310  $this->note_private = $obj->note_private;
311  $this->subledger_account = $obj->subledger_account;
312  $this->accountancy_code = $obj->accountancy_code;
313  $this->fk_project = $obj->fk_project;
314  $this->fk_bank = $obj->fk_bank;
315  $this->fk_user_author = $obj->fk_user_author;
316  $this->fk_user_modif = $obj->fk_user_modif;
317  $this->fk_account = $obj->fk_account;
318  $this->fk_type = $obj->fk_type;
319  $this->rappro = $obj->rappro;
320  $this->bank_num_releve = $obj->bank_num_releve;
321  }
322  $this->db->free($resql);
323 
324  return 1;
325  } else {
326  $this->error = "Error ".$this->db->lasterror();
327  return -1;
328  }
329  }
330 
331 
338  public function delete($user)
339  {
340  global $conf, $langs;
341 
342  $error = 0;
343 
344  // Call trigger
345  $result = $this->call_trigger('PAYMENT_VARIOUS_DELETE', $user);
346  if ($result < 0) {
347  return -1;
348  }
349  // End call triggers
350 
351 
352  $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
353  $sql .= " WHERE rowid=".((int) $this->id);
354 
355  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
356  $resql = $this->db->query($sql);
357  if (!$resql) {
358  $this->error = "Error ".$this->db->lasterror();
359  return -1;
360  }
361 
362  return 1;
363  }
364 
365 
373  public function initAsSpecimen()
374  {
375  $this->id = 0;
376 
377  $this->tms = '';
378  $this->datep = '';
379  $this->datev = '';
380  $this->sens = '';
381  $this->amount = '';
382  $this->label = '';
383  $this->accountancy_code = '';
384  $this->subledger_account = '';
385  $this->note = '';
386  $this->fk_bank = '';
387  $this->fk_user_author = '';
388  $this->fk_user_modif = '';
389  }
390 
396  public function check()
397  {
398  $newamount = price2num($this->amount, 'MT');
399 
400  // Validation of parameters
401  if (!($newamount) > 0 || empty($this->datep)) {
402  return false;
403  }
404 
405  return true;
406  }
407 
414  public function create($user)
415  {
416  global $conf, $langs;
417 
418  $error = 0;
419  $now = dol_now();
420 
421  // Clean parameters
422  $this->amount = price2num(trim($this->amount));
423  $this->label = trim($this->label);
424  $this->note = trim($this->note);
425  $this->fk_bank = (int) $this->fk_bank;
426  $this->fk_user_author = (int) $this->fk_user_author;
427  $this->fk_user_modif = (int) $this->fk_user_modif;
428  $this->fk_account = (int) $this->fk_account;
429  if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility
430  $this->fk_account = $this->accountid;
431  }
432 
433  // Check parameters
434  if (!$this->label) {
435  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
436  return -3;
437  }
438  if ($this->amount < 0 || $this->amount == '') {
439  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount"));
440  return -5;
441  }
442  if (isModEnabled("banque") && (empty($this->fk_account) || $this->fk_account <= 0)) {
443  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount"));
444  return -6;
445  }
446  if (isModEnabled("banque") && (empty($this->type_payment) || $this->type_payment <= 0)) {
447  $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
448  return -7;
449  }
450 
451  $this->db->begin();
452 
453  // Insert into llx_payment_various
454  $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
455  $sql .= " datep";
456  $sql .= ", datev";
457  $sql .= ", sens";
458  $sql .= ", amount";
459  $sql .= ", fk_typepayment";
460  $sql .= ", num_payment";
461  if ($this->note) {
462  $sql .= ", note";
463  }
464  $sql .= ", label";
465  $sql .= ", accountancy_code";
466  $sql .= ", subledger_account";
467  $sql .= ", fk_projet";
468  $sql .= ", fk_user_author";
469  $sql .= ", datec";
470  $sql .= ", fk_bank";
471  $sql .= ", entity";
472  $sql .= ")";
473  $sql .= " VALUES (";
474  $sql .= "'".$this->db->idate($this->datep)."'";
475  $sql .= ", '".$this->db->idate($this->datev)."'";
476  $sql .= ", '".$this->db->escape($this->sens)."'";
477  $sql .= ", ".price2num($this->amount);
478  $sql .= ", '".$this->db->escape($this->type_payment)."'";
479  $sql .= ", '".$this->db->escape($this->num_payment)."'";
480  if ($this->note) {
481  $sql .= ", '".$this->db->escape($this->note)."'";
482  }
483  $sql .= ", '".$this->db->escape($this->label)."'";
484  $sql .= ", '".$this->db->escape($this->accountancy_code)."'";
485  $sql .= ", '".$this->db->escape($this->subledger_account)."'";
486  $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0);
487  $sql .= ", ".((int) $user->id);
488  $sql .= ", '".$this->db->idate($now)."'";
489  $sql .= ", NULL"; // Filled later
490  $sql .= ", ".((int) $conf->entity);
491  $sql .= ")";
492 
493  dol_syslog(get_class($this)."::create", LOG_DEBUG);
494  $result = $this->db->query($sql);
495  if ($result) {
496  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
497  $this->ref = $this->id;
498 
499  if ($this->id > 0) {
500  if (isModEnabled("banque") && !empty($this->amount)) {
501  // Insert into llx_bank
502  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
503 
504  $acc = new Account($this->db);
505  $result = $acc->fetch($this->fk_account);
506  if ($result <= 0) {
507  dol_print_error($this->db);
508  }
509 
510  // Insert payment into llx_bank
511  // Add link 'payment_various' in bank_url between payment and bank transaction
512  $sign = 1;
513  if ($this->sens == '0') {
514  $sign = -1;
515  }
516 
517  $bank_line_id = $acc->addline(
518  $this->datep,
519  $this->type_payment,
520  $this->label,
521  $sign * abs($this->amount),
522  $this->num_payment,
523  ($this->category_transaction > 0 ? $this->category_transaction : 0),
524  $user,
525  $this->chqemetteur,
526  $this->chqbank,
527  '',
528  $this->datev
529  );
530 
531  // Update fk_bank into llx_payment_various
532  // So we know the payment which has generate the banking ecriture
533  if ($bank_line_id > 0) {
534  $this->update_fk_bank($bank_line_id);
535  } else {
536  $this->error = $acc->error;
537  $error++;
538  }
539 
540  if (!$error) {
541  // Add link 'payment_various' in bank_url between payment and bank transaction
542  $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
543 
544  $result = $acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
545  if ($result <= 0) {
546  $this->error = $acc->error;
547  $error++;
548  }
549  }
550 
551  if ($result <= 0) {
552  $this->error = $acc->error;
553  $error++;
554  }
555  }
556 
557  // Call trigger
558  $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user);
559  if ($result < 0) {
560  $error++;
561  }
562  // End call triggers
563  } else {
564  $error++;
565  }
566 
567  if (!$error) {
568  $this->db->commit();
569  return $this->id;
570  } else {
571  $this->db->rollback();
572  return -2;
573  }
574  } else {
575  $this->error = $this->db->error();
576  $this->db->rollback();
577  return -1;
578  }
579  }
580 
581  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
588  public function update_fk_bank($id_bank)
589  {
590  // phpcs:enable
591  $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.((int) $id_bank);
592  $sql .= " WHERE rowid = ".((int) $this->id);
593  $result = $this->db->query($sql);
594  if ($result) {
595  return 1;
596  } else {
597  dol_print_error($this->db);
598  return -1;
599  }
600  }
601 
602 
609  public function getLibStatut($mode = 0)
610  {
611  return $this->LibStatut($this->statut, $mode);
612  }
613 
614  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
622  public function LibStatut($status, $mode = 0)
623  {
624  // phpcs:enable
625  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
626  global $langs;
627  //$langs->load("mymodule@mymodule");
628  /*$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
629  $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
630  $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
631  $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
632  $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
633  $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');*/
634  }
635 
636  $statusType = 'status'.$status;
637 
638  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
639  }
640 
641 
652  public function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '')
653  {
654  global $db, $conf, $langs, $hookmanager;
655  global $langs;
656 
657  if (!empty($conf->dol_no_mouse_hover)) {
658  $notooltip = 1; // Force disable tooltips
659  }
660 
661  $result = '';
662 
663  $label = '<u>'.$langs->trans("ShowVariousPayment").'</u>';
664  $label .= '<br>';
665  $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
666 
667  $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id;
668 
669  if ($option != 'nolink') {
670  // Add param to save lastsearch_values or not
671  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
672  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
673  $add_save_lastsearch_values = 1;
674  }
675  if ($add_save_lastsearch_values) {
676  $url .= '&save_lastsearch_values=1';
677  }
678  }
679 
680  $linkclose = '';
681  if (empty($notooltip)) {
682  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
683  $label = $langs->trans("ShowMyObject");
684  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
685  }
686  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
687  $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
688  } else {
689  $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
690  }
691 
692  $linkstart = '<a href="'.$url.'"';
693  $linkstart .= $linkclose.'>';
694  $linkend = '</a>';
695 
696  $result .= $linkstart;
697  if ($withpicto) {
698  $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
699  }
700  if ($withpicto != 2) {
701  $result .= $this->ref;
702  }
703  $result .= $linkend;
704  //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
705 
706  global $action;
707  $hookmanager->initHooks(array('variouspayment'));
708  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
709  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
710  if ($reshook > 0) {
711  $result = $hookmanager->resPrint;
712  } else {
713  $result .= $hookmanager->resPrint;
714  }
715 
716  return $result;
717  }
718 
725  public function info($id)
726  {
727  $sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
728  $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
729  $sql .= ' WHERE v.rowid = '.((int) $id);
730 
731  dol_syslog(get_class($this).'::info', LOG_DEBUG);
732  $result = $this->db->query($sql);
733 
734  if ($result) {
735  if ($this->db->num_rows($result)) {
736  $obj = $this->db->fetch_object($result);
737  $this->id = $obj->rowid;
738  if ($obj->fk_user_author) {
739  $cuser = new User($this->db);
740  $cuser->fetch($obj->fk_user_author);
741  $this->user_creation = $cuser;
742  }
743  $this->date_creation = $this->db->jdate($obj->datec);
744  if ($obj->fk_user_modif) {
745  $muser = new User($this->db);
746  $muser->fetch($obj->fk_user_modif);
747  $this->user_modif = $muser;
748  }
749  $this->date_modif = $this->db->jdate($obj->tms);
750  }
751  $this->db->free($result);
752  } else {
753  dol_print_error($this->db);
754  }
755  }
756 
762  public function getVentilExportCompta()
763  {
764  $banklineid = $this->fk_bank;
765 
766  $alreadydispatched = 0;
767 
768  $type = 'bank';
769 
770  $sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
771  $resql = $this->db->query($sql);
772  if ($resql) {
773  $obj = $this->db->fetch_object($resql);
774  if ($obj) {
775  $alreadydispatched = $obj->nb;
776  }
777  } else {
778  $this->error = $this->db->lasterror();
779  return -1;
780  }
781 
782  if ($alreadydispatched) {
783  return 1;
784  }
785  return 0;
786  }
787 
795  public function getKanbanView($option = '', $arraydata = null)
796  {
797  global $langs;
798 
799  $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
800 
801  $return = '<div class="box-flex-item box-flex-grow-zero">';
802  $return .= '<div class="info-box info-box-sm">';
803  $return .= '<span class="info-box-icon bg-infobox-action">';
804  $return .= img_picto('', $this->picto);
805  $return .= '</span>';
806  $return .= '<div class="info-box-content">';
807  $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
808  $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
809  if (property_exists($this, 'fk_bank')) {
810  $return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
811  }
812  if (property_exists($this, 'datep')) {
813  $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
814  }
815  if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
816  $return .= '<br><span class="opacitymedium">'.$langs->trans("Payment", $this->type_payment).'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
817  }
818  if (property_exists($this, 'accountancy_code')) {
819  $return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
820  }
821  if (property_exists($this, 'amount')) {
822  $return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
823  }
824  $return .= '</div>';
825  $return .= '</div>';
826  $return .= '</div>';
827  return $return;
828  }
829 
836  public function lengthAccountg($account)
837  {
838  include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
839 
840  /*
841  if (isModEnabled('accounting')) {
842  $accountingaccount = new AccountingAccount($db);
843  $accountingaccount->fetch('', $valuetoshow, 1);
844  }*/
845 
846  return length_accountg($account);
847  }
848 
855  public function lengthAccounta($account)
856  {
857  include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
858 
859  return length_accounta($account);
860  }
861 }
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
$object ref
Definition: info.php:78
Class to manage bank accounts.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class to manage various payments.
update_fk_bank($id_bank)
Update link between payment various and line generate into llx_bank.
getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0, $morecss='')
Send name clicable (with possibly the picto)
initAsSpecimen()
Initialise an instance with random values.
create($user)
Create in database.
lengthAccountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
LibStatut($status, $mode=0)
Return the label of a given status.
fetch($id, $user=null)
Load object in memory from database.
info($id)
Information on record.
lengthAccounta($account)
Return Auxiliary accounting account of thirdparties with defined length.
check()
Check if a miscellaneous payment can be created into database.
__construct(DoliDB $db)
Constructor.
getVentilExportCompta()
Return if a various payment linked to a bank line id was dispatched into bookkeeping.
getLibStatut($mode=0)
Return the label of the status.
update($user=null, $notrigger=0)
Update database.
getKanbanView($option='', $arraydata=null)
Return clicable link of object (with eventually picto)
Class to manage Dolibarr users.
Definition: user.class.php:48
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)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.