21 if (!defined(
'NOLOGIN')) {
24 if (!defined(
'NOCSRFCHECK')) {
25 define(
"NOCSRFCHECK", 1);
27 if (!defined(
'NOIPCHECK')) {
28 define(
'NOIPCHECK',
'1');
30 if (!defined(
'NOBROWSERNOTIF')) {
31 define(
'NOBROWSERNOTIF',
'1');
35 $entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
36 if (is_numeric($entity)) {
37 define(
"DOLENTITY", $entity);
41 if (!defined(
'USESUFFIXINLOG')) {
42 define(
'USESUFFIXINLOG',
'_stripeipn');
46 require
'../../main.inc.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
48 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/ccountry.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/includes/stripe/stripe-php/init.php';
58 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
65 $service =
'StripeTest';
69 $service =
'StripeLive';
75 $service =
'StripeTest';
79 $service =
'StripeLive';
88 if (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);
140 $langs->load(
"main");
143 if (
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);
164 $stripe =
new Stripe($db);
174 dol_syslog(
"***** Stripe IPN was called with event->type=".$event->type.
" service=".$service);
177 if ($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;
434 $paiement->paiementcode = $paymentTypeCode;
435 $paiement->num_payment =
'';
436 $paiement->note_public =
'';
437 $paiement->note_private =
'StripeSepa payment ' .
dol_print_date($now,
'standard') .
' using ' . $servicestatus . ($ipaddress ?
' from ip ' . $ipaddress :
'') .
' - Transaction ID = ' . $TRANSACTIONID;
438 $paiement->ext_payment_id = $TRANSACTIONID.
':'.$customer_id.
'@'.$stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
439 $paiement->ext_payment_site = $service;
442 $sql =
"SELECT p.rowid FROM ".MAIN_DB_PREFIX.
"paiement as p";
443 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
444 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
445 $result = $db->query(
$sql);
447 if ($db->num_rows($result)) {
449 dol_syslog(
'* Payment for ext_payment_id '.$paiement->ext_payment_id.
' already done. We do not recreate the payment');
455 if (!$error && !$ispaymentdone) {
456 dol_syslog(
'* Record payment for invoice id ' . $invoice_id .
'. It includes closing of invoice and regenerating document');
459 $paiement_id = $paiement->create($user, 1);
460 if ($paiement_id < 0) {
461 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . implode(
"<br>\n", $paiement->errors);
462 $ispostactionok = -1;
465 dol_syslog(
"Failed to create the payment for invoice id " . $invoice_id);
467 $postactionmessages[] =
'Payment created';
469 dol_syslog(
"The payment has been created for invoice id " . $invoice_id);
476 $sql =
"SELECT p.rowid, p.fk_bank FROM ".MAIN_DB_PREFIX.
"paiement as p";
477 $sql .=
" WHERE p.ext_payment_id = '".$db->escape($paiement->ext_payment_id).
"'";
478 $sql .=
" AND p.ext_payment_site = '".$db->escape($paiement->ext_payment_site).
"'";
479 $sql .=
" AND p.fk_bank <> 0";
480 $result = $db->query(
$sql);
482 if ($db->num_rows($result)) {
484 $obj = $db->fetch_object($result);
485 dol_syslog(
'* Payment already linked to bank record '.$obj->fk_bank.
' . We do not recreate the link');
488 if (!$ispaymentdone) {
492 $paymentmethod =
'stripe';
495 if ($bankaccountid > 0) {
496 $label =
'(CustomerInvoicePayment)';
497 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid, $customer_id,
'');
499 $postactionmessages[] = $paiement->error . ($paiement->error ?
' ' :
'') . implode(
"<br>\n", $paiement->errors);
500 $ispostactionok = -1;
503 $postactionmessages[] =
'Bank transaction of payment created (by ipn.php file)';
506 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
507 $ispostactionok = -1;
516 $sql =
"SELECT dp.fk_prelevement_bons as idbon";
517 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as dp";
518 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
519 $sql .=
" ON pb.rowid = dp.fk_prelevement_bons";
520 $sql .=
" WHERE dp.fk_facture = ".((int) $invoice_id);
521 $sql .=
" AND dp.sourcetype = 'facture'";
522 $sql .=
" AND dp.ext_payment_id = '".$db->escape($TRANSACTIONID).
"'";
523 $sql .=
" AND dp.traite = 1";
524 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
525 $result = $db->query(
$sql);
527 if ($db->num_rows($result)) {
528 $obj = $db->fetch_object($result);
529 $idbon = $obj->idbon;
530 dol_syslog(
'* Prelevement must be set to credited');
532 dol_syslog(
'* Prelevement not found or already credited');
535 $postactionmessages[] = $db->lasterror();
536 $ispostactionok = -1;
540 if (!$error && !empty($idbon)) {
541 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_bons";
542 $sql .=
" SET fk_user_credit = ".((int) $user->id);
543 $sql .=
", statut = ".((int) $bon::STATUS_CREDITED);
544 $sql .=
", date_credit = '".$db->idate($now).
"'";
545 $sql .=
", credite = 1";
546 $sql .=
" WHERE rowid = ".((int) $idbon);
547 $sql .=
" AND statut = ".((int) $bon::STATUS_TRANSFERED);
549 $result = $db->query(
$sql);
551 $postactionmessages[] = $db->lasterror();
552 $ispostactionok = -1;
557 if (!$error && !empty($idbon)) {
558 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_lignes";
559 $sql .=
" SET statut = 2";
560 $sql .=
" WHERE fk_prelevement_bons = ".((int) $idbon);
561 $result = $db->query(
$sql);
563 $postactionmessages[] = $db->lasterror();
564 $ispostactionok = -1;
572 http_response_code(200);
576 http_response_code(500);
580 dol_syslog(
"The payment mode of this payment is ".$paymentTypeCode.
" in Stripe and ".$paymentTypeCodeInDolibarr.
" in Dolibarr. This case is not managed by the IPN");
583 dol_syslog(
"Nothing to do in database because we don't know paymentTypeIdInDolibarr");
585 } elseif ($event->type ==
'payment_intent.payment_failed') {
586 dol_syslog(
"A try to make a payment has failed");
588 $object = $event->data->object;
589 $ipaddress =
$object->metadata->ipaddress;
590 $currencyCodeType = strtoupper(
$object->currency);
591 $paymentmethodstripeid =
$object->payment_method;
592 $customer_id =
$object->customer;
594 $chargesdataarray = array();
600 $objpaymentmodetype =
'';
601 if (!empty(
$object->charges)) {
602 $chargesdataarray =
$object->charges->data;
603 foreach ($chargesdataarray as $chargesdata) {
604 $objpayid = $chargesdata->id;
605 $objpaydesc = $chargesdata->description;
607 if ($chargesdata->metadata->dol_type ==
'facture') {
608 $objinvoiceid = $chargesdata->metadata->dol_id;
610 $objerrcode = $chargesdata->outcome->reason;
611 $objerrmessage = $chargesdata->outcome->seller_message;
613 $objpaymentmodetype = $chargesdata->payment_method_details->type;
617 if (!empty(
$object->last_payment_error)) {
619 $objpayid =
$object->latest_charge;
620 $objpaydesc =
$object->description;
622 if (
$object->metadata->dol_type ==
'facture') {
623 $objinvoiceid =
$object->metadata->dol_id;
625 $objerrcode = empty(
$object->last_payment_error->code) ?
$object->last_payment_error->decline_code :
$object->last_payment_error->code;
626 $objerrmessage =
$object->last_payment_error->message;
628 $objpaymentmodetype =
$object->last_payment_error->payment_method->type;
631 dol_syslog(
"objpayid=".$objpayid.
" objpaymentmodetype=".$objpaymentmodetype.
" objerrcode=".$objerrcode);
634 if ($objpaymentmodetype ==
'sepa_debit') {
637 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
640 if ($objinvoiceid > 0) {
641 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
643 $invoice->fetch($objinvoiceid);
645 $actioncomm->userownerid = 0;
646 $actioncomm->percentage = -1;
648 $actioncomm->type_code =
'AC_OTH_AUTO';
649 $actioncomm->code =
'AC_IPN';
651 $actioncomm->datep = $now;
652 $actioncomm->datef = $now;
654 $actioncomm->socid = $invoice->socid;
655 $actioncomm->fk_project = $invoice->fk_project;
656 $actioncomm->fk_element = $invoice->id;
657 $actioncomm->elementtype =
'invoice';
661 $actioncomm->note_private =
'Error returned on payment id '.$objpayid.
' after SEPA payment request '.$objpaydesc.
'<br>Error code is: '.$objerrcode.
'<br>Error message is: '.$objerrmessage;
662 $actioncomm->label =
'Payment error (SEPA Stripe)';
664 $result = $actioncomm->create($user);
674 http_response_code(500);
678 } elseif ($event->type ==
'checkout.session.completed') {
680 } elseif ($event->type ==
'payment_method.attached') {
681 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
682 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
687 $idthirdparty = $societeaccount->getThirdPartyID($db->escape($event->data->object->customer),
'stripe', $servicestatus);
688 if ($idthirdparty > 0) {
691 $companypaymentmode->stripe_card_ref = $db->escape($event->data->object->id);
692 $companypaymentmode->fk_soc = $idthirdparty;
693 $companypaymentmode->bank =
null;
694 $companypaymentmode->label =
'';
695 $companypaymentmode->number = $db->escape($event->data->object->id);
696 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
697 $companypaymentmode->card_type = $db->escape($event->data->object->card->branding);
698 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
699 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
700 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
701 $companypaymentmode->cvn =
null;
702 $companypaymentmode->datec = $db->escape($event->data->object->created);
703 $companypaymentmode->default_rib = 0;
704 $companypaymentmode->type = $db->escape($event->data->object->type);
705 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
706 $companypaymentmode->status = $servicestatus;
712 $result = $companypaymentmode->create($user);
723 } elseif ($event->type ==
'payment_method.updated') {
724 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
726 $companypaymentmode->fetch(0,
'', 0,
'',
" AND stripe_card_ref = '".$db->escape($event->data->object->id).
"'");
727 if ($companypaymentmode->id > 0) {
729 $companypaymentmode->bank =
null;
730 $companypaymentmode->label =
'';
731 $companypaymentmode->number = $db->escape($event->data->object->id);
732 $companypaymentmode->last_four = $db->escape($event->data->object->card->last4);
733 $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name);
734 $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month);
735 $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year);
736 $companypaymentmode->cvn =
null;
737 $companypaymentmode->datec = $db->escape($event->data->object->created);
738 $companypaymentmode->default_rib = 0;
739 $companypaymentmode->type = $db->escape($event->data->object->type);
740 $companypaymentmode->country_code = $db->escape($event->data->object->card->country);
741 $companypaymentmode->status = $servicestatus;
745 $result = $companypaymentmode->update($user);
756 } elseif ($event->type ==
'payment_method.detached') {
758 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_rib WHERE number = '".$db->escape($event->data->object->id).
"' and status = ".((int) $servicestatus);
761 } elseif ($event->type ==
'charge.succeeded') {
763 } elseif ($event->type ==
'charge.failed') {
765 } 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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('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') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getUserRemoteIP()
Return the IP of remote user.
isModEnabled($module)
Is Dolibarr module enabled.
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.