dolibarr  9.0.0
paiementfourn.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
5  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
8  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
9  * Copyright (C) 2018 Frédéric France <frederic.francenetlogic.fr>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
30 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
33 
37 class PaiementFourn extends Paiement
38 {
42  public $element='payment_supplier';
43 
47  public $table_element='paiementfourn';
48 
49  public $picto = 'payment';
50 
51  var $statut; //Status of payment. 0 = unvalidated; 1 = validated
52  // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
53  // fk_paiement dans llx_paiement_facture est le rowid du paiement
54 
59  public $type_libelle;
60 
65  public $type_code;
66 
72  function __construct($db)
73  {
74  $this->db = $db;
75  }
76 
85  function fetch($id, $ref='', $fk_bank='')
86  {
87  $error=0;
88 
89  $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
90  $sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
91  $sql.= ' p.num_paiement, p.note, b.fk_account';
92  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
93  $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
94  $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
95  $sql.= ' WHERE p.entity IN ('.getEntity('facture_fourn').')';
96  if ($id > 0)
97  $sql.= ' AND p.rowid = '.$id;
98  else if ($ref)
99  $sql.= ' AND p.rowid = '.$ref;
100  else if ($fk_bank)
101  $sql.= ' AND p.fk_bank = '.$fk_bank;
102  //print $sql;
103 
104  $resql = $this->db->query($sql);
105  if ($resql)
106  {
107  $num = $this->db->num_rows($resql);
108  if ($num > 0)
109  {
110  $obj = $this->db->fetch_object($resql);
111  $this->id = $obj->rowid;
112  $this->ref = $obj->ref;
113  $this->entity = $obj->entity;
114  $this->date = $this->db->jdate($obj->dp);
115  $this->datepaye = $this->db->jdate($obj->dp);
116  $this->numero = $obj->num_paiement;
117  $this->num_paiement = $obj->num_paiement;
118  $this->bank_account = $obj->fk_account;
119  $this->bank_line = $obj->fk_bank;
120  $this->montant = $obj->amount;
121  $this->note = $obj->note;
122  $this->type_code = $obj->paiement_code;
123  $this->type_libelle = $obj->paiement_type;
124  $this->statut = $obj->statut;
125  $error = 1;
126  }
127  else
128  {
129  $error = -2; // TODO Use 0 instead
130  }
131  $this->db->free($resql);
132  }
133  else
134  {
135  dol_print_error($this->db);
136  $error = -1;
137  }
138  return $error;
139  }
140 
148  function create($user, $closepaidinvoices=0)
149  {
150  global $langs,$conf;
151 
152  $error = 0;
153  $way = $this->getWay();
154 
155  // Clean parameters
156  $totalamount = 0;
157  $totalamount_converted = 0;
158 
159  dol_syslog(get_class($this)."::create", LOG_DEBUG);
160 
161  if ($way == 'dolibarr')
162  {
163  $amounts = &$this->amounts;
164  $amounts_to_update = &$this->multicurrency_amounts;
165  }
166  else
167  {
168  $amounts = &$this->multicurrency_amounts;
169  $amounts_to_update = &$this->amounts;
170  }
171 
172  foreach ($amounts as $key => $value)
173  {
174  $value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value, $way, 'facture_fourn');
175  $totalamount_converted += $value_converted;
176  $amounts_to_update[$key] = price2num($value_converted, 'MT');
177 
178  $newvalue = price2num($value,'MT');
179  $amounts[$key] = $newvalue;
180  $totalamount += $newvalue;
181  }
182  $totalamount = price2num($totalamount);
183  $totalamount_converted = price2num($totalamount_converted);
184 
185  $this->db->begin();
186 
187  if ($totalamount <> 0) // On accepte les montants negatifs
188  {
189  $ref = $this->getNextNumRef('');
190  $now=dol_now();
191 
192  if ($way == 'dolibarr')
193  {
194  $total = $totalamount;
195  $mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value
196  }
197  else
198  {
199  $total = $totalamount_converted; // Maybe use price2num with MT for the converted value
200  $mtotal = $totalamount;
201  }
202 
203  $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
204  $sql.= 'ref, entity, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
205  $sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
206  $sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
207 
208  $resql = $this->db->query($sql);
209  if ($resql)
210  {
211  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'paiementfourn');
212 
213  // Insere tableau des montants / factures
214  foreach ($this->amounts as $key => $amount)
215  {
216  $facid = $key;
217  if (is_numeric($amount) && $amount <> 0)
218  {
219  $amount = price2num($amount);
220  $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount, multicurrency_amount)';
221  $sql .= ' VALUES ('.$facid.','. $this->id.',\''.$amount.'\', \''.$this->multicurrency_amounts[$key].'\')';
222  $resql=$this->db->query($sql);
223  if ($resql)
224  {
225  $invoice=new FactureFournisseur($this->db);
226  $invoice->fetch($facid);
227 
228  // If we want to closed payed invoices
229  if ($closepaidinvoices)
230  {
231  $paiement = $invoice->getSommePaiement();
232  //$creditnotes=$invoice->getSumCreditNotesUsed();
233  $creditnotes=0;
234  //$deposits=$invoice->getSumDepositsUsed();
235  $deposits=0;
236  $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
237  $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
238  if ($remaintopay == 0)
239  {
240  $result=$invoice->set_paid($user, '', '');
241  }
242  else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
243  }
244 
245  // Regenerate documents of invoices
246  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
247  {
248  $outputlangs = $langs;
249  if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
250  if (! empty($newlang)) {
251  $outputlangs = new Translate("", $conf);
252  $outputlangs->setDefaultLang($newlang);
253  }
254  $ret = $invoice->fetch($facid); // Reload to get new records
255  $result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
256  if ($result < 0) {
257  setEventMessages($invoice->error, $invoice->errors, 'errors');
258  $error++;
259  }
260  }
261  }
262  else
263  {
264  $this->error=$this->db->lasterror();
265  $error++;
266  }
267  }
268  else
269  {
270  dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.');
271  }
272  }
273 
274  if (! $error)
275  {
276  // Call trigger
277  $result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
278  if ($result < 0) $error++;
279  // End call triggers
280  }
281  }
282  else
283  {
284  $this->error=$this->db->lasterror();
285  $error++;
286  }
287  }
288  else
289  {
290  $this->error="ErrorTotalIsNull";
291  dol_syslog('PaiementFourn::Create Error '.$this->error, LOG_ERR);
292  $error++;
293  }
294 
295  if ($totalamount <> 0 && $error == 0) // On accepte les montants negatifs
296  {
297  $this->amount=$total;
298  $this->total=$total;
299  $this->multicurrency_amount=$mtotal;
300  $this->db->commit();
301  dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
302  return $this->id;
303  }
304  else
305  {
306  $this->db->rollback();
307  return -1;
308  }
309  }
310 
311 
320  function delete($notrigger=0)
321  {
322  global $conf, $user, $langs;
323 
324  $bank_line_id = $this->bank_line;
325 
326  $this->db->begin();
327 
328  // Verifier si paiement porte pas sur une facture a l'etat payee
329  // Si c'est le cas, on refuse la suppression
330  $billsarray=$this->getBillsArray('paye=1');
331  if (is_array($billsarray))
332  {
333  if (count($billsarray))
334  {
335  $this->error="ErrorCantDeletePaymentSharedWithPayedInvoice";
336  $this->db->rollback();
337  return -1;
338  }
339  }
340  else
341  {
342  $this->db->rollback();
343  return -2;
344  }
345 
346  // Verifier si paiement ne porte pas sur ecriture bancaire rapprochee
347  // Si c'est le cas, on refuse le delete
348  if ($bank_line_id)
349  {
350  $accline = new AccountLine($this->db);
351  $accline->fetch($bank_line_id);
352  if ($accline->rappro)
353  {
354  $this->error="ErrorCantDeletePaymentReconciliated";
355  $this->db->rollback();
356  return -3;
357  }
358  }
359 
360  // Efface la ligne de paiement (dans paiement_facture et paiement)
361  $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn';
362  $sql.= ' WHERE fk_paiementfourn = '.$this->id;
363  $resql = $this->db->query($sql);
364  if ($resql)
365  {
366  $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn';
367  $sql.= ' WHERE rowid = '.$this->id;
368  $result = $this->db->query($sql);
369  if (! $result)
370  {
371  $this->error=$this->db->error();
372  $this->db->rollback();
373  return -3;
374  }
375 
376  // Supprimer l'ecriture bancaire si paiement lie a ecriture
377  if ($bank_line_id)
378  {
379  $accline = new AccountLine($this->db);
380  $result=$accline->fetch($bank_line_id);
381  if ($result > 0) // If result = 0, record not found, we don't try to delete
382  {
383  $result=$accline->delete($user);
384  }
385  if ($result < 0)
386  {
387  $this->error=$accline->error;
388  $this->db->rollback();
389  return -4;
390  }
391  }
392 
393  if (! $notrigger)
394  {
395  // Appel des triggers
396  $result=$this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user);
397  if ($result < 0)
398  {
399  $this->db->rollback();
400  return -1;
401  }
402  // Fin appel triggers
403  }
404 
405  $this->db->commit();
406  return 1;
407  }
408  else
409  {
410  $this->error=$this->db->error;
411  $this->db->rollback();
412  return -5;
413  }
414  }
415 
422  function info($id)
423  {
424  $sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms';
425  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
426  $sql.= ' WHERE c.rowid = '.$id;
427 
428  $resql = $this->db->query($sql);
429  if ($resql)
430  {
431  $num = $this->db->num_rows($resql);
432  if ($num)
433  {
434  $obj = $this->db->fetch_object($resql);
435  $this->id = $obj->rowid;
436 
437  if ($obj->fk_user_creat)
438  {
439  $cuser = new User($this->db);
440  $cuser->fetch($obj->fk_user_creat);
441  $this->user_creation = $cuser;
442  }
443  if ($obj->fk_user_modif)
444  {
445  $muser = new User($this->db);
446  $muser->fetch($obj->fk_user_modif);
447  $this->user_modification = $muser;
448  }
449  $this->date_creation = $this->db->jdate($obj->datec);
450  $this->date_modification = $this->db->jdate($obj->tms);
451  }
452  $this->db->free($resql);
453  }
454  else
455  {
456  dol_print_error($this->db);
457  }
458  }
459 
466  function getBillsArray($filter='')
467  {
468  $sql = 'SELECT fk_facturefourn';
469  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f';
470  $sql.= ' WHERE pf.fk_facturefourn = f.rowid AND fk_paiementfourn = '.$this->id;
471  if ($filter) $sql.= ' AND '.$filter;
472 
473  dol_syslog(get_class($this).'::getBillsArray', LOG_DEBUG);
474  $resql = $this->db->query($sql);
475  if ($resql)
476  {
477  $i=0;
478  $num=$this->db->num_rows($resql);
479  $billsarray=array();
480 
481  while ($i < $num)
482  {
483  $obj = $this->db->fetch_object($resql);
484  $billsarray[$i]=$obj->fk_facturefourn;
485  $i++;
486  }
487 
488  return $billsarray;
489  }
490  else
491  {
492  $this->error=$this->db->error();
493  dol_syslog(get_class($this).'::getBillsArray Error '.$this->error);
494  return -1;
495  }
496  }
497 
504  function getLibStatut($mode=0)
505  {
506  return $this->LibStatut($this->statut,$mode);
507  }
508 
509  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
517  function LibStatut($status,$mode=0)
518  {
519  // phpcs:enable
520  global $langs;
521 
522  $langs->load('compta');
523  /*if ($mode == 0)
524  {
525  if ($status == 0) return $langs->trans('ToValidate');
526  if ($status == 1) return $langs->trans('Validated');
527  }
528  if ($mode == 1)
529  {
530  if ($status == 0) return $langs->trans('ToValidate');
531  if ($status == 1) return $langs->trans('Validated');
532  }
533  if ($mode == 2)
534  {
535  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
536  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
537  }
538  if ($mode == 3)
539  {
540  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
541  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
542  }
543  if ($mode == 4)
544  {
545  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
546  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
547  }
548  if ($mode == 5)
549  {
550  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
551  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
552  }
553  if ($mode == 6)
554  {
555  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
556  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
557  }*/
558  return '';
559  }
560 
561 
571  function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0)
572  {
573  global $langs;
574 
575  $result='';
576 
577  $text=$this->ref; // Sometimes ref contains label
578  if (preg_match('/^\((.*)\)$/i',$text,$reg)) {
579  // Label generique car entre parentheses. On l'affiche en le traduisant
580  if ($reg[1]=='paiement') $reg[1]='Payment';
581  $text=$langs->trans($reg[1]);
582  }
583 
584  $label = '<u>'.$langs->trans("ShowPayment").'</u><br>';
585  $label.= '<strong>'.$langs->trans("Ref").':</strong> '.$text;
586  $label.= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
587 
588  $linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
589  $linkend = '</a>';
590 
591  $result .= $linkstart;
592  if ($withpicto) $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);
593  if ($withpicto != 2) $result.= $this->ref;
594  $result .= $linkend;
595 
596  return $result;
597  }
598 
607  function initAsSpecimen($option='')
608  {
609  global $user,$langs,$conf;
610 
611  $now=dol_now();
612  $arraynow=dol_getdate($now);
613  $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
614 
615  // Initialize parameters
616  $this->id=0;
617  $this->ref = 'SPECIMEN';
618  $this->specimen=1;
619  $this->facid = 1;
620  $this->socid = 1;
621  $this->datepaye = $nownotime;
622  }
623 
632  function getNextNumRef($soc,$mode='next')
633  {
634  global $conf, $db, $langs;
635  $langs->load("bills");
636 
637  // Clean parameters (if not defined or using deprecated value)
638  if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
639  else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='brodator') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_brodator';
640  else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='bronan') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
641 
642  if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON))
643  {
644  $mybool=false;
645 
646  $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
647  $classname = $conf->global->SUPPLIER_PAYMENT_ADDON;
648 
649  // Include file with class
650  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
651 
652  foreach ($dirmodels as $reldir) {
653 
654  $dir = dol_buildpath($reldir."core/modules/supplier_payment/");
655 
656  // Load file with numbering class (if found)
657  if (is_file($dir.$file) && is_readable($dir.$file))
658  {
659  $mybool |= include_once $dir . $file;
660  }
661  }
662 
663  // For compatibility
664  if ($mybool === false) {
665  $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
666  $classname = "mod_supplier_payment_".$conf->global->SUPPLIER_PAYMENT_ADDON;
667  $classname = preg_replace('/\-.*$/','',$classname);
668  // Include file with class
669  foreach ($conf->file->dol_document_root as $dirroot) {
670  $dir = $dirroot."/core/modules/supplier_payment/";
671 
672  // Load file with numbering class (if found)
673  if (is_file($dir.$file) && is_readable($dir.$file)) {
674  $mybool |= include_once $dir . $file;
675  }
676  }
677  }
678 
679  if ($mybool === false) {
680  dol_print_error('',"Failed to include file ".$file);
681  return '';
682  }
683 
684  $obj = new $classname();
685  $numref = "";
686  $numref = $obj->getNextValue($soc,$this);
687 
692  if ($mode != 'last' && !$numref) {
693  dol_print_error($db,"SupplierPayment::getNextNumRef ".$obj->error);
694  return "";
695  }
696 
697  return $numref;
698  }
699  else
700  {
701  $langs->load("errors");
702  print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
703  return "";
704  }
705  }
706 
718  public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
719  {
720  global $conf, $user, $langs;
721 
722  $langs->load("suppliers");
723 
724  // Set the model on the model name to use
725  if (empty($modele))
726  {
727  if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF))
728  {
729  $modele = $conf->global->SUPPLIER_PAYMENT_ADDON_PDF;
730  }
731  else
732  {
733  $modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation
734  }
735  }
736 
737  if (empty($modele))
738  {
739  return 0;
740  }
741  else
742  {
743  $modelpath = "core/modules/supplier_payment/doc/";
744 
745  return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
746  }
747  }
748 
749 
750 
756  function getWay()
757  {
758  global $conf;
759 
760  $way = 'dolibarr';
761  if (!empty($conf->multicurrency->enabled))
762  {
763  foreach ($this->multicurrency_amounts as $value)
764  {
765  if (!empty($value)) // one value found then payment is in invoice currency
766  {
767  $way = 'customer';
768  break;
769  }
770  }
771  }
772 
773  return $way;
774  }
775 
776 
777  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
784  function fetch_thirdparty($force_thirdparty_id=0)
785  {
786  // phpcs:enable
787  require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
788 
789  if (empty($force_thirdparty_id))
790  {
791  $billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first supplier invoice to get him
792  if (!empty($billsarray))
793  {
794  $supplier_invoice = new FactureFournisseur($this->db);
795  if ($supplier_invoice->fetch($billsarray[0]) > 0)
796  {
797  $force_thirdparty_id = $supplier_invoice->fk_soc;
798  }
799  }
800  }
801 
802  return parent::fetch_thirdparty($force_thirdparty_id);
803  }
804 }
initAsSpecimen($option='')
Initialise an instance with random values.
LibStatut($status, $mode=0)
Renvoi le libelle d&#39;un statut donne.
print
Draft customers invoices.
Definition: index.php:91
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
getWay()
get the right way of payment
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
if(! empty($search_group)) natural_search(array("g.nom" g note
Definition: list.php:123
getNextNumRef($soc, $mode='next')
Return next reference of supplier invoice not already used (or last reference) according to numbering...
Class to manage Dolibarr users.
Definition: user.class.php:41
commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
Common function for all objects extending CommonObject for generating documents.
getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0)
Return clicable name (with picto eventually)
Class to manage bank transaction lines.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage suppliers invoices.
__construct($db)
Constructor.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
create($user, $closepaidinvoices=0)
Create payment in database.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
getBillsArray($filter='')
Return list of supplier invoices the payment point to.
Class to manage payments of customer invoices.
getLibStatut($mode=0)
Retourne le libelle du statut d&#39;une facture (brouillon, validee, abandonnee, payee) ...
dol_now($mode='gmt')
Return date for now.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
fetch_thirdparty($force_thirdparty_id=0)
Load the third party of object, from id into this->thirdparty.
info($id)
Information on object.
dol_getdate($timestamp, $fast=false)
Return an array with locale date info.
call_trigger($trigger_name, $user)
Call trigger based on this instance.
fetch($id, $ref='', $fk_bank='')
Load payment object.
Class to manage payments for supplier invoices.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Create a document onto disk according to template model.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)