dolibarr  18.0.0
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
5  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2013 Marcos GarcĂ­a <marcosgdf@gmail.com>
7  * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
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 <https://www.gnu.org/licenses/>.
21  */
22 
30 // Load Dolibarr environment
31 require '../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
36 if (isModEnabled("banque")) {
37  require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
38 }
39 if (isModEnabled('margin')) {
40  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
41 }
42 
43 // Load translation files required by the page
44 $langs->loadLangs(array('bills', 'banks', 'companies'));
45 
46 $id = GETPOST('id', 'int');
47 $ref = GETPOST('ref', 'alpha');
48 $action = GETPOST('action', 'aZ09');
49 $confirm = GETPOST('confirm', 'alpha');
50 $backtopage = GETPOST('backtopage', 'alpha');
51 
52 $socid = GETPOST('socid', 'int');
53 if ($socid < 0) {
54  $socid = 0;
55 }
56 
57 $object = new Paiement($db);
58 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
59 $hookmanager->initHooks(array('paymentcard', 'globalcard'));
60 
61 // Load object
62 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
63 
64 $result = restrictedArea($user, $object->element, $object->id, 'paiement'); // This also test permission on read invoice
65 
66 // Security check
67 if ($user->socid) {
68  $socid = $user->socid;
69 }
70 // Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
71 // It should be enough because all payments are done on invoices of the same thirdparty.
72 if ($socid && $socid != $object->thirdparty->id) {
74 }
75 
76 $error = 0;
77 
78 /*
79  * Actions
80  */
81 
82 if ($action == 'setnote' && $user->hasRight('facture', 'paiement')) {
83  $db->begin();
84 
85  $result = $object->update_note(GETPOST('note', 'restricthtml'));
86  if ($result > 0) {
87  $db->commit();
88  $action = '';
89  } else {
90  setEventMessages($object->error, $object->errors, 'errors');
91  $db->rollback();
92  }
93 }
94 
95 if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('facture', 'paiement')) {
96  $db->begin();
97 
98  $result = $object->delete();
99  if ($result > 0) {
100  $db->commit();
101 
102  if ($backtopage) {
103  header("Location: ".$backtopage);
104  exit;
105  } else {
106  header("Location: list.php");
107  exit;
108  }
109  } else {
110  $langs->load("errors");
111  setEventMessages($object->error, $object->errors, 'errors');
112  $db->rollback();
113  }
114 }
115 
116 if ($action == 'confirm_validate' && $confirm == 'yes' && $user->hasRight('facture', 'paiement')) {
117  $db->begin();
118 
119  if ($object->validate($user) > 0) {
120  $db->commit();
121 
122  // Loop on each invoice linked to this payment to rebuild PDF
123  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
124  $outputlangs = $langs;
125  if (GETPOST('lang_id', 'aZ09')) {
126  $outputlangs = new Translate("", $conf);
127  $outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
128  }
129 
130  $hidedetails = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
131  $hidedesc = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
132  $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
133 
134  $sql = 'SELECT f.rowid as facid';
135  $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
136  $sql .= ' WHERE pf.fk_facture = f.rowid';
137  $sql .= ' AND f.fk_soc = s.rowid';
138  $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
139  $sql .= ' AND pf.fk_paiement = '.((int) $object->id);
140  $resql = $db->query($sql);
141  if ($resql) {
142  $i = 0;
143  $num = $db->num_rows($resql);
144 
145  if ($num > 0) {
146  while ($i < $num) {
147  $objp = $db->fetch_object($resql);
148 
149  $invoice = new Facture($db);
150 
151  if ($invoice->fetch($objp->facid) <= 0) {
152  $error++;
153  setEventMessages($invoice->error, $invoice->errors, 'errors');
154  break;
155  }
156 
157  if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
158  $error++;
159  setEventMessages($invoice->error, $invoice->errors, 'errors');
160  break;
161  }
162 
163  $i++;
164  }
165  }
166 
167  $db->free($resql);
168  } else {
169  $error++;
170  setEventMessages($db->error, $db->errors, 'errors');
171  }
172  }
173 
174  if (! $error) {
175  header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
176  exit;
177  }
178  } else {
179  $db->rollback();
180 
181  $langs->load("errors");
182  setEventMessages($object->error, $object->errors, 'errors');
183  }
184 }
185 
186 if ($action == 'setnum_paiement' && GETPOST('num_paiement') && $user->hasRight('facture', 'paiement')) {
187  $res = $object->update_num(GETPOST('num_paiement'));
188  if ($res === 0) {
189  setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');
190  } else {
191  setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors');
192  }
193 }
194 
195 if ($action == 'setdatep' && GETPOST('datepday') && $user->hasRight('facture', 'paiement')) {
196  $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'));
197  $res = $object->update_date($datepaye);
198  if ($res === 0) {
199  setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs');
200  } else {
201  setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors');
202  }
203 }
204 
205 if ($action == 'createbankpayment' && $user->hasRight('facture', 'paiement')) {
206  $db->begin();
207 
208  // Create the record into bank for the amount of payment $object
209  if (!$error) {
210  $label = '(CustomerInvoicePayment)';
211  if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
212  $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
213  }
214 
215  $bankaccountid = GETPOST('accountid', 'int');
216  if ($bankaccountid > 0) {
217  $object->paiementcode = $object->type_code;
218  $object->amounts = $object->getAmountsArray();
219 
220  $result = $object->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
221  if ($result < 0) {
222  setEventMessages($object->error, $object->errors, 'errors');
223  $error++;
224  }
225  } else {
226  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
227  $error++;
228  }
229  }
230 
231 
232  if (!$error) {
233  $db->commit();
234  } else {
235  $db->rollback();
236  }
237 }
238 
239 
240 /*
241  * View
242  */
243 
244 llxHeader('', $langs->trans("Payment"));
245 
246 $thirdpartystatic = new Societe($db);
247 
248 $result = $object->fetch($id, $ref);
249 if ($result <= 0) {
250  dol_print_error($db, 'Payment '.$id.' not found in database');
251  exit;
252 }
253 
254 $form = new Form($db);
255 
256 $head = payment_prepare_head($object);
257 
258 print dol_get_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment');
259 
260 // Confirmation of payment delete
261 if ($action == 'delete') {
262  print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
263 }
264 
265 // Confirmation of payment validation
266 if ($action == 'valide') {
267  $facid = $_GET['facid'];
268  print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_validate', '', 0, 2);
269 }
270 
271 $linkback = '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
272 
273 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '');
274 
275 
276 print '<div class="fichecenter">';
277 print '<div class="underbanner clearboth"></div>';
278 
279 print '<table class="border centpercent">'."\n";
280 
281 // Date payment
282 print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $user->hasRight('facture', 'paiement')).'</td><td>';
283 print $form->editfieldval("Date", 'datep', $object->date, $object, $user->hasRight('facture', 'paiement'), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'), '', 0, '', 'id', 'tzuser');
284 print '</td></tr>';
285 
286 // Payment type (VIR, LIQ, ...)
287 $labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
288 print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype;
289 print $object->num_payment ? ' - '.$object->num_payment : '';
290 print '</td></tr>';
291 
292 // Amount
293 print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount, '', $langs, 0, -1, -1, $conf->currency).'</td></tr>';
294 
295 $disable_delete = 0;
296 // Bank account
297 if (isModEnabled("banque")) {
298  $bankline = new AccountLine($db);
299 
300  if ($object->fk_account > 0) {
301  $bankline->fetch($object->bank_line);
302  if ($bankline->rappro) {
303  $disable_delete = 1;
304  $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
305  }
306 
307  print '<tr>';
308  print '<td>'.$langs->trans('BankAccount').'</td>';
309  print '<td>';
310  $accountstatic = new Account($db);
311  $accountstatic->fetch($bankline->fk_account);
312  print $accountstatic->getNomUrl(1);
313  print '</td>';
314  print '</tr>';
315  }
316 }
317 
318 // Payment numero
319 /*
320 $titlefield=$langs->trans('Numero').' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
321 print '<tr><td>'.$form->editfieldkey($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
322 print $form->editfieldval($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
323 print '</td></tr>';
324 
325 // Check transmitter
326 $titlefield=$langs->trans('CheckTransmitter').' <em>('.$langs->trans("ChequeMaker").')</em>';
327 print '<tr><td>'.$form->editfieldkey($titlefield,'chqemetteur',$object->,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
328 print $form->editfieldval($titlefield,'chqemetteur',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeMakeUpdateSucceeded'));
329 print '</td></tr>';
330 
331 // Bank name
332 $titlefield=$langs->trans('Bank').' <em>('.$langs->trans("ChequeBank").')</em>';
333 print '<tr><td>'.$form->editfieldkey($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
334 print $form->editfieldval($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeBankUpdateSucceeded'));
335 print '</td></tr>';
336 */
337 
338 // Bank account
339 if (isModEnabled("banque")) {
340  if ($object->fk_account > 0) {
341  if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) {
342  include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
343  $bordereau = new RemiseCheque($db);
344  $bordereau->fetch($bankline->fk_bordereau);
345 
346  print '<tr>';
347  print '<td>'.$langs->trans('CheckReceipt').'</td>';
348  print '<td>';
349  print $bordereau->getNomUrl(1);
350  print '</td>';
351  print '</tr>';
352  }
353  }
354 
355  print '<tr>';
356  print '<td>'.$langs->trans('BankTransactionLine').'</td>';
357  print '<td>';
358  if ($object->fk_account > 0) {
359  print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
360  } else {
361  $langs->load("admin");
362  print '<span class="opacitymedium">';
363  print $langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name"));
364  print '</span>';
365  if ($user->hasRight('facture', 'paiement')) {
366  // Try to guess $bankaccountidofinvoices that is ID of bank account defined on invoice.
367  // Return null if not found, return 0 if it has different value for at least 2 invoices, return the value if same on all invoices where a bank is defined.
368  $amountofpayments = $object->getAmountsArray();
369  $bankaccountidofinvoices = null;
370  foreach ($amountofpayments as $idinvoice => $amountofpayment) {
371  $tmpinvoice = new Facture($db);
372  $tmpinvoice->fetch($idinvoice);
373  if ($tmpinvoice->fk_account > 0 && $bankaccountidofinvoices !== 0) {
374  if (is_null($bankaccountidofinvoices)) {
375  $bankaccountidofinvoices = $tmpinvoice->fk_account;
376  } elseif ($bankaccountidofinvoices != $tmpinvoice->fk_account) {
377  $bankaccountidofinvoices = 0;
378  }
379  }
380  }
381 
382  print '<form method="POST" name="createbankpayment">';
383  print '<input type="hidden" name="token" value="'.newToken().'">';
384  print '<input type="hidden" name="action" value="createbankpayment">';
385  print '<input type="hidden" name="id" value="'.$object->id.'">';
386  print ' '.$langs->trans("ToCreateRelatedRecordIntoBank").': ';
387  print $form->select_comptes($bankaccountidofinvoices, 'accountid', 0, '', 2, '', 0, '', 1);
388  //print '<span class="opacitymedium">';
389  print '<input type="submit" class="button small smallpaddingimp" name="createbankpayment" value="'.$langs->trans("ClickHere").'">';
390  //print '</span>';
391  print '</form>';
392  }
393  }
394  print '</td>';
395  print '</tr>';
396 }
397 
398 // Comments
399 print '<tr><td class="tdtop">'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->hasRight('facture', 'paiement')).'</td><td>';
400 print $form->editfieldval("Note", 'note', $object->note, $object, $user->hasRight('facture', 'paiement'), 'textarea:'.ROWS_3.':90%');
401 print '</td></tr>';
402 
403 print '</table>';
404 
405 print '</div>';
406 
407 print dol_get_fiche_end();
408 
409 
410 /*
411  * List of invoices
412  */
413 
414 $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.total_ttc, f.paye, f.entity, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
415 $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
416 $sql .= ' WHERE pf.fk_facture = f.rowid';
417 $sql .= ' AND f.fk_soc = s.rowid';
418 $sql .= ' AND f.entity IN ('.getEntity('invoice').')';
419 $sql .= ' AND pf.fk_paiement = '.((int) $object->id);
420 $resql = $db->query($sql);
421 if ($resql) {
422  $num = $db->num_rows($resql);
423 
424  $i = 0;
425  $total = 0;
426 
427  print '<br>';
428 
429  print '<div class="div-table-responsive">';
430  print '<table class="noborder centpercent">';
431 
432  print '<tr class="liste_titre">';
433  print '<td>'.$langs->trans('Bill').'</td>';
434  print '<td>'.$langs->trans('Company').'</td>';
435  if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
436  print '<td>'.$langs->trans('Entity').'</td>';
437  }
438  //Add Margin
439  if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
440  print '<td class="right">'.$langs->trans('Margin').'</td>';
441  }
442  print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
443  print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
444  print '<td class="right">'.$langs->trans('RemainderToPay').'</td>';
445  print '<td class="right">'.$langs->trans('Status').'</td>';
446  print "</tr>\n";
447 
448  if ($num > 0) {
449  while ($i < $num) {
450  $objp = $db->fetch_object($resql);
451 
452  $thirdpartystatic->fetch($objp->socid);
453 
454  $invoice = new Facture($db);
455  $invoice->fetch($objp->facid);
456 
457  // Add Margin
458  if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
459  $formmargin = new FormMargin($db);
460  $marginInfo = array();
461  $invoice->fetch_lines();
462  $marginInfo = $formmargin->getMarginInfosArray($invoice);
463  }
464 
465  $paiement = $invoice->getSommePaiement();
466  $creditnotes = $invoice->getSumCreditNotesUsed();
467  $deposits = $invoice->getSumDepositsUsed();
468  $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT');
469  $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
470 
471  print '<tr class="oddeven">';
472 
473  // Invoice
474  print '<td>';
475  print $invoice->getNomUrl(1);
476  print "</td>\n";
477 
478  // Third party
479  print '<td class="tdoverflowmax150">';
480  print $thirdpartystatic->getNomUrl(1);
481  print '</td>';
482 
483  // Expected to pay
484  if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
485  print '<td>';
486  $mc->getInfo($objp->entity);
487  print $mc->label;
488  print '</td>';
489  }
490 
491  // Add margin
492  if (isModEnabled('margin') && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
493  print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
494  }
495 
496  // Expected to pay
497  print '<td class="right"><span class="amount">'.price($objp->total_ttc).'</span></td>';
498 
499  // Amount payed
500  print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
501 
502  // Remain to pay
503  print '<td class="right"><span class="amount">'.price($remaintopay).'</span></td>';
504 
505  // Status
506  print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
507 
508  print "</tr>\n";
509 
510  // If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
511  if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
512  $disable_delete = 1;
513  $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
514  }
515 
516  $total = $total + $objp->amount;
517  $i++;
518  }
519  }
520 
521 
522  print "</table>\n";
523  print '</div>';
524 
525  $db->free($resql);
526 } else {
527  dol_print_error($db);
528 }
529 
530 
531 
532 /*
533  * Actions Buttons
534  */
535 
536 print '<div class="tabsAction">';
537 
538 if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
539  if ($user->socid == 0 && $object->statut == 0 && $action == '') {
540  if ($user->hasRight('facture', 'paiement')) {
541  print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=valide&token='.newToken().'">'.$langs->trans('Valid').'</a>';
542  }
543  }
544 }
545 
546 if ($user->socid == 0 && $action == '') {
547  print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->hasRight('facture', 'paiement') && !$disable_delete);
548 }
549 
550 print '</div>';
551 
552 // End of page
553 llxFooter();
554 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:51
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Definition: functions.lib.php:1600
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:609
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:5107
Translate
Class to manage translations.
Definition: translate.class.php:30
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
FormMargin
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formmargin.class.php:29
Facture
Class to manage invoices.
Definition: facture.class.php:60
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2205
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5955
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8673
$sql
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
restrictedArea
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:353
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11654
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2177
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:207
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
Definition: functions.lib.php:1979
Facture\TYPE_CREDIT_NOTE
const TYPE_CREDIT_NOTE
Credit note invoice.
Definition: facture.class.php:417
Paiement
Class to manage payments of customer invoices.
Definition: paiement.class.php:43
dolGetButtonAction
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
Definition: functions.lib.php:11080
RemiseCheque
Class to manage cheque delivery receipts.
Definition: remisecheque.class.php:34
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
AccountLine
Class to manage bank transaction lines.
Definition: account.class.php:1880
price
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.
Definition: functions.lib.php:5829
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1164
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2968
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:156
Account
Class to manage bank accounts.
Definition: account.class.php:40