dolibarr  7.0.0-beta
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@capnetworks.com>
6  * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2014 Marcos GarcĂ­a <marcosgdf@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
28 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
31 
35 class PaiementFourn extends Paiement
36 {
37  public $element='payment_supplier';
38  public $table_element='paiementfourn';
39  public $picto = 'payment';
40 
41  var $statut; //Status of payment. 0 = unvalidated; 1 = validated
42  // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
43  // fk_paiement dans llx_paiement_facture est le rowid du paiement
44 
49  public $type_libelle;
50 
55  public $type_code;
56 
62  function __construct($db)
63  {
64  $this->db = $db;
65  }
66 
75  function fetch($id, $ref='', $fk_bank='')
76  {
77  $error=0;
78 
79  $sql = 'SELECT p.rowid, p.ref, p.entity, p.datep as dp, p.amount, p.statut, p.fk_bank,';
80  $sql.= ' c.code as paiement_code, c.libelle as paiement_type,';
81  $sql.= ' p.num_paiement, p.note, b.fk_account';
82  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p';
83  $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')';
84  $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
85  $sql.= ' WHERE p.entity IN ('.getEntity('facture_fourn').')';
86  if ($id > 0)
87  $sql.= ' AND p.rowid = '.$id;
88  else if ($ref)
89  $sql.= ' AND p.rowid = '.$ref;
90  else if ($fk_bank)
91  $sql.= ' AND p.fk_bank = '.$fk_bank;
92  //print $sql;
93 
94  $resql = $this->db->query($sql);
95  if ($resql)
96  {
97  $num = $this->db->num_rows($resql);
98  if ($num > 0)
99  {
100  $obj = $this->db->fetch_object($resql);
101  $this->id = $obj->rowid;
102  $this->ref = $obj->ref;
103  $this->entity = $obj->entity;
104  $this->date = $this->db->jdate($obj->dp);
105  $this->numero = $obj->num_paiement;
106  $this->bank_account = $obj->fk_account;
107  $this->bank_line = $obj->fk_bank;
108  $this->montant = $obj->amount;
109  $this->note = $obj->note;
110  $this->type_code = $obj->paiement_code;
111  $this->type_libelle = $obj->paiement_type;
112  $this->statut = $obj->statut;
113  $error = 1;
114  }
115  else
116  {
117  $error = -2; // TODO Use 0 instead
118  }
119  $this->db->free($resql);
120  }
121  else
122  {
123  dol_print_error($this->db);
124  $error = -1;
125  }
126  return $error;
127  }
128 
136  function create($user, $closepaidinvoices=0)
137  {
138  global $langs,$conf;
139 
140  $error = 0;
141  $way = $this->getWay();
142 
143  // Clean parameters
144  $totalamount = 0;
145  $totalamount_converted = 0;
146 
147  dol_syslog(get_class($this)."::create", LOG_DEBUG);
148 
149  if ($way == 'dolibarr')
150  {
151  $amounts = &$this->amounts;
152  $amounts_to_update = &$this->multicurrency_amounts;
153  }
154  else
155  {
156  $amounts = &$this->multicurrency_amounts;
157  $amounts_to_update = &$this->amounts;
158  }
159 
160  foreach ($amounts as $key => $value)
161  {
162  $value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value, $way, 'facture_fourn');
163  $totalamount_converted += $value_converted;
164  $amounts_to_update[$key] = price2num($value_converted, 'MT');
165 
166  $newvalue = price2num($value,'MT');
167  $amounts[$key] = $newvalue;
168  $totalamount += $newvalue;
169  }
170  $totalamount = price2num($totalamount);
171  $totalamount_converted = price2num($totalamount_converted);
172 
173  $this->db->begin();
174 
175  if ($totalamount <> 0) // On accepte les montants negatifs
176  {
177  $ref = $this->getNextNumRef('');
178  $now=dol_now();
179 
180  if ($way == 'dolibarr')
181  {
182  $total = $totalamount;
183  $mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value
184  }
185  else
186  {
187  $total = $totalamount_converted; // Maybe use price2num with MT for the converted value
188  $mtotal = $totalamount;
189  }
190 
191  $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
192  $sql.= 'ref, entity, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
193  $sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
194  $sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
195 
196  $resql = $this->db->query($sql);
197  if ($resql)
198  {
199  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'paiementfourn');
200 
201  // Insere tableau des montants / factures
202  foreach ($this->amounts as $key => $amount)
203  {
204  $facid = $key;
205  if (is_numeric($amount) && $amount <> 0)
206  {
207  $amount = price2num($amount);
208  $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn_facturefourn (fk_facturefourn, fk_paiementfourn, amount, multicurrency_amount)';
209  $sql .= ' VALUES ('.$facid.','. $this->id.',\''.$amount.'\', \''.$this->multicurrency_amounts[$key].'\')';
210  $resql=$this->db->query($sql);
211  if ($resql)
212  {
213  // If we want to closed payed invoices
214  if ($closepaidinvoices)
215  {
216  $invoice=new FactureFournisseur($this->db);
217  $invoice->fetch($facid);
218  $paiement = $invoice->getSommePaiement();
219  //$creditnotes=$invoice->getSumCreditNotesUsed();
220  $creditnotes=0;
221  //$deposits=$invoice->getSumDepositsUsed();
222  $deposits=0;
223  $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
224  $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
225  if ($remaintopay == 0)
226  {
227  $result=$invoice->set_paid($user, '', '');
228  }
229  else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
230  }
231  }
232  else
233  {
234  dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid);
235  $error++;
236  }
237 
238  }
239  else
240  {
241  dol_syslog('PaiementFourn::Create Montant non numerique',LOG_ERR);
242  }
243  }
244 
245  if (! $error)
246  {
247  // Call trigger
248  $result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
249  if ($result < 0) $error++;
250  // End call triggers
251  }
252  }
253  else
254  {
255  $this->error=$this->db->lasterror();
256  $error++;
257  }
258  }
259  else
260  {
261  $this->error="ErrorTotalIsNull";
262  dol_syslog('PaiementFourn::Create Error '.$this->error, LOG_ERR);
263  $error++;
264  }
265 
266  if ($totalamount <> 0 && $error == 0) // On accepte les montants negatifs
267  {
268  $this->amount=$total;
269  $this->total=$total;
270  $this->multicurrency_amount=$mtotal;
271  $this->db->commit();
272  dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
273  return $this->id;
274  }
275  else
276  {
277  $this->db->rollback();
278  return -1;
279  }
280  }
281 
282 
291  function delete($notrigger=0)
292  {
293  global $conf, $user, $langs;
294 
295  $bank_line_id = $this->bank_line;
296 
297  $this->db->begin();
298 
299  // Verifier si paiement porte pas sur une facture a l'etat payee
300  // Si c'est le cas, on refuse la suppression
301  $billsarray=$this->getBillsArray('paye=1');
302  if (is_array($billsarray))
303  {
304  if (count($billsarray))
305  {
306  $this->error="ErrorCantDeletePaymentSharedWithPayedInvoice";
307  $this->db->rollback();
308  return -1;
309  }
310  }
311  else
312  {
313  $this->db->rollback();
314  return -2;
315  }
316 
317  // Verifier si paiement ne porte pas sur ecriture bancaire rapprochee
318  // Si c'est le cas, on refuse le delete
319  if ($bank_line_id)
320  {
321  $accline = new AccountLine($this->db);
322  $accline->fetch($bank_line_id);
323  if ($accline->rappro)
324  {
325  $this->error="ErrorCantDeletePaymentReconciliated";
326  $this->db->rollback();
327  return -3;
328  }
329  }
330 
331  // Efface la ligne de paiement (dans paiement_facture et paiement)
332  $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn';
333  $sql.= ' WHERE fk_paiementfourn = '.$this->id;
334  $resql = $this->db->query($sql);
335  if ($resql)
336  {
337  $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiementfourn';
338  $sql.= ' WHERE rowid = '.$this->id;
339  $result = $this->db->query($sql);
340  if (! $result)
341  {
342  $this->error=$this->db->error();
343  $this->db->rollback();
344  return -3;
345  }
346 
347  // Supprimer l'ecriture bancaire si paiement lie a ecriture
348  if ($bank_line_id)
349  {
350  $accline = new AccountLine($this->db);
351  $result=$accline->fetch($bank_line_id);
352  if ($result > 0) // If result = 0, record not found, we don't try to delete
353  {
354  $result=$accline->delete($user);
355  }
356  if ($result < 0)
357  {
358  $this->error=$accline->error;
359  $this->db->rollback();
360  return -4;
361  }
362  }
363 
364  if (! $notrigger)
365  {
366  // Appel des triggers
367  $result=$this->call_trigger('PAYMENT_SUPPLIER_DELETE', $user);
368  if ($result < 0)
369  {
370  $this->db->rollback();
371  return -1;
372  }
373  // Fin appel triggers
374  }
375 
376  $this->db->commit();
377  return 1;
378  }
379  else
380  {
381  $this->error=$this->db->error;
382  $this->db->rollback();
383  return -5;
384  }
385  }
386 
393  function info($id)
394  {
395  $sql = 'SELECT c.rowid, datec, fk_user_author as fk_user_creat, tms';
396  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c';
397  $sql.= ' WHERE c.rowid = '.$id;
398 
399  $resql = $this->db->query($sql);
400  if ($resql)
401  {
402  $num = $this->db->num_rows($resql);
403  if ($num)
404  {
405  $obj = $this->db->fetch_object($resql);
406  $this->id = $obj->rowid;
407 
408  if ($obj->fk_user_creat)
409  {
410  $cuser = new User($this->db);
411  $cuser->fetch($obj->fk_user_creat);
412  $this->user_creation = $cuser;
413  }
414  if ($obj->fk_user_modif)
415  {
416  $muser = new User($this->db);
417  $muser->fetch($obj->fk_user_modif);
418  $this->user_modification = $muser;
419  }
420  $this->date_creation = $this->db->jdate($obj->datec);
421  $this->date_modification = $this->db->jdate($obj->tms);
422  }
423  $this->db->free($resql);
424  }
425  else
426  {
427  dol_print_error($this->db);
428  }
429  }
430 
437  function getBillsArray($filter='')
438  {
439  $sql = 'SELECT fk_facturefourn';
440  $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf, '.MAIN_DB_PREFIX.'facture_fourn as f';
441  $sql.= ' WHERE pf.fk_facturefourn = f.rowid AND fk_paiementfourn = '.$this->id;
442  if ($filter) $sql.= ' AND '.$filter;
443 
444  dol_syslog(get_class($this).'::getBillsArray', LOG_DEBUG);
445  $resql = $this->db->query($sql);
446  if ($resql)
447  {
448  $i=0;
449  $num=$this->db->num_rows($resql);
450  $billsarray=array();
451 
452  while ($i < $num)
453  {
454  $obj = $this->db->fetch_object($resql);
455  $billsarray[$i]=$obj->fk_facturefourn;
456  $i++;
457  }
458 
459  return $billsarray;
460  }
461  else
462  {
463  $this->error=$this->db->error();
464  dol_syslog(get_class($this).'::getBillsArray Error '.$this->error);
465  return -1;
466  }
467  }
468 
475  function getLibStatut($mode=0)
476  {
477  return $this->LibStatut($this->statut,$mode);
478  }
479 
487  function LibStatut($status,$mode=0)
488  {
489  global $langs;
490 
491  $langs->load('compta');
492  /*if ($mode == 0)
493  {
494  if ($status == 0) return $langs->trans('ToValidate');
495  if ($status == 1) return $langs->trans('Validated');
496  }
497  if ($mode == 1)
498  {
499  if ($status == 0) return $langs->trans('ToValidate');
500  if ($status == 1) return $langs->trans('Validated');
501  }
502  if ($mode == 2)
503  {
504  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
505  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
506  }
507  if ($mode == 3)
508  {
509  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
510  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
511  }
512  if ($mode == 4)
513  {
514  if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
515  if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
516  }
517  if ($mode == 5)
518  {
519  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
520  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
521  }
522  if ($mode == 6)
523  {
524  if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
525  if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
526  }*/
527  return '';
528  }
529 
530 
540  function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0)
541  {
542  global $langs;
543 
544  $result='';
545  $text=$this->ref; // Sometimes ref contains label
546  if (preg_match('/^\((.*)\)$/i',$text,$reg)) {
547  // Label generique car entre parentheses. On l'affiche en le traduisant
548  if ($reg[1]=='paiement') $reg[1]='Payment';
549  $text=$langs->trans($reg[1]);
550  }
551  $label = $langs->trans("ShowPayment").': '.$text;
552 
553  $linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
554  $linkend = '</a>';
555 
556  $result .= $linkstart;
557  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);
558  if ($withpicto != 2) $result.= $this->ref;
559  $result .= $linkend;
560 
561  return $result;
562  }
563 
572  function initAsSpecimen($option='')
573  {
574  global $user,$langs,$conf;
575 
576  $now=dol_now();
577  $arraynow=dol_getdate($now);
578  $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
579 
580  // Initialize parameters
581  $this->id=0;
582  $this->ref = 'SPECIMEN';
583  $this->specimen=1;
584  $this->facid = 1;
585  $this->datepaye = $nownotime;
586  }
587 
596  function getNextNumRef($soc,$mode='next')
597  {
598  global $conf, $db, $langs;
599  $langs->load("bills");
600 
601  // Clean parameters (if not defined or using deprecated value)
602  if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
603  else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='brodator') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_brodator';
604  else if ($conf->global->SUPPLIER_PAYMENT_ADDON=='bronan') $conf->global->SUPPLIER_PAYMENT_ADDON='mod_supplier_payment_bronan';
605 
606  if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON))
607  {
608  $mybool=false;
609 
610  $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
611  $classname = $conf->global->SUPPLIER_PAYMENT_ADDON;
612 
613  // Include file with class
614  $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
615 
616  foreach ($dirmodels as $reldir) {
617 
618  $dir = dol_buildpath($reldir."core/modules/supplier_payment/");
619 
620  // Load file with numbering class (if found)
621  if (is_file($dir.$file) && is_readable($dir.$file))
622  {
623  $mybool |= include_once $dir . $file;
624  }
625  }
626 
627  // For compatibility
628  if (! $mybool)
629  {
630  $file = $conf->global->SUPPLIER_PAYMENT_ADDON.".php";
631  $classname = "mod_supplier_payment_".$conf->global->SUPPLIER_PAYMENT_ADDON;
632  $classname = preg_replace('/\-.*$/','',$classname);
633  // Include file with class
634  foreach ($conf->file->dol_document_root as $dirroot)
635  {
636  $dir = $dirroot."/core/modules/supplier_payment/";
637 
638  // Load file with numbering class (if found)
639  if (is_file($dir.$file) && is_readable($dir.$file)) {
640  $mybool |= include_once $dir . $file;
641  }
642  }
643  }
644 
645  if (! $mybool)
646  {
647  dol_print_error('',"Failed to include file ".$file);
648  return '';
649  }
650 
651  $obj = new $classname();
652  $numref = "";
653  $numref = $obj->getNextValue($soc,$this);
654 
659  if ($mode != 'last' && !$numref) {
660  dol_print_error($db,"SupplierPayment::getNextNumRef ".$obj->error);
661  return "";
662  }
663 
664  return $numref;
665  }
666  else
667  {
668  $langs->load("errors");
669  print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
670  return "";
671  }
672  }
673 
684  public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
685  {
686  global $conf, $user, $langs;
687 
688  $langs->load("suppliers");
689 
690  // Set the model on the model name to use
691  if (empty($modele))
692  {
693  if (! empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF))
694  {
695  $modele = $conf->global->SUPPLIER_PAYMENT_ADDON_PDF;
696  }
697  else
698  {
699  $modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation
700  }
701  }
702 
703  if (empty($modele))
704  {
705  return 0;
706  }
707  else
708  {
709  $modelpath = "core/modules/supplier_payment/doc/";
710 
711  return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
712  }
713  }
714 
715 
716 
722  function getWay()
723  {
724  global $conf;
725 
726  $way = 'dolibarr';
727  if (!empty($conf->multicurrency->enabled))
728  {
729  foreach ($this->multicurrency_amounts as $value)
730  {
731  if (!empty($value)) // one value found then payment is in invoice currency
732  {
733  $way = 'customer';
734  break;
735  }
736  }
737  }
738 
739  return $way;
740  }
741 
742 
749  function fetch_thirdparty($force_thirdparty_id=0)
750  {
751  require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
752 
753  if (empty($force_thirdparty_id))
754  {
755  $billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first supplier invoice to get him
756  if (!empty($billsarray))
757  {
758  $supplier_invoice = new FactureFournisseur($this->db);
759  if ($supplier_invoice->fetch($billsarray[0]) > 0)
760  {
761  $force_thirdparty_id = $supplier_invoice->fk_soc;
762  }
763  }
764  }
765 
766  return parent::fetch_thirdparty($force_thirdparty_id);
767  }
768 
769 }
initAsSpecimen($option='')
Initialise an instance with random values.
LibStatut($status, $mode=0)
Renvoi le libelle d'un statut donne.
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...
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:39
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.
getEntity($element, $shared=1, $forceentity=null)
Get list of entity id to use.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
getLibStatut($mode=0)
Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) ...
dol_now($mode='gmt')
Return date for now.
generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Create a document onto disk according to template model.
fetch_thirdparty($force_thirdparty_id=0)
Load the third party of object, from id into this->thirdparty.
print
Draft customers invoices.
Definition: index.php:91
info($id)
Information on object.
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:1013
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.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is '...