21if (!defined(
'NOLOGIN')) {
24if (!defined(
'NOCSRFCHECK')) {
25 define(
"NOCSRFCHECK", 1);
27if (!defined(
'NOIPCHECK')) {
28 define(
'NOIPCHECK',
'1');
30if (!defined(
'NOBROWSERNOTIF')) {
31 define(
'NOBROWSERNOTIF',
'1');
35$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
36if (is_numeric($entity)) {
37 define(
"DOLENTITY", $entity);
41if (!defined(
'USESUFFIXINLOG')) {
42 define(
'USESUFFIXINLOG',
'_stripeipn');
46require
'../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/ccountry.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/includes/stripe/stripe-php/init.php';
58require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
62if (GETPOSTISSET(
'connect')) {
63 if (GETPOSTISSET(
'test')) {
65 $service =
'StripeTest';
69 $service =
'StripeLive';
73 if (GETPOSTISSET(
'test')) {
75 $service =
'StripeTest';
79 $service =
'StripeLive';
84if (!isModEnabled(
'stripe')) {
88if (empty($endpoint_secret)) {
94 $user =
new User($db);
111$payload = @file_get_contents(
"php://input");
112$sig_header = empty($_SERVER[
"HTTP_STRIPE_SIGNATURE"]) ?
'' : $_SERVER[
"HTTP_STRIPE_SIGNATURE"];
116 $fh = fopen(DOL_DATA_ROOT.
'/dolibarr_stripeipn_payload.log',
'w+');
118 fwrite($fh,
dol_print_date(
dol_now(
'gmt'),
'standard').
' IPN Called. service='.$service.
' HTTP_STRIPE_SIGNATURE='.$sig_header.
"\n");
119 fwrite($fh, $payload);
121 dolChmod(DOL_DATA_ROOT.
'/dolibarr_stripeipn_payload.log');
128 $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret);
129}
catch (UnexpectedValueException $e) {
133 httponly_accessforbidden(
'Invalid signature. May be a hook for an event created by another Stripe env ? Check setup of your keys whsec_...', 400);
143if (isModEnabled(
'multicompany') && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
144 $sql =
"SELECT entity";
145 $sql .=
" FROM ".MAIN_DB_PREFIX.
"oauth_token";
146 $sql .=
" WHERE service = '".$db->escape($service).
"' and tokenstring LIKE '%".$db->escape($db->escapeforlike($event->account)).
"%'";
148 dol_syslog(get_class($db).
"::fetch", LOG_DEBUG);
149 $result = $db->query($sql);
151 if ($db->num_rows($result)) {
152 $obj = $db->fetch_object($result);
160 $ret = $mc->switchEntity($key);
174dol_syslog(
"***** Stripe IPN was called with event->type=".$event->type.
" service=".$service);
177if ($event->type ==
'payout.created') {
180 $result =
dolibarr_set_const($db, $service.
"_NEXTPAYOUT", date(
'Y-m-d H:i:s', $event->data->object->arrival_date),
'chaine', 0,
'', $conf->entity);
183 $subject = $societeName.
' - [NOTIFICATION] Stripe payout scheduled';
184 if (!empty($user->email)) {
195 $message =
"A bank transfer of ".price2num($event->data->object->amount / 100).
" ".$event->data->object->currency.
" should arrive in your account the ".
dol_print_date($event->data->object->arrival_date,
'dayhour');
211 $ret = $mailfile->sendfile();
216 http_response_code(500);
219} elseif ($event->type ==
'payout.paid') {
221 $result =
dolibarr_set_const($db, $service.
"_NEXTPAYOUT",
null,
'chaine', 0,
'', $conf->entity);
223 $langs->load(
"errors");
226 $label = $event->data->object->description;
227 $amount = $event->data->object->amount / 100;
228 $amount_to = $event->data->object->amount / 100;
229 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
231 $accountfrom =
new Account($db);
237 if (($accountto->id != $accountfrom->id) && empty($error)) {
238 $bank_line_id_from = 0;
239 $bank_line_id_to = 0;
247 $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (
float)
price2num($amount),
'',
'', $user);
249 if (!($bank_line_id_from > 0)) {
253 $bank_line_id_to = $accountto->addline($dateo, $typeto, $label,
price2num($amount),
'',
'', $user);
255 if (!($bank_line_id_to > 0)) {
260 $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.
'/compta/bank/line.php?rowid=',
'(banktransfert)',
'banktransfert');
262 if (!($result > 0)) {
266 $result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.
'/compta/bank/line.php?rowid=',
'(banktransfert)',
'banktransfert');
268 if (!($result > 0)) {
273 $subject = $societeName.
' - [NOTIFICATION] Stripe payout done';
274 if (!empty($user->email)) {
285 $message =
"A bank transfer of ".price2num($event->data->object->amount / 100).
" ".$event->data->object->currency.
" has been done to your account the ".
dol_print_date($event->data->object->arrival_date,
'dayhour');
301 $ret = $mailfile->sendfile();
306 http_response_code(500);
309} elseif ($event->type ==
'customer.source.created') {
311} elseif ($event->type ==
'customer.source.updated') {
313} elseif ($event->type ==
'customer.source.delete') {
315} elseif ($event->type ==
'customer.deleted') {
317 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_account WHERE key_account = '".$db->escape($event->data->object->id).
"' and site='stripe'";
320} elseif ($event->type ==
'payment_intent.succeeded') {
322 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
323 global $stripearrayofkeysbyenv;
325 $object = $event->data->object;
327 $ipaddress =
$object->metadata->ipaddress;
329 $currencyCodeType = strtoupper(
$object->currency);
330 $paymentmethodstripeid =
$object->payment_method;
331 $customer_id =
$object->customer;
333 $paymentTypeCode =
"";
334 $paymentTypeCodeInDolibarr =
"";
336 $payment_amountInDolibarr = 0;
338 dol_syslog(
"Try to find a payment in database for the payment_intent id = ".$TRANSACTIONID);
340 $sql =
"SELECT pi.rowid, pi.fk_facture, pi.fk_prelevement_bons, pi.amount, pi.type, pi.traite";
341 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pi";
342 $sql .=
" WHERE pi.ext_payment_id = '".$db->escape($TRANSACTIONID).
"'";
343 $sql .=
" AND pi.ext_payment_site = '".$db->escape($service).
"'";
345 $result = $db->query($sql);
347 $obj = $db->fetch_object($result);
349 if ($obj->type ==
'ban') {
350 if ($obj->traite == 1) {
354 $invoice_id = $obj->fk_facture;
355 $directdebitorcreditransfer_id = $obj->fk_prelevement_bons;
356 $payment_amountInDolibarr = $obj->amount;
357 $paymentTypeCodeInDolibarr = $obj->type;
359 dol_syslog(
"Found a request in database to pay with direct debit generated (pdid = ".$pdid.
" directdebitorcreditransfer_id=".$directdebitorcreditransfer_id.
")");
361 dol_syslog(
"Found a request in database not yet generated (pdid = ".$pdid.
" directdebitorcreditransfer_id=".$directdebitorcreditransfer_id.
"). Was the order deleted after being sent ?", LOG_WARNING);
364 if ($obj->type ==
'card' || empty($obj->type)) {
365 if ($obj->traite == 0) {
368 $invoice_id = $obj->fk_facture;
369 $payment_amountInDolibarr = $obj->amount;
370 $paymentTypeCodeInDolibarr = empty($obj->type) ?
'card' : $obj->type;
372 dol_syslog(
"Found a request in database to pay with card (pdid = ".$pdid.
"). We should fix status traite to 1");
374 dol_syslog(
"Found a request in database to pay with card (pdid = ".$pdid.
") already set to traite=1. Nothing to fix.");
378 dol_syslog(
"Payment intent ".$TRANSACTIONID.
" not found into database, so ignored.");
379 http_response_code(200);
380 print
"Payment intent ".$TRANSACTIONID.
" not found into database, so ignored.";
384 http_response_code(500);
385 print $db->lasterror();
389 if ($paymentTypeCodeInDolibarr) {
392 $stripeacc = $stripearrayofkeysbyenv[$servicestatus][
'secret_key'];
394 dol_syslog(
"Get the Stripe payment object for the payment method id = ".json_encode($paymentmethodstripeid));
396 $s = new \Stripe\StripeClient($stripeacc);
398 $paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
399 $paymentTypeCode = $paymentmethodstripe->type;
400 if ($paymentTypeCode ==
"ban" || $paymentTypeCode ==
"sepa_debit") {
401 $paymentTypeCode =
"PRE";
402 } elseif ($paymentTypeCode ==
"card") {
403 $paymentTypeCode =
"CB";
406 $payment_amount = $payment_amountInDolibarr;
409 $postactionmessages = array();
411 if ($paymentTypeCode ==
"CB" && ($paymentTypeCodeInDolibarr ==
'card' || empty($paymentTypeCodeInDolibarr))) {
417 } elseif ($paymentTypeCode ==
"PRE" && $paymentTypeCodeInDolibarr ==
'ban') {
422 $paiement->datepaye = $now;
423 $paiement->date = $now;
424 if ($currencyCodeType == $conf->currency) {
425 $paiement->amounts = [$invoice_id => $payment_amount];
427 $paiement->multicurrency_amounts = [$invoice_id => $payment_amount];
429 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
430 $ispostactionok = -1;
436 $paiement->paiementcode = $paymentTypeCode;
437 $sql =
"SELECT id FROM ".MAIN_DB_PREFIX.
"c_paiement";
438 $sql .=
" WHERE code = '".$db->escape($paymentTypeCode).
"'";
439 $sql .=
" AND entity IN (".getEntity(
'c_paiement').
")";
440 $resql = $db->query($sql);
442 $obj = $db->fetch_object($resql);
443 $paiement->paiementid = $obj->id;
448 $paiement->num_payment =
'';
449 $paiement->note_public =
'';
450 $paiement->note_private =
'StripeSepa payment received by IPN webhook - ' .
dol_print_date($now,
'standard') .
' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ?
' from ip ' . $ipaddress :
'') .
' - Transaction ID = ' . $TRANSACTIONID;
451 $paiement->ext_payment_id = $TRANSACTIONID.
':'.$customer_id.
'@'.$stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
452 $paiement->ext_payment_site = $service;
455 $sql =
"SELECT p.rowid FROM ".MAIN_DB_PREFIX.
"paiement as p";
456 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
457 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
458 $result = $db->query($sql);
460 if ($db->num_rows($result)) {
462 dol_syslog(
'* Payment for ext_payment_id '.$paiement->ext_payment_id.
' already done. We do not recreate the payment');
468 if (!$error && !$ispaymentdone) {
469 dol_syslog(
'* Record payment type PRE for invoice id ' . $invoice_id .
'. It includes closing of invoice and regenerating document.');
472 $paiement_id = $paiement->create($user, 1);
473 if ($paiement_id < 0) {
474 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . implode(
"<br>\n", $paiement->errors);
475 $ispostactionok = -1;
478 dol_syslog(
"Failed to create the payment for invoice id " . $invoice_id);
480 $postactionmessages[] =
'Payment created';
482 dol_syslog(
"The payment has been created for invoice id " . $invoice_id);
486 if (!$error && isModEnabled(
'bank')) {
489 $sql =
"SELECT p.rowid, p.fk_bank FROM ".MAIN_DB_PREFIX.
"paiement as p";
490 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
491 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
492 $sql .=
" AND p.fk_bank <> 0";
493 $result = $db->query($sql);
495 if ($db->num_rows($result)) {
497 $obj = $db->fetch_object($result);
498 dol_syslog(
'* Payment already linked to bank record '.$obj->fk_bank.
' . We do not recreate the link');
501 if (!$ispaymentdone) {
505 $paymentmethod =
'stripe';
508 if ($bankaccountid > 0) {
509 $label =
'(CustomerInvoicePayment)';
510 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid, $customer_id,
'');
512 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . implode(
"<br>\n", $paiement->errors);
513 $ispostactionok = -1;
516 $postactionmessages[] =
'Bank transaction of payment created (by ipn.php file)';
519 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
520 $ispostactionok = -1;
526 if (!$error && isModEnabled(
'prelevement')) {
529 $sql =
"SELECT dp.fk_prelevement_bons as idbon";
530 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as dp";
531 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
532 $sql .=
" ON pb.rowid = dp.fk_prelevement_bons";
533 $sql .=
" WHERE dp.fk_facture = ".((int) $invoice_id);
534 $sql .=
" AND dp.sourcetype = 'facture'";
535 $sql .=
" AND dp.ext_payment_id = '".$db->escape($TRANSACTIONID).
"'";
536 $sql .=
" AND dp.traite = 1";
537 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
538 $result = $db->query($sql);
540 if ($db->num_rows($result)) {
541 $obj = $db->fetch_object($result);
542 $idbon = $obj->idbon;
543 dol_syslog(
'* Prelevement must be set to credited');
545 dol_syslog(
'* Prelevement not found or already credited');
548 $postactionmessages[] = $db->lasterror();
549 $ispostactionok = -1;
553 if (!$error && !empty($idbon)) {
554 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_bons";
555 $sql .=
" SET fk_user_credit = ".((int) $user->id);
556 $sql .=
", statut = ".((int) $bon::STATUS_CREDITED);
557 $sql .=
", date_credit = '".$db->idate($now).
"'";
558 $sql .=
", credite = 1";
559 $sql .=
" WHERE rowid = ".((int) $idbon);
560 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
562 $result = $db->query($sql);
564 $postactionmessages[] = $db->lasterror();
565 $ispostactionok = -1;
570 if (!$error && !empty($idbon)) {
571 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_lignes";
572 $sql .=
" SET statut = 2";
573 $sql .=
" WHERE fk_prelevement_bons = ".((int) $idbon);
574 $result = $db->query($sql);
576 $postactionmessages[] = $db->lasterror();
577 $ispostactionok = -1;
585 http_response_code(200);
589 http_response_code(500);
593 dol_syslog(
"The payment mode of this payment is ".$paymentTypeCode.
" in Stripe and ".$paymentTypeCodeInDolibarr.
" in Dolibarr. This case is not managed by the IPN");
596 dol_syslog(
"Nothing to do in database because we don't know paymentTypeIdInDolibarr");
598} elseif ($event->type ==
'payment_intent.payment_failed') {
599 dol_syslog(
"A try to make a payment has failed");
601 $object = $event->data->object;
602 $ipaddress =
$object->metadata->ipaddress;
603 $currencyCodeType = strtoupper(
$object->currency);
604 $paymentmethodstripeid =
$object->payment_method;
605 $customer_id =
$object->customer;
607 $chargesdataarray = array();
613 $objpaymentmodetype =
'';
614 if (!empty(
$object->charges)) {
615 $chargesdataarray =
$object->charges->data;
616 foreach ($chargesdataarray as $chargesdata) {
617 $objpayid = $chargesdata->id;
618 $objpaydesc = $chargesdata->description;
620 if ($chargesdata->metadata->dol_type ==
'facture') {
621 $objinvoiceid = $chargesdata->metadata->dol_id;
623 $objerrcode = $chargesdata->outcome->reason;
624 $objerrmessage = $chargesdata->outcome->seller_message;
626 $objpaymentmodetype = $chargesdata->payment_method_details->type;
630 if (!empty(
$object->last_payment_error)) {
632 $objpayid =
$object->latest_charge;
633 $objpaydesc =
$object->description;
635 if (
$object->metadata->dol_type ==
'facture') {
636 $objinvoiceid =
$object->metadata->dol_id;
638 $objerrcode = empty(
$object->last_payment_error->code) ?
$object->last_payment_error->decline_code :
$object->last_payment_error->code;
639 $objerrmessage =
$object->last_payment_error->message;
641 $objpaymentmodetype =
$object->last_payment_error->payment_method->type;
644 dol_syslog(
"objpayid=".$objpayid.
" objpaymentmodetype=".$objpaymentmodetype.
" objerrcode=".$objerrcode);
647 if ($objpaymentmodetype ==
'sepa_debit') {
650 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
653 if ($objinvoiceid > 0) {
654 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
656 $invoice->fetch($objinvoiceid);
658 $actioncomm->userownerid = 0;
659 $actioncomm->percentage = -1;
661 $actioncomm->type_code =
'AC_OTH_AUTO';
662 $actioncomm->code =
'AC_IPN';
664 $actioncomm->datep = $now;
665 $actioncomm->datef = $now;
667 $actioncomm->socid = $invoice->socid;
668 $actioncomm->fk_project = $invoice->fk_project;
669 $actioncomm->fk_element = $invoice->id;
670 $actioncomm->elementtype =
'invoice';
674 $actioncomm->note_private =
'Error returned on payment id '.$objpayid.
' after SEPA payment request '.$objpaydesc.
'<br>Error code is: '.$objerrcode.
'<br>Error message is: '.$objerrmessage;
675 $actioncomm->label =
'Payment error (SEPA Stripe)';
677 $result = $actioncomm->create($user);
687 http_response_code(500);
691} elseif ($event->type ==
'checkout.session.completed') {
693} elseif ($event->type ==
'payment_method.attached') {
694 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
695 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
700 $idthirdparty = $societeaccount->getThirdPartyID($db->escape($event->data->object->customer),
'stripe', $servicestatus);
701 if ($idthirdparty > 0) {
704 $companypaymentmode->stripe_card_ref = $db->escape($event->data->object->id);
705 $companypaymentmode->fk_soc = $idthirdparty;
706 $companypaymentmode->bank =
null;
707 $companypaymentmode->label =
'';
708 $companypaymentmode->number = $db->escape($event->data->object->id);
709 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
710 $companypaymentmode->card_type = $db->escape($event->data->object->card->branding);
711 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
712 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
713 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
714 $companypaymentmode->cvn =
null;
715 $companypaymentmode->datec = $db->escape($event->data->object->created);
716 $companypaymentmode->default_rib = 0;
717 $companypaymentmode->type = $db->escape($event->data->object->type);
718 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
719 $companypaymentmode->status = $servicestatus;
725 $result = $companypaymentmode->create($user);
736} elseif ($event->type ==
'payment_method.updated') {
737 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
739 $companypaymentmode->fetch(0,
'', 0,
'',
" AND stripe_card_ref = '".$db->escape($event->data->object->id).
"'");
740 if ($companypaymentmode->id > 0) {
742 $companypaymentmode->bank =
null;
743 $companypaymentmode->label =
'';
744 $companypaymentmode->number = $db->escape($event->data->object->id);
745 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
746 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
747 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
748 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
749 $companypaymentmode->cvn =
null;
750 $companypaymentmode->datec = $db->escape($event->data->object->created);
751 $companypaymentmode->default_rib = 0;
752 $companypaymentmode->type = $db->escape($event->data->object->type);
753 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
754 $companypaymentmode->status = $servicestatus;
758 $result = $companypaymentmode->update($user);
769} elseif ($event->type ==
'payment_method.detached') {
771 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_rib WHERE number = '".$db->escape($event->data->object->id).
"' and status = ".((int) $servicestatus);
774} elseif ($event->type ==
'charge.succeeded') {
776} elseif ($event->type ==
'charge.failed') {
778} elseif (($event->type ==
'source.chargeable') && ($event->data->object->type ==
'three_d_secure') && ($event->data->object->three_d_secure->authenticated ==
true)) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Class to manage bank accounts.
Class to manage agenda events (actions)
Class to manage withdrawal receipts.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class for CompanyPaymentMode.
Class to manage invoices.
Class to manage payments of customer invoices.
Class for SocieteAccount.
Stripe class @TODO No reason to extends CommonObject.
Class to manage Dolibarr users.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolChmod($filepath, $newmask='')
Change mod of a file.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getUserRemoteIP()
Return the IP of remote user.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.