20if (!defined(
'NOLOGIN')) {
23if (!defined(
'NOCSRFCHECK')) {
24 define(
"NOCSRFCHECK", 1);
26if (!defined(
'NOIPCHECK')) {
27 define(
'NOIPCHECK',
'1');
29if (!defined(
'NOBROWSERNOTIF')) {
30 define(
'NOBROWSERNOTIF',
'1');
33$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
34if (is_numeric($entity)) {
35 define(
"DOLENTITY", $entity);
39if (!defined(
'USESUFFIXINLOG')) {
40 define(
'USESUFFIXINLOG',
'_stripeipn');
44require
'../../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/ccountry.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/includes/stripe/stripe-php/init.php';
56require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
60if (isset($_GET[
'connect'])) {
61 if (isset($_GET[
'test'])) {
62 $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
63 $service =
'StripeTest';
66 $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY;
67 $service =
'StripeLive';
71 if (isset($_GET[
'test'])) {
72 $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
73 $service =
'StripeTest';
76 $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY;
77 $service =
'StripeLive';
82if (!isModEnabled(
'stripe')) {
86if (empty($endpoint_secret)) {
92 $user =
new User($db);
93 $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
109$payload = @file_get_contents(
"php://input");
110$sig_header = empty($_SERVER[
"HTTP_STRIPE_SIGNATURE"]) ?
'' : $_SERVER[
"HTTP_STRIPE_SIGNATURE"];
114 $fh = fopen(DOL_DATA_ROOT.
'/dolibarr_stripeipn_payload.log',
'w+');
116 fwrite($fh,
dol_print_date(
dol_now(
'gmt'),
'standard').
' IPN Called. service='.$service.
' HTTP_STRIPE_SIGNATURE='.$sig_header.
"\n");
117 fwrite($fh, $payload);
119 dolChmod(DOL_DATA_ROOT.
'/dolibarr_stripeipn_payload.log');
126 $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret);
127}
catch (UnexpectedValueException $e) {
131 httponly_accessforbidden(
'Invalid signature. May be a hook for an event created by another Stripe env ? Check setup of your keys whsec_...', 400);
141if (isModEnabled(
'multicompany') && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
142 $sql =
"SELECT entity";
143 $sql .=
" FROM ".MAIN_DB_PREFIX.
"oauth_token";
144 $sql .=
" WHERE service = '".$db->escape($service).
"' and tokenstring LIKE '%".$db->escape($db->escapeforlike($event->account)).
"%'";
146 dol_syslog(get_class($db).
"::fetch", LOG_DEBUG);
147 $result = $db->query($sql);
149 if ($db->num_rows($result)) {
150 $obj = $db->fetch_object($result);
158 $ret = $mc->switchEntity($key);
165$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
167 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
172dol_syslog(
"***** Stripe IPN was called with event->type=".$event->type.
" service=".$service);
175if ($event->type ==
'payout.created') {
178 $result =
dolibarr_set_const($db, $service.
"_NEXTPAYOUT", date(
'Y-m-d H:i:s', $event->data->object->arrival_date),
'chaine', 0,
'', $conf->entity);
181 $subject = $societeName.
' - [NOTIFICATION] Stripe payout scheduled';
182 if (!empty($user->email)) {
193 $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');
209 $ret = $mailfile->sendfile();
214 http_response_code(500);
217} elseif ($event->type ==
'payout.paid') {
219 $result =
dolibarr_set_const($db, $service.
"_NEXTPAYOUT",
null,
'chaine', 0,
'', $conf->entity);
221 $langs->load(
"errors");
224 $label = $event->data->object->description;
225 $amount = $event->data->object->amount / 100;
226 $amount_to = $event->data->object->amount / 100;
227 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
229 $accountfrom =
new Account($db);
230 $accountfrom->fetch($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS);
233 $accountto->fetch($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS);
235 if (($accountto->id != $accountfrom->id) && empty($error)) {
236 $bank_line_id_from = 0;
237 $bank_line_id_to = 0;
245 $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 *
price2num($amount),
'',
'', $user);
247 if (!($bank_line_id_from > 0)) {
251 $bank_line_id_to = $accountto->addline($dateo, $typeto, $label,
price2num($amount),
'',
'', $user);
253 if (!($bank_line_id_to > 0)) {
258 $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.
'/compta/bank/line.php?rowid=',
'(banktransfert)',
'banktransfert');
260 if (!($result > 0)) {
264 $result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.
'/compta/bank/line.php?rowid=',
'(banktransfert)',
'banktransfert');
266 if (!($result > 0)) {
271 $subject = $societeName.
' - [NOTIFICATION] Stripe payout done';
272 if (!empty($user->email)) {
283 $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');
299 $ret = $mailfile->sendfile();
304 http_response_code(500);
307} elseif ($event->type ==
'customer.source.created') {
309} elseif ($event->type ==
'customer.source.updated') {
311} elseif ($event->type ==
'customer.source.delete') {
313} elseif ($event->type ==
'customer.deleted') {
315 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_account WHERE key_account = '".$db->escape($event->data->object->id).
"' and site='stripe'";
318} elseif ($event->type ==
'payment_intent.succeeded') {
320 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
321 global $stripearrayofkeysbyenv;
323 $object = $event->data->object;
324 $TRANSACTIONID = $object->id;
325 $ipaddress = $object->metadata->ipaddress;
327 $currencyCodeType = strtoupper($object->currency);
328 $paymentmethodstripeid = $object->payment_method;
329 $customer_id = $object->customer;
332 $paymentTypeIdInDolibarr =
"";
334 $payment_amountInDolibarr = 0;
336 dol_syslog(
"Try to find a payment in database for the payment_intent id = ".$TRANSACTIONID);
338 $sql =
"SELECT pi.rowid, pi.fk_facture, pi.fk_prelevement_bons, pi.amount, pi.type, pi.traite";
339 $sql .=
" FROM llx_prelevement_demande as pi";
340 $sql .=
" WHERE pi.ext_payment_id = '".$db->escape($TRANSACTIONID).
"'";
341 $sql .=
" AND pi.ext_payment_site = '".$db->escape($service).
"'";
343 $result = $db->query($sql);
345 $obj = $db->fetch_object($result);
347 if ($obj->type ==
'ban') {
348 if ($obj->traite == 1) {
352 $invoice_id = $obj->fk_facture;
353 $directdebitorcreditransfer_id = $obj->fk_prelevement_bons;
354 $payment_amountInDolibarr = $obj->amount;
355 $paymentTypeIdInDolibarr = $obj->type;
357 dol_syslog(
"Found a request in database to pay with direct debit generated (pdid = ".$pdid.
" directdebitorcreditransfer_id=".$directdebitorcreditransfer_id.
")");
359 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);
362 if ($obj->type ==
'card' || empty($obj->type)) {
363 if ($obj->traite == 0) {
366 $invoice_id = $obj->fk_facture;
367 $payment_amountInDolibarr = $obj->amount;
368 $paymentTypeIdInDolibarr = empty($obj->type) ?
'card' : $obj->type;
370 dol_syslog(
"Found a request in database to pay with card (pdid = ".$pdid.
"). We should fix status traite to 1");
372 dol_syslog(
"Found a request in database to pay with card (pdid = ".$pdid.
") already set to traite=1. Nothing to fix.");
376 dol_syslog(
"Payment intent ".$TRANSACTIONID.
" not found into database, so ignored.");
377 http_response_code(200);
378 print
"Payment intent ".$TRANSACTIONID.
" not found into database, so ignored.";
382 http_response_code(500);
383 print $db->lasterror();
387 if ($paymentTypeIdInDolibarr) {
390 $stripeacc = $stripearrayofkeysbyenv[$servicestatus][
'secret_key'];
392 dol_syslog(
"Get the Stripe payment object for the payment method id = ".json_encode($paymentmethodstripeid));
394 $s = new \Stripe\StripeClient($stripeacc);
396 $paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
397 $paymentTypeId = $paymentmethodstripe->type;
398 if ($paymentTypeId ==
"ban" || $paymentTypeId ==
"sepa_debit") {
399 $paymentTypeId =
"PRE";
400 } elseif ($paymentTypeId ==
"card") {
401 $paymentTypeId =
"CB";
404 $payment_amount = $payment_amountInDolibarr;
407 if ($paymentTypeId ==
"CB" && ($paymentTypeIdInDolibarr ==
'card' || empty($paymentTypeIdInDolibarr))) {
413 } elseif ($paymentTypeId ==
"PRE" && $paymentTypeIdInDolibarr ==
'ban') {
418 $paiement->datepaye = $now;
419 $paiement->date = $now;
420 if ($currencyCodeType == $conf->currency) {
421 $paiement->amounts = [$invoice_id => $payment_amount];
423 $paiement->multicurrency_amounts = [$invoice_id => $payment_amount];
425 $postactionmessages[] =
'Payment was done in a different currency than currency expected of company';
426 $ispostactionok = -1;
430 $paiement->paiementid = $paymentTypeId;
431 $paiement->num_payment =
'';
432 $paiement->note_public =
'';
433 $paiement->note_private =
'StripeSepa payment ' .
dol_print_date($now,
'standard') .
' using ' . $servicestatus . ($ipaddress ?
' from ip ' . $ipaddress :
'') .
' - Transaction ID = ' . $TRANSACTIONID;
434 $paiement->ext_payment_id = $TRANSACTIONID.
':'.$customer_id.
'@'.$stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
435 $paiement->ext_payment_site = $service;
438 $sql =
"SELECT p.rowid FROM llx_paiement as p";
439 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
440 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
441 $result = $db->query($sql);
443 if ($db->num_rows($result)) {
445 dol_syslog(
'* Payment for ext_payment_id '.$paiement->ext_payment_id.
' already done. We do not recreate the payment');
451 if (!$error && !$ispaymentdone) {
452 dol_syslog(
'* Record payment for invoice id ' . $invoice_id .
'. It includes closing of invoice and regenerating document');
455 $paiement_id = $paiement->create($user, 1);
456 if ($paiement_id < 0) {
457 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . join(
"<br>\n", $paiement->errors);
458 $ispostactionok = -1;
461 dol_syslog(
"Failed to create the payment for invoice id " . $invoice_id);
463 $postactionmessages[] =
'Payment created';
465 dol_syslog(
"The payment has been created for invoice id " . $invoice_id);
469 if (!$error && isModEnabled(
'banque')) {
472 $sql =
"SELECT p.rowid, p.fk_bank FROM llx_paiement as p";
473 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
474 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
475 $sql .=
" AND p.fk_bank <> 0";
476 $result = $db->query($sql);
478 if ($db->num_rows($result)) {
480 $obj = $db->fetch_object($result);
481 dol_syslog(
'* Payment already linked to bank record '.$obj->fk_bank.
' . We do not recreate the link');
484 if (!$ispaymentdone) {
488 $paymentmethod =
'stripe';
491 if ($bankaccountid > 0) {
492 $label =
'(CustomerInvoicePayment)';
493 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid, $customer_id,
'');
495 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . join(
"<br>\n", $paiement->errors);
496 $ispostactionok = -1;
499 $postactionmessages[] =
'Bank transaction of payment created (by ipn.php file)';
502 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
503 $ispostactionok = -1;
509 if (!$error && isModEnabled(
'prelevement')) {
512 $sql =
"SELECT dp.fk_prelevement_bons as idbon";
513 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as dp";
514 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
515 $sql .=
" ON pb.rowid = dp.fk_prelevement_bons";
516 $sql .=
" WHERE dp.fk_facture = ".((int) $invoice_id);
517 $sql .=
" AND dp.sourcetype = 'facture'";
518 $sql .=
" AND dp.ext_payment_id = '".$db->escape($TRANSACTIONID).
"'";
519 $sql .=
" AND dp.traite = 1";
520 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
521 $result = $db->query($sql);
523 if ($db->num_rows($result)) {
524 $obj = $db->fetch_object($result);
525 $idbon = $obj->idbon;
526 dol_syslog(
'* Prelevement must be set to credited');
528 dol_syslog(
'* Prelevement not found or already credited');
531 $postactionmessages[] = $db->lasterror();
532 $ispostactionok = -1;
536 if (!$error && !empty($idbon)) {
537 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_bons";
538 $sql .=
" SET fk_user_credit = ".((int) $user->id);
539 $sql .=
", statut = ".((int) $bon::STATUS_CREDITED);
540 $sql .=
", date_credit = '".$db->idate($now).
"'";
541 $sql .=
", credite = 1";
542 $sql .=
" WHERE rowid = ".((int) $idbon);
543 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
545 $result = $db->query($sql);
547 $postactionmessages[] = $db->lasterror();
548 $ispostactionok = -1;
553 if (!$error && !empty($idbon)) {
554 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_lignes";
555 $sql .=
" SET statut = 2";
556 $sql .=
" WHERE fk_prelevement_bons = ".((int) $idbon);
557 $result = $db->query($sql);
559 $postactionmessages[] = $db->lasterror();
560 $ispostactionok = -1;
568 http_response_code(200);
572 http_response_code(500);
576 dol_syslog(
"The payment mode of this payment is ".$paymentTypeId.
" in Stripe and ".$paymentTypeIdInDolibarr.
" in Dolibarr. This case is not managed by the IPN");
579 dol_syslog(
"Nothing to do in database because we don't know paymentTypeIdInDolibarr");
581} elseif ($event->type ==
'payment_intent.payment_failed') {
582 dol_syslog(
"A try to make a payment has failed");
584 $object = $event->data->object;
585 $ipaddress = $object->metadata->ipaddress;
586 $currencyCodeType = strtoupper($object->currency);
587 $paymentmethodstripeid = $object->payment_method;
588 $customer_id = $object->customer;
590 $chargesdataarray = array();
596 $objpaymentmodetype =
'';
597 if (!empty($object->charges)) {
598 $chargesdataarray = $object->charges->data;
599 foreach ($chargesdataarray as $chargesdata) {
600 $objpayid = $chargesdata->id;
601 $objpaydesc = $chargesdata->description;
603 if ($chargesdata->metadata->dol_type ==
'facture') {
604 $objinvoiceid = $chargesdata->metadata->dol_id;
606 $objerrcode = $chargesdata->outcome->reason;
607 $objerrmessage = $chargesdata->outcome->seller_message;
609 $objpaymentmodetype = $chargesdata->payment_method_details->type;
613 if (!empty($object->last_payment_error)) {
615 $objpayid = $object->latest_charge;
616 $objpaydesc = $object->description;
618 if ($object->metadata->dol_type ==
'facture') {
619 $objinvoiceid = $object->metadata->dol_id;
621 $objerrcode = empty($object->last_payment_error->code) ? $object->last_payment_error->decline_code : $object->last_payment_error->code;
622 $objerrmessage = $object->last_payment_error->message;
624 $objpaymentmodetype = $object->last_payment_error->payment_method->type;
627 dol_syslog(
"objpayid=".$objpayid.
" objpaymentmodetype=".$objpaymentmodetype.
" objerrcode=".$objerrcode);
630 if ($objpaymentmodetype ==
'sepa_debit') {
633 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
636 if ($objinvoiceid > 0) {
637 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
639 $invoice->fetch($objinvoiceid);
641 $actioncomm->userownerid = 0;
642 $actioncomm->percentage = -1;
644 $actioncomm->type_code =
'AC_OTH_AUTO';
645 $actioncomm->code =
'AC_IPN';
647 $actioncomm->datep = $now;
648 $actioncomm->datef = $now;
650 $actioncomm->socid = $invoice->socid;
651 $actioncomm->fk_project = $invoice->fk_project;
652 $actioncomm->fk_element = $invoice->id;
653 $actioncomm->elementtype =
'invoice';
657 $actioncomm->note_private =
'Error returned on payment id '.$objpayid.
' after SEPA payment request '.$objpaydesc.
'<br>Error code is: '.$objerrcode.
'<br>Error message is: '.$objerrmessage;
658 $actioncomm->label =
'Payment error (SEPA Stripe)';
660 $result = $actioncomm->create($user);
670 http_response_code(500);
674} elseif ($event->type ==
'checkout.session.completed') {
676} elseif ($event->type ==
'payment_method.attached') {
677 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
678 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
683 $idthirdparty = $societeaccount->getThirdPartyID($db->escape($event->data->object->customer),
'stripe', $servicestatus);
684 if ($idthirdparty > 0) {
687 $companypaymentmode->stripe_card_ref = $db->escape($event->data->object->id);
688 $companypaymentmode->fk_soc = $idthirdparty;
689 $companypaymentmode->bank =
null;
690 $companypaymentmode->label =
null;
691 $companypaymentmode->number = $db->escape($event->data->object->id);
692 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
693 $companypaymentmode->card_type = $db->escape($event->data->object->card->branding);
694 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
695 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
696 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
697 $companypaymentmode->cvn =
null;
698 $companypaymentmode->datec = $db->escape($event->data->object->created);
699 $companypaymentmode->default_rib = 0;
700 $companypaymentmode->type = $db->escape($event->data->object->type);
701 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
702 $companypaymentmode->status = $servicestatus;
708 $result = $companypaymentmode->create($user);
719} elseif ($event->type ==
'payment_method.updated') {
720 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
722 $companypaymentmode->fetch(0,
'', 0,
'',
" AND stripe_card_ref = '".$db->escape($event->data->object->id).
"'");
723 if ($companypaymentmode->id > 0) {
725 $companypaymentmode->bank =
null;
726 $companypaymentmode->label =
null;
727 $companypaymentmode->number = $db->escape($event->data->object->id);
728 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
729 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
730 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
731 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
732 $companypaymentmode->cvn =
null;
733 $companypaymentmode->datec = $db->escape($event->data->object->created);
734 $companypaymentmode->default_rib = 0;
735 $companypaymentmode->type = $db->escape($event->data->object->type);
736 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
737 $companypaymentmode->status = $servicestatus;
741 $result = $companypaymentmode->update($user);
752} elseif ($event->type ==
'payment_method.detached') {
754 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_rib WHERE number = '".$db->escape($event->data->object->id).
"' and status = ".((int) $servicestatus);
757} elseif ($event->type ==
'charge.succeeded') {
759} elseif ($event->type ==
'charge.failed') {
761} elseif (($event->type ==
'source.chargeable') && ($event->data->object->type ==
'three_d_secure') && ($event->data->object->three_d_secure->authenticated ==
true)) {
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.
Class to manage Dolibarr users.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
getDolGlobalString($key, $default='')
Return 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.