33if (!defined(
'NOLOGIN')) {
36if (!defined(
'NOCSRFCHECK')) {
37 define(
"NOCSRFCHECK", 1);
39if (!defined(
'NOIPCHECK')) {
40 define(
'NOIPCHECK',
'1');
42if (!defined(
'NOBROWSERNOTIF')) {
43 define(
'NOBROWSERNOTIF',
'1');
49$entity = (!empty($_GET[
'e']) ? (int) $_GET[
'e'] : (!empty($_POST[
'e']) ? (int) $_POST[
'e'] : 1));
50if (is_numeric($entity)) {
51 define(
"DOLENTITY", $entity);
55require
'../../main.inc.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
58if (isModEnabled(
'paypal')) {
59 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypal.lib.php';
60 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypalfunctions.lib.php';
75$hookmanager->initHooks(array(
'newpayment'));
77$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"paybox",
"paypal",
"stripe"));
80if (isModEnabled(
'paypal')) {
81 $PAYPAL_API_USER =
"";
85 $PAYPAL_API_PASSWORD =
"";
89 $PAYPAL_API_SIGNATURE =
"";
93 $PAYPAL_API_SANDBOX =
"";
106 $PAYPALTOKEN =
GETPOST(
'TOKEN');
107 if (empty($PAYPALTOKEN)) {
108 $PAYPALTOKEN =
GETPOST(
'token');
110 $PAYPALPAYERID =
GETPOST(
'PAYERID');
111 if (empty($PAYPALPAYERID)) {
112 $PAYPALPAYERID =
GETPOST(
'PayerID');
117if (empty($FULLTAG)) {
123$suffix =
GETPOST(
"suffix",
'aZ09');
130if (preg_match(
'/PM=([^\.]+)/', $FULLTAG, $reg)) {
131 $paymentmethod = $reg[1];
133if (empty($paymentmethod)) {
134 dol_syslog(
"***** paymentok.php was called with a non valid parameter FULLTAG=".$FULLTAG, LOG_DEBUG, 0,
'_payment');
135 dol_print_error(
null,
'The callback url does not contain a parameter fulltag that should help us to find the payment method used');
139dol_syslog(
"***** paymentok.php is called paymentmethod=".$paymentmethod.
" FULLTAG=".$FULLTAG.
" REQUEST_URI=".$_SERVER[
"REQUEST_URI"], LOG_DEBUG, 0,
'_payment');
142$ws = preg_match(
'/WS=([^\.]+)/', $FULLTAG, $reg_ws) ? $reg_ws[1] : 0;
144 dol_syslog(
"Paymentok.php page is invoked from a website with ref ".$ws.
". It performs actions and then redirects back to this website. A page with ref paymentok must be created for this website.", LOG_DEBUG, 0,
'_payment');
147$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod);
150if (empty($validpaymentmethod)) {
155$creditor = $mysoc->name;
156$paramcreditor =
'ONLINE_PAYMENT_CREDITOR';
157$paramcreditorlong =
'ONLINE_PAYMENT_CREDITOR_'.$suffix;
167$PAYMENTSTATUS = $TRANSACTIONID = $TAXAMT = $NOTE =
'';
169$ErrorCode = $ErrorShortMsg = $ErrorLongMsg = $ErrorSeverityCode =
'';
183 $doactionsthenredirect = 1;
189dol_syslog(
"Callback url when a payment was done. query_string=".(empty($_SERVER[
"QUERY_STRING"]) ?
'' :
dol_escape_htmltag($_SERVER[
"QUERY_STRING"])).
" script_uri=".(empty($_SERVER[
"SCRIPT_URI"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SCRIPT_URI"])), LOG_DEBUG, 0,
'_payment');
190dol_syslog(
"_SERVER[SERVER_NAME] = ".(empty($_SERVER[
"SERVER_NAME"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_NAME"])), LOG_DEBUG, 0,
'_payment');
191dol_syslog(
"_SERVER[SERVER_ADDR] = ".(empty($_SERVER[
"SERVER_ADDR"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_ADDR"])), LOG_DEBUG, 0,
'_payment');
194foreach ($_POST as $k => $v) {
195 if (is_scalar($k) && is_scalar($v)) {
196 $tracepost .=
"$k - $v\n";
199dol_syslog(
"POST=".$tracepost, LOG_DEBUG, 0,
'_payment');
201foreach ($_SESSION as $k => $v) {
202 if (is_scalar($k) && is_scalar($v)) {
203 $tracesession .=
"$k - $v\n";
206dol_syslog(
"SESSION=".$tracesession, LOG_DEBUG, 0,
'_payment');
210 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
213$conf->dol_hide_topmenu = 1;
214$conf->dol_hide_leftmenu = 1;
218if (empty($doactionsthenredirect)) {
219 $replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
220 llxHeader($head, $langs->trans(
"PaymentForm"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea);
224 print
'<span id="dolpaymentspan"></span>'.
"\n";
225 print
'<div id="dolpaymentdiv" class="center">'.
"\n";
230 $logosmall = $mysoc->logo_small;
231 $logo = $mysoc->logo;
232 $paramlogo =
'ONLINE_PAYMENT_LOGO_'.$suffix;
242 if (!empty($logosmall) && is_readable(
$conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
243 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
244 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
245 } elseif (!empty($logo) && is_readable(
$conf->mycompany->dir_output.
'/logos/'.$logo)) {
246 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
247 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
252 print
'<div class="backgreypublicpayment">';
253 print
'<div class="logopublicpayment">';
254 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
258 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
261 } elseif ($creditor) {
262 print
'<div class="backgreypublicpayment">';
263 print
'<div class="logopublicpayment">';
269 print
'<div class="backimagepublicpayment">';
270 print
'<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' .
getDolGlobalString(
'MAIN_IMAGE_PUBLIC_PAYMENT').
'">';
275 print
'<br><br><br>';
280if (isModEnabled(
'paypal') && $paymentmethod ===
'paypal') {
283 $onlinetoken = $PAYPALTOKEN;
285 $payerID = $PAYPALPAYERID;
287 $currencyCodeType = $_SESSION[
'currencyCodeType'];
288 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
289 $paymentType = $_SESSION[
'PaymentType'];
291 $ipaddress = $_SESSION[
'ipaddress'];
293 dol_syslog(
"Call paymentok with token=".$onlinetoken.
" paymentType=".$paymentType.
" currencyCodeType=".$currencyCodeType.
" payerID=".$payerID.
" ipaddress=".$ipaddress.
" FinalPaymentAmt=".$FinalPaymentAmt.
" fulltag=".$fulltag, LOG_DEBUG, 0,
'_payment');
296 if (!empty($paymentType)) {
297 dol_syslog(
"We call GetExpressCheckoutDetails", LOG_DEBUG, 0,
'_payment');
301 $ack = strtoupper($resArray[
"ACK"]);
302 if ($ack ==
"SUCCESS" || $ack ==
"SUCCESSWITHWARNING") {
304 dol_syslog(
"Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0,
'_payment');
306 dol_syslog(
"Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, 0,
'_payment');
309 dol_syslog(
"We call DoExpressCheckoutPayment token=".$onlinetoken.
" paymentType=".$paymentType.
" currencyCodeType=".$currencyCodeType.
" payerID=".$payerID.
" ipaddress=".$ipaddress.
" FinalPaymentAmt=".$FinalPaymentAmt.
" fulltag=".$fulltag, LOG_DEBUG, 0,
'_payment');
310 $resArray2 =
confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
313 $ack = strtoupper($resArray2[
"ACK"]);
314 if ($ack ==
"SUCCESS" || $ack ==
"SUCCESSWITHWARNING") {
315 dol_syslog(
"Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0,
'_payment');
321 $object->resArray = $resArray2;
325 $PAYMENTSTATUS = urldecode($resArray2[
"PAYMENTSTATUS"]);
326 $TRANSACTIONID = urldecode($resArray2[
"TRANSACTIONID"]);
327 $TAXAMT = urldecode($resArray2[
"TAXAMT"]);
328 $NOTE = urldecode($resArray2[
"NOTE"]);
332 dol_syslog(
"Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0,
'_payment');
335 $ErrorCode = urldecode($resArray2[
"L_ERRORCODE0"]);
336 $ErrorShortMsg = urldecode($resArray2[
"L_SHORTMESSAGE0"]);
337 $ErrorLongMsg = urldecode($resArray2[
"L_LONGMESSAGE0"]);
338 $ErrorSeverityCode = urldecode($resArray2[
"L_SEVERITYCODE0"]);
341 $ErrorCode =
"SESSIONEXPIRED";
342 $ErrorLongMsg =
"Session expired. Can't retrieve PaymentType. Payment has not been validated.";
343 $ErrorShortMsg =
"Session expired";
345 dol_syslog($ErrorLongMsg, LOG_WARNING, 0,
'_payment');
349 $ErrorCode =
"PAYPALTOKENNOTDEFINED";
350 $ErrorLongMsg =
"The parameter PAYPALTOKEN was not defined. Payment has not been validated.";
351 $ErrorShortMsg =
"Parameter PAYPALTOKEN not defined";
353 dol_syslog($ErrorLongMsg, LOG_WARNING, 0,
'_payment');
358if (isModEnabled(
'paybox')) {
359 if ($paymentmethod ===
'paybox') {
365if (isModEnabled(
'stripe')) {
366 if ($paymentmethod ===
'stripe') {
375 'paymentmethod' => $paymentmethod,
377$reshook = $hookmanager->executeHooks(
'isPaymentOK', $parameters, $object, $action);
379 if (isset($hookmanager->resArray[
'ispaymentok'])) {
380 dol_syslog(
'ispaymentok overwrite by hook return with value='.$hookmanager->resArray[
'ispaymentok'], LOG_DEBUG, 0,
'_payment');
381 $ispaymentok = $hookmanager->resArray[
'ispaymentok'];
387if (empty($ipaddress)) {
388 $ipaddress = $_SESSION[
'ipaddress'];
390if (empty($TRANSACTIONID)) {
391 $TRANSACTIONID = empty($_SESSION[
'TRANSACTIONID']) ?
'' :$_SESSION[
'TRANSACTIONID'];
392 if (empty($TRANSACTIONID) &&
GETPOST(
'payment_intent',
'alphanohtml')) {
394 $TRANSACTIONID =
GETPOST(
'payment_intent',
'alphanohtml');
397if (empty($FinalPaymentAmt)) {
398 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'' : $_SESSION[
"FinalPaymentAmt"];
400if (empty($currencyCodeType)) {
401 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
404if (empty($paymentType)) {
405 $paymentType = empty($_SESSION[
"paymentType"]) ?
'' : $_SESSION[
"paymentType"];
412dol_syslog(
"ispaymentok=".$ispaymentok.
" tmptag=".var_export($tmptag,
true), LOG_DEBUG, 0,
'_payment');
416$appli = $mysoc->name;
421$postactionmessages = array();
424 if (empty($user->rights->societe)) {
425 $user->rights->societe =
new stdClass();
427 if (empty($user->rights->facture)) {
428 $user->rights->facture =
new stdClass();
429 $user->rights->facture->invoice_advance =
new stdClass();
431 if (empty($user->rights->adherent)) {
432 $user->rights->adherent =
new stdClass();
433 $user->rights->adherent->cotisation =
new stdClass();
435 $user->rights->societe->creer = 1;
436 $user->rights->facture->creer = 1;
437 $user->rights->facture->invoice_advance->validate = 1;
438 $user->rights->adherent->cotisation->creer = 1;
440 if (array_key_exists(
'MEM', $tmptag) && $tmptag[
'MEM'] > 0) {
447 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
448 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
449 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
453 $result1 =
$object->fetch((
int) $tmptag[
'MEM']);
454 $result2 = $adht->fetch(
$object->typeid);
456 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
457 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
459 dol_syslog(
"We have to process member with id=".$tmptag[
'MEM'].
" result1=".$result1.
" result2=".$result2, LOG_DEBUG, 0,
'_payment');
461 if ($result1 > 0 && $result2 > 0) {
463 if ($paymentmethod ==
'paybox') {
466 if ($paymentmethod ==
'paypal') {
469 if ($paymentmethod ==
'stripe') {
472 if (empty($paymentTypeId)) {
473 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
475 if (empty($paymentType)) {
480 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
483 if (empty($paymentTypeId) || $paymentTypeId < 0) {
488 dol_syslog(
"FinalPaymentAmt=".$FinalPaymentAmt.
" paymentTypeId=".$paymentTypeId.
" currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0,
'_payment');
491 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
493 if (empty($adht->caneditamount)) {
494 if (
$object->status == $object::STATUS_DRAFT) {
496 $amountbytype = $adht->amountByType(1);
500 $amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid];
510 $amountexpected = max(0, (
float) $amountexpected, (
float)
getDolGlobalInt(
"MEMBER_MIN_AMOUNT"));
512 if ($amountexpected && $amountexpected != $FinalPaymentAmt) {
514 $errmsg =
'Value of FinalPayment ('.$FinalPaymentAmt.
') propagated by payment page differs from the expected value for membership ('.$amountexpected.
'). May be a hack to try to pay a different amount ?';
515 $postactionmessages[] = $errmsg;
516 $ispostactionok = -1;
517 dol_syslog(
"Failed to validate member (bad amount check): ".$errmsg, LOG_ERR, 0,
'_payment');
526 $errmsg =
'Value of FinalPayment ('.$FinalPaymentAmt.
') is lower than the minimum allowed (' .
getDolGlobalString(
'MEMBER_MIN_AMOUNT').
'). May be a hack to try to pay a different amount ?';
527 $postactionmessages[] = $errmsg;
528 $ispostactionok = -1;
529 dol_syslog(
"Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0,
'_payment');
534 if ($currencyCodeType && $currencyCodeType !=
$conf->currency) {
536 $errmsg =
'Value of currencyCodeType ('.$currencyCodeType.
') differs from value expected for membership ('.
$conf->currency.
'). May be a hack to try to pay a different amount ?';
537 $postactionmessages[] = $errmsg;
538 $ispostactionok = -1;
539 dol_syslog(
"Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0,
'_payment');
544 $result = (
$object->status == $object::STATUS_EXCLUDED) ? -1 :
$object->validate($user);
545 if ($result < 0 || empty(
$object->datevalid)) {
548 $postactionmessages[] = $errmsg;
549 $postactionmessages = array_merge($postactionmessages,
$object->errors);
550 $ispostactionok = -1;
551 dol_syslog(
"Failed to validate member: ".$errmsg, LOG_ERR, 0,
'_payment');
556 $datesubscription =
$object->datevalid;
573 if ($datesubscription && $defaultdelay && $defaultdelayunit) {
576 while ($datesubend < $now) {
578 $datesubscription =
dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit);
585 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang);
587 $amount = $FinalPaymentAmt;
588 $formatteddate =
dol_print_date($paymentdate,
'dayhour',
'auto', $outputlangs);
589 $label = $langs->trans(
"OnlineSubscriptionPaymentLine", $formatteddate, $paymentmethod, $ipaddress, $TRANSACTIONID);
593 if ($paymentmethod ==
'paybox') {
596 if ($paymentmethod ==
'paypal') {
599 if ($paymentmethod ==
'stripe') {
605 'paymentmethod' => $paymentmethod,
607 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
609 if (isset($hookmanager->resArray[
'bankaccountid'])) {
610 dol_syslog(
'accountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
611 $accountid = $hookmanager->resArray[
'bankaccountid'];
614 if ($accountid < 0) {
616 $errmsg =
'Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
617 $postactionmessages[] = $errmsg;
618 $ispostactionok = -1;
619 dol_syslog(
"Failed to get the bank account to record payment: ".$errmsg, LOG_ERR, 0,
'_payment');
622 $operation =
dol_getIdFromCode($db, $paymentTypeId,
'c_paiement',
'id',
'code', 1);
625 $emetteur_banque =
'';
628 if (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankviainvoice' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
629 $option =
'bankviainvoice';
630 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankdirect' && isModEnabled(
"bank")) {
631 $option =
'bankdirect';
632 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'invoiceonly' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
633 $option =
'invoiceonly';
635 if (empty($option)) {
645 dol_syslog(
"Call ->subscription to create subscription", LOG_DEBUG, 0,
'_payment');
647 $crowid =
$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $membertypeid);
651 $postactionmessages[] = $errmsg;
652 $ispostactionok = -1;
654 $postactionmessages[] =
'Subscription created (id='.$crowid.
')';
660 dol_syslog(
"Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0,
'_payment');
662 $autocreatethirdparty = 1;
664 $result =
$object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty, $TRANSACTIONID, $service);
669 $postactionmessages[] =
$object->error;
670 $postactionmessages = array_merge($postactionmessages,
$object->errors);
671 $ispostactionok = -1;
673 if ($option ==
'bankviainvoice') {
674 $postactionmessages[] =
'Invoice, payment and bank record created';
675 dol_syslog(
"Invoice, payment and bank record created", LOG_DEBUG, 0,
'_payment');
677 if ($option ==
'bankdirect') {
678 $postactionmessages[] =
'Bank record created';
679 dol_syslog(
"Bank record created", LOG_DEBUG, 0,
'_payment');
681 if ($option ==
'invoiceonly') {
682 $postactionmessages[] =
'Invoice recorded';
683 dol_syslog(
"Invoice recorded", LOG_DEBUG, 0,
'_payment');
693 if ($paymentmethod ==
'stripe' && $autocreatethirdparty && $option ==
'bankviainvoice') {
696 dol_syslog(
"Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0,
'_payment');
698 $service =
'StripeTest';
701 $service =
'StripeLive';
706 $thirdparty =
new Societe($db);
707 $thirdparty->fetch($thirdparty_id);
709 include_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
710 $stripe =
new Stripe($db);
713 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
715 if (!$customer && $TRANSACTIONID) {
716 dol_syslog(
"No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0,
'_payment');
719 global $stripearrayofkeysbyenv;
720 \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus][
'secret_key']);
722 if (preg_match(
'/^pi_/', $TRANSACTIONID)) {
724 $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);
727 $chpi = \Stripe\Charge::retrieve($TRANSACTIONID);
731 $stripecu = $chpi->customer;
733 if (empty($stripecu)) {
735 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
738 if (preg_match(
'/^pi_/', $TRANSACTIONID) && $customer) {
739 \Stripe\PaymentIntent::update($chpi->id, array(
'customer' => $customer->id));
742 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)";
743 $sql .=
" VALUES (".$thirdparty_id.
", '', '".$db->escape($stripecu).
"', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus][
'publishable_key']).
"', ".((int) $servicestatus).
", ".((int)
$conf->entity).
", '".$db->idate(
dol_now()).
"', 0)";
744 $resql = $db->query($sql);
747 $errmsg =
'Failed to insert customer stripe id in database : '.$db->lasterror();
749 $postactionmessages[] = $errmsg;
750 $ispostactionok = -1;
755 $errmsg =
'Failed to retrieve paymentintent or charge from id';
757 $postactionmessages[] = $errmsg;
758 $ispostactionok = -1;
762 $errmsg =
'Failed to get or save customer stripe id in database : '.$e->getMessage();
764 $postactionmessages[] = $errmsg;
765 $ispostactionok = -1;
782 $nuser =
new User($db);
787 $sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE fk_member = ".((int)
$object->id);
788 $resqlcount = $db->query($sql);
790 $objcount = $db->fetch_object($resqlcount);
792 $found = $objcount->nb;
797 $result = $nuser->create_from_member($tmpuser,
$object->login);
798 $newpassword = $nuser->setPassword($user,
'');
801 $outputlangs->load(
"errors");
802 $postactionmessages[] =
'Error in create external user : '.$nuser->error;
804 $infouserlogin = $outputlangs->trans(
"Login").
': '.$nuser->login.
' '.
"\n".$outputlangs->trans(
"Password").
': '.$newpassword;
805 $postactionmessages[] = $langs->trans(
"NewUserCreated", $nuser->login);
808 $outputlangs->load(
"errors");
809 $postactionmessages[] =
'No user created because a user linked to member already exists';
815 dol_syslog(
"Send email to customer to ".
$object->email.
" if we have to (sendalsoemail = ".$sendalsoemail.
")", LOG_DEBUG, 0,
'_payment');
818 if (
$object->email && $sendalsoemail) {
823 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
826 $outputlangs->loadLangs(array(
"main",
"members"));
828 $arraydefaultmessage =
null;
831 if (!empty($labeltouse)) {
832 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
835 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
836 $subject = $arraydefaultmessage->topic;
837 $msg = $arraydefaultmessage->content;
842 if ($infouserlogin) {
843 $substitutionarray[
'__MEMBER_USER_LOGIN_INFORMATION__'] = $infouserlogin;
852 $listofpaths = array();
853 $listofnames = array();
854 $listofmimes = array();
855 if (is_object(
$object->invoice)) {
856 $invoicediroutput =
$conf->facture->dir_output;
858 $file = $fileparams[
'fullname'];
860 $listofpaths = array($file);
861 $listofnames = array(basename($file));
865 $moreinheader =
'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'.
"\r\n";
867 $result =
$object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
"", $moreinheader);
871 $postactionmessages[] = $errmsg;
872 $ispostactionok = -1;
875 $postactionmessages[] =
'Email sent to member (with invoice document attached)';
877 $postactionmessages[] =
'Email sent to member (without any attached document)';
885 $postactionmessages[] =
'Failed to get a valid value for "amount paid" or "payment type" to record the payment of subscription for member '.$tmptag[
'MEM'].
'. May be payment was already recorded.';
886 $ispostactionok = -1;
889 $postactionmessages[] =
'Member '.$tmptag[
'MEM'].
' for subscription paid was not found';
890 $ispostactionok = -1;
892 } elseif (array_key_exists(
'INV', $tmptag) && $tmptag[
'INV'] > 0) {
894 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
896 $result =
$object->fetch((
int) $tmptag[
'INV']);
898 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
901 if ($paymentmethod ===
'paybox') {
904 if ($paymentmethod ===
'paypal') {
907 if ($paymentmethod ===
'stripe') {
910 if (empty($paymentTypeId)) {
911 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
913 if (empty($paymentType)) {
918 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
921 if (empty($paymentTypeId) || $paymentTypeId < 0) {
926 dol_syslog(
"FinalPaymentAmt = ".$FinalPaymentAmt.
" paymentTypeId = ".$paymentTypeId, LOG_DEBUG, 0,
'_payment');
929 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
933 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
935 $paiement->datepaye = $now;
936 if ($currencyCodeType ==
$conf->currency) {
937 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
939 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
941 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.
$conf->currency.
')';
942 $ispostactionok = -1;
945 $paiement->paiementid = $paymentTypeId;
946 $paiement->num_payment =
'';
947 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
948 $paiement->ext_payment_id = $TRANSACTIONID;
950 $paiement->ext_payment_site = $service;
953 $paiement_id = $paiement->create($user, 1);
954 if ($paiement_id < 0) {
955 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
956 $ispostactionok = -1;
959 $postactionmessages[] =
'Payment created';
964 if (!$error && isModEnabled(
"bank")) {
966 if ($paymentmethod ==
'paybox') {
968 } elseif ($paymentmethod ==
'paypal') {
970 } elseif ($paymentmethod ==
'stripe') {
976 'paymentmethod' => $paymentmethod,
978 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
980 if (isset($hookmanager->resArray[
'bankaccountid'])) {
981 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
982 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
985 if ($bankaccountid > 0) {
986 $label =
'(CustomerInvoicePayment)';
988 $label =
'(CustomerInvoicePaymentBack)';
990 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
992 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
993 $ispostactionok = -1;
996 $postactionmessages[] =
'Bank transaction of payment created';
1000 $postactionmessages[] =
'Setup of bank account to use in module '.$paymentmethod.
' was not set. Your payment was really executed but we failed to record it. Please contact us.';
1001 $ispostactionok = -1;
1012 $postactionmessages[] =
'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.
') or "payment type id" ('.$paymentTypeId.
') to record the payment of invoice '.$tmptag[
'INV'].
'. May be payment was already recorded.';
1013 $ispostactionok = -1;
1016 $postactionmessages[] =
'Invoice paid '.$tmptag[
'INV'].
' was not found';
1017 $ispostactionok = -1;
1019 } elseif (array_key_exists(
'ORD', $tmptag) && $tmptag[
'ORD'] > 0) {
1020 include_once DOL_DOCUMENT_ROOT .
'/commande/class/commande.class.php';
1022 $result =
$object->fetch((
int) $tmptag[
'ORD']);
1024 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1027 if ($paymentmethod ==
'paybox') {
1030 if ($paymentmethod ==
'paypal') {
1033 if ($paymentmethod ==
'stripe') {
1036 if (empty($paymentTypeId)) {
1037 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1039 if (empty($paymentType)) {
1040 $paymentType =
'CB';
1044 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1047 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1053 if (isModEnabled(
'invoice')) {
1054 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1055 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1057 $result = $invoice->createFromOrder($object, $user);
1059 $object->classifyBilled($user);
1060 $invoice->validate($user);
1062 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1064 $paiement->datepaye = $now;
1065 if ($currencyCodeType ==
$conf->currency) {
1066 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1068 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1070 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.
$conf->currency.
')';
1071 $ispostactionok = -1;
1074 $paiement->paiementid = $paymentTypeId;
1075 $paiement->num_payment =
'';
1076 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1077 $paiement->ext_payment_id = $TRANSACTIONID;
1078 $paiement->ext_payment_site = $service;
1081 $paiement_id = $paiement->create($user, 1);
1082 if ($paiement_id < 0) {
1083 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1084 $ispostactionok = -1;
1087 $postactionmessages[] =
'Payment created';
1088 $ispostactionok = 1;
1092 if (!$error && isModEnabled(
"bank")) {
1094 if ($paymentmethod ==
'paybox') {
1096 } elseif ($paymentmethod ==
'paypal') {
1098 } elseif ($paymentmethod ==
'stripe') {
1104 'paymentmethod' => $paymentmethod,
1106 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1107 if ($reshook >= 0) {
1108 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1109 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1110 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1113 if ($bankaccountid > 0) {
1114 $label =
'(CustomerInvoicePayment)';
1116 $label =
'(CustomerInvoicePaymentBack)';
1118 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1120 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1121 $ispostactionok = -1;
1124 $postactionmessages[] =
'Bank transaction of payment created';
1125 $ispostactionok = 1;
1128 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1129 $ispostactionok = -1;
1140 $postactionmessages[] =
'Failed to create invoice form order ' . $tmptag[
'ORD'] .
'.';
1141 $ispostactionok = -1;
1144 $postactionmessages[] =
'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt .
') or "payment type id" (' . $paymentTypeId .
') to record the payment of order ' . $tmptag[
'ORD'] .
'. May be payment was already recorded.';
1145 $ispostactionok = -1;
1148 $postactionmessages[] =
'Invoice module is not enable';
1149 $ispostactionok = -1;
1152 $postactionmessages[] =
'Order paid ' . $tmptag[
'ORD'] .
' was not found';
1153 $ispostactionok = -1;
1155 } elseif (array_key_exists(
'DON', $tmptag) && $tmptag[
'DON'] > 0) {
1156 include_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
1157 $don =
new Don($db);
1158 $result = $don->fetch((
int) $tmptag[
'DON']);
1161 if ($paymentmethod ==
'paybox') {
1164 if ($paymentmethod ==
'paypal') {
1165 $paymentTypeId =
getDolGlobalInt(
'global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS');
1167 if ($paymentmethod ==
'stripe') {
1170 if (empty($paymentTypeId)) {
1171 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1173 if (empty($paymentType)) {
1174 $paymentType =
'CB';
1178 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1181 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1187 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1191 include_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
1194 $totalpaid = $FinalPaymentAmt;
1196 if ($currencyCodeType ==
$conf->currency) {
1197 $paiement->amounts = array(
$object->id => $totalpaid);
1200 $postactionmessages[] =
'Payment donation can\'t be paid with different currency than '.$conf->currency;
1201 $ispostactionok = -1;
1205 $paiement->fk_donation = $don->id;
1206 $paiement->datep = $now;
1207 $paiement->paymenttype = $paymentTypeId;
1208 $paiement->num_payment =
'';
1209 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1210 $paiement->ext_payment_id = $TRANSACTIONID;
1211 $paiement->ext_payment_site = $service;
1214 $paiement_id = $paiement->create($user, 1);
1215 if ($paiement_id < 0) {
1216 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1217 $ispostactionok = -1;
1220 $postactionmessages[] =
'Payment created';
1221 $ispostactionok = 1;
1223 if ($totalpaid >= $don->getRemainToPay()) {
1224 $don->setPaid($don->id);
1229 if (!$error && isModEnabled(
"bank")) {
1231 if ($paymentmethod ==
'paybox') {
1233 } elseif ($paymentmethod ==
'paypal') {
1235 } elseif ($paymentmethod ==
'stripe') {
1241 'paymentmethod' => $paymentmethod,
1243 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1244 if ($reshook >= 0) {
1245 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1246 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1247 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1250 if ($bankaccountid > 0) {
1251 $label =
'(DonationPayment)';
1252 $result = $paiement->addPaymentToBank($user,
'payment_donation', $label, $bankaccountid,
'',
'');
1254 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1255 $ispostactionok = -1;
1258 $postactionmessages[] =
'Bank transaction of payment created';
1259 $ispostactionok = 1;
1262 $postactionmessages[] =
'Setup of bank account to use in module '.$paymentmethod.
' was not set. Your payment was really executed but we failed to record it. Please contact us.';
1263 $ispostactionok = -1;
1274 $postactionmessages[] =
'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.
') or "payment type id" ('.$paymentTypeId.
') to record the payment of donation '.$tmptag[
'DON'].
'. May be payment was already recorded.';
1275 $ispostactionok = -1;
1278 $postactionmessages[] =
'Donation paid '.$tmptag[
'DON'].
' was not found';
1279 $ispostactionok = -1;
1284 } elseif (array_key_exists(
'ATT', $tmptag) && $tmptag[
'ATT'] > 0) {
1286 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1287 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1288 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1290 $result =
$object->fetch($ref);
1293 if ($paymentmethod ==
'paybox') {
1296 if ($paymentmethod ==
'paypal') {
1299 if ($paymentmethod ==
'stripe') {
1302 if (empty($paymentTypeId)) {
1303 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1305 if (empty($paymentType)) {
1306 $paymentType =
'CB';
1310 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1313 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1319 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1320 $resultvalidate =
$object->validate($user);
1321 if ($resultvalidate < 0) {
1322 $postactionmessages[] =
'Cannot validate invoice';
1323 $ispostactionok = -1;
1329 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1331 $paiement->datepaye = $now;
1332 if ($currencyCodeType ==
$conf->currency) {
1333 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1335 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1337 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.
$conf->currency.
')';
1338 $ispostactionok = -1;
1341 $paiement->paiementid = $paymentTypeId;
1342 $paiement->num_payment =
'';
1343 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress.
' for event registration';
1344 $paiement->ext_payment_id = $TRANSACTIONID;
1345 $paiement->ext_payment_site = $service;
1348 $paiement_id = $paiement->create($user, 1);
1349 if ($paiement_id < 0) {
1350 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1351 $ispostactionok = -1;
1354 $postactionmessages[] =
'Payment created';
1355 $ispostactionok = 1;
1359 if (!$error && isModEnabled(
"bank")) {
1361 if ($paymentmethod ==
'paybox') {
1363 } elseif ($paymentmethod ==
'paypal') {
1365 } elseif ($paymentmethod ==
'stripe') {
1371 'paymentmethod' => $paymentmethod,
1373 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1374 if ($reshook >= 0) {
1375 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1376 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1377 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1380 if ($bankaccountid > 0) {
1381 $label =
'(CustomerInvoicePayment)';
1383 $label =
'(CustomerInvoicePaymentBack)';
1385 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1387 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1388 $ispostactionok = -1;
1391 $postactionmessages[] =
'Bank transaction of payment created';
1392 $ispostactionok = 1;
1395 $postactionmessages[] =
'Setup of bank account to use in module '.$paymentmethod.
' was not set. Your payment was really executed but we failed to record it. Please contact us.';
1396 $ispostactionok = -1;
1405 $resultattendee = $attendeetovalidate->fetch((
int) $tmptag[
'ATT']);
1406 if ($resultattendee < 0) {
1410 $attendeetovalidate->validate($user);
1412 $attendeetovalidate->amount = $FinalPaymentAmt;
1413 $attendeetovalidate->date_subscription =
dol_now();
1414 $attendeetovalidate->update($user);
1428 $thirdparty =
new Societe($db);
1429 $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
1430 if ($resultthirdparty < 0) {
1431 setEventMessages($resultthirdparty->error, $resultthirdparty->errors,
"errors");
1433 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1434 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1438 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1440 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1442 $arraydefaultmessage =
null;
1444 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');
1446 if (!empty($idoftemplatetouse)) {
1447 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1450 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1451 $subject = $arraydefaultmessage->topic;
1452 $msg = $arraydefaultmessage->content;
1454 $subject =
'['.$appli.
'] '.
$object->ref.
' - '.$outputlangs->trans(
"NewRegistration");
1455 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfRegistrationWasReceived");
1464 $sendto = $attendeetovalidate->email;
1466 if ($thirdparty->email) {
1467 $cc = $thirdparty->email;
1469 if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
1470 $cc = ($cc ?
', ' :
'').$attendeetovalidate->email_company;
1475 $urlback = $_SERVER[
"REQUEST_URI"];
1481 $listofpaths = array();
1482 $listofnames = array();
1483 $listofmimes = array();
1484 if (is_object($object)) {
1485 $invoicediroutput =
$conf->facture->dir_output;
1487 $file = $fileparams[
'fullname'];
1489 $listofpaths = array($file);
1490 $listofnames = array(basename($file));
1494 $trackid =
'inv'.$object->id;
1496 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc,
'', 0, ($ishtml ? 1 : 0),
'',
'', $trackid,
'',
'standard');
1498 $result = $mailfile->sendfile();
1500 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1502 dol_syslog(
"Failed to send EMail to ".$sendto.
' - '.$mailfile->error, LOG_ERR, 0,
'_payment');
1508 $postactionmessages[] =
'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.
') or "payment type id" ('.$paymentTypeId.
') to record the payment of invoice '.$tmptag[
'ATT'].
'. May be payment was already recorded.';
1509 $ispostactionok = -1;
1512 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1513 $ispostactionok = -1;
1515 } elseif (array_key_exists(
'BOO', $tmptag) && $tmptag[
'BOO'] > 0) {
1517 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1518 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1519 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1521 $result =
$object->fetch($ref);
1523 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1526 if ($paymentmethod ==
'paybox') {
1529 if ($paymentmethod ==
'paypal') {
1532 if ($paymentmethod ==
'stripe') {
1535 if (empty($paymentTypeId)) {
1536 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1538 if (empty($paymentType)) {
1539 $paymentType =
'CB';
1543 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1546 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1552 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1553 $resultvalidate =
$object->validate($user);
1554 if ($resultvalidate < 0) {
1555 $postactionmessages[] =
'Cannot validate invoice';
1556 $ispostactionok = -1;
1562 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1564 $paiement->datepaye = $now;
1565 if ($currencyCodeType ==
$conf->currency) {
1566 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1568 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1570 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.
$conf->currency.
')';
1571 $ispostactionok = -1;
1574 $paiement->paiementid = $paymentTypeId;
1575 $paiement->num_payment =
'';
1576 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1577 $paiement->ext_payment_id = $TRANSACTIONID;
1578 $paiement->ext_payment_site = $service;
1581 $paiement_id = $paiement->create($user, 1);
1582 if ($paiement_id < 0) {
1583 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1584 $ispostactionok = -1;
1587 $postactionmessages[] =
'Payment created';
1588 $ispostactionok = 1;
1592 if (!$error && isModEnabled(
"bank")) {
1594 if ($paymentmethod ==
'paybox') {
1596 } elseif ($paymentmethod ==
'paypal') {
1598 } elseif ($paymentmethod ==
'stripe') {
1604 'paymentmethod' => $paymentmethod,
1606 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1607 if ($reshook >= 0) {
1608 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1609 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1610 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1613 if ($bankaccountid > 0) {
1614 $label =
'(CustomerInvoicePayment)';
1616 $label =
'(CustomerInvoicePaymentBack)';
1618 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1620 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1621 $ispostactionok = -1;
1624 $postactionmessages[] =
'Bank transaction of payment created';
1625 $ispostactionok = 1;
1628 $postactionmessages[] =
'Setup of bank account to use in module '.$paymentmethod.
' was not set. Your payment was really executed but we failed to record it. Please contact us.';
1629 $ispostactionok = -1;
1636 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1637 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1639 $resultbooth = $booth->fetch((
int) $tmptag[
'BOO']);
1640 if ($resultbooth < 0) {
1644 $booth->status = ConferenceOrBooth::STATUS_SUGGESTED;
1645 $resultboothupdate = $booth->update($user);
1646 if ($resultboothupdate<0) {
1649 $resultinvoice = $invoice->fetch($ref);
1650 if ($resultinvoice<0) {
1651 $postactionmessages[] =
'Could not find the associated invoice.';
1652 $ispostactionok = -1;
1655 $thirdparty =
new Societe($db);
1656 $resultthirdparty = $thirdparty->fetch($invoice->socid);
1657 if ($resultthirdparty<0) {
1662 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1663 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1667 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1669 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1671 $arraydefaultmessage =
null;
1673 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');
1675 if (!empty($idoftemplatetouse)) {
1676 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1679 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1680 $subject = $arraydefaultmessage->topic;
1681 $msg = $arraydefaultmessage->content;
1683 $subject =
'['.$appli.
'] '.$booth->ref.
' - '.$outputlangs->trans(
"NewRegistration").
']';
1684 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfBoothWasReceived");
1693 $sendto = $thirdparty->email;
1695 $urlback = $_SERVER[
"REQUEST_URI"];
1698 $trackid =
'inv'.$invoice->id;
1700 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
1702 $result = $mailfile->sendfile();
1704 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1706 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
1721 $postactionmessages[] =
'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.
') or "payment type id" ('.$paymentTypeId.
') to record the payment of invoice '.$tmptag[
'ATT'].
'. May be payment was already recorded.';
1722 $ispostactionok = -1;
1725 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1726 $ispostactionok = -1;
1728 } elseif (array_key_exists(
'CON', $tmptag) && $tmptag[
'CON'] > 0) {
1729 include_once DOL_DOCUMENT_ROOT .
'/contrat/class/contrat.class.php';
1731 $result =
$object->fetch((
int) $tmptag[
'CON']);
1733 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1736 if ($paymentmethod ==
'paybox') {
1739 if ($paymentmethod ==
'paypal') {
1742 if ($paymentmethod ==
'stripe') {
1745 if (empty($paymentTypeId)) {
1746 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1748 if (empty($paymentType)) {
1749 $paymentType =
'CB';
1753 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1756 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1761 $currencyCodeType = $_SESSION[
'currencyCodeType'];
1762 $contract_lines = (array_key_exists(
'COL', $tmptag) && $tmptag[
'COL'] > 0) ? $tmptag[
'COL'] : null;
1765 if (isModEnabled(
'invoice')) {
1766 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1767 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1769 $result = $invoice->createFromContract($object, $user, array((
int) $contract_lines));
1772 $invoice->validate($user);
1774 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1776 $paiement->datepaye = $now;
1777 if ($currencyCodeType ==
$conf->currency) {
1778 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1780 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1782 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.
$conf->currency.
')';
1783 $ispostactionok = -1;
1786 $paiement->paiementid = $paymentTypeId;
1787 $paiement->num_payment =
'';
1788 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1789 $paiement->ext_payment_id = $TRANSACTIONID;
1790 $paiement->ext_payment_site = $service;
1793 $paiement_id = $paiement->create($user, 1);
1794 if ($paiement_id < 0) {
1795 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1796 $ispostactionok = -1;
1799 $postactionmessages[] =
'Payment created';
1800 $ispostactionok = 1;
1804 if (!$error && isModEnabled(
"bank")) {
1806 if ($paymentmethod ==
'paybox') {
1808 } elseif ($paymentmethod ==
'paypal') {
1810 } elseif ($paymentmethod ==
'stripe') {
1816 'paymentmethod' => $paymentmethod,
1818 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1819 if ($reshook >= 0) {
1820 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1821 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1822 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1825 if ($bankaccountid > 0) {
1826 $label =
'(CustomerInvoicePayment)';
1828 $label =
'(CustomerInvoicePaymentBack)';
1830 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1832 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1833 $ispostactionok = -1;
1836 $postactionmessages[] =
'Bank transaction of payment created';
1837 $ispostactionok = 1;
1840 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1841 $ispostactionok = -1;
1852 $msg =
'Failed to create invoice form contract ' . $tmptag[
'CON'];
1853 if (!empty($cols)) {
1854 $msg .=
' and col '. $cols .
'.';
1856 $postactionmessages[] = $msg;
1857 $ispostactionok = -1;
1860 $postactionmessages[] =
'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt .
') or "payment type id" (' . $paymentTypeId .
') to record the payment of contract ' . $tmptag[
'CON'] .
'. Maybe payment was already recorded.';
1861 $ispostactionok = -1;
1864 $postactionmessages[] =
'Invoice module is not enable';
1865 $ispostactionok = -1;
1868 $msg =
'Contract paid ' . $tmptag[
'CON'] .
' was not found';
1869 if (!empty($cols)) {
1870 $msg .=
' for col '.$tmptag[
'COL'] .
'.';
1872 $postactionmessages[] = $msg;
1873 $ispostactionok = -1;
1882 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
1883 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
1885 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
1886 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'': $_SESSION[
"FinalPaymentAmt"];
1887 $paymentType = empty($_SESSION[
'PaymentType']) ?
'' : $_SESSION[
'PaymentType'];
1889 if (is_object($object) && method_exists($object,
'call_trigger')) {
1891 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1896 } elseif (get_class($object) ==
'stdClass') {
1898 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1900 $result = $paiement->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1909if (empty($doactionsthenredirect)) {
1911 print $langs->trans(
"YourPaymentHasBeenRecorded").
"<br>\n";
1912 if ($TRANSACTIONID) {
1913 print $langs->trans(
"ThisIsTransactionId", $TRANSACTIONID).
"<br><br>\n";
1917 print
img_picto(
'',
'tick',
'class="green fa-2x"');
1921 $key =
'ONLINE_PAYMENT_MESSAGE_OK';
1927 print $langs->trans(
'DoExpressCheckoutPaymentAPICallFailed').
"<br>\n";
1928 print $langs->trans(
'DetailedErrorMessage').
": ".$ErrorLongMsg.
"<br>\n";
1929 print $langs->trans(
'ShortErrorMessage').
": ".$ErrorShortMsg.
"<br>\n";
1930 print $langs->trans(
'ErrorCode').
": ".$ErrorCode.
"<br>\n";
1931 print $langs->trans(
'ErrorSeverityCode').
": ".$ErrorSeverityCode.
"<br>\n";
1933 if ($mysoc->email) {
1934 print
"\nPlease, send a screenshot of this page to ".$mysoc->email.
"<br>\n";
1946 dol_syslog(
"Send email to admins if we have to (sendemail = ".$sendemail.
")", LOG_DEBUG, 0,
'_payment');
1951 $companylangs->setDefaultLang($mysoc->default_lang);
1952 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
1954 $sendto = $sendemail;
1957 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1958 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1963 $urlback = $_SERVER[
"REQUEST_URI"];
1964 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived");
1966 if (array_key_exists(
'MEM', $tmptag)) {
1967 $url = $urlwithroot.
"/adherents/subscription.php?rowid=".((int) $tmptag[
'MEM']);
1968 $content .=
'<strong>'.$companylangs->trans(
"PaymentSubscription").
"</strong><br><br>\n";
1969 $content .= $companylangs->trans(
"MemberId").
': <strong>'.$tmptag[
'MEM'].
"</strong><br>\n";
1970 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1971 } elseif (array_key_exists(
'INV', $tmptag)) {
1972 $url = $urlwithroot.
"/compta/facture/card.php?id=".((int) $tmptag[
'INV']);
1973 $content .=
'<strong>'.$companylangs->trans(
"Payment").
"</strong><br><br>\n";
1974 $content .= $companylangs->trans(
"InvoiceId").
': <strong>'.$tmptag[
'INV'].
"</strong><br>\n";
1976 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1978 $content .= $companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived").
"<br>\n";
1980 $content .= $companylangs->transnoentities(
"PostActionAfterPayment").
' : ';
1981 if ($ispostactionok > 0) {
1983 $content .=
'<span style="color: green">'.$companylangs->transnoentitiesnoconv(
"OK").
'</span>';
1984 } elseif ($ispostactionok == 0) {
1985 $content .= $companylangs->transnoentitiesnoconv(
"None");
1987 $topic .= ($ispostactionok ?
'' :
' ('.$companylangs->trans(
"WarningPostActionErrorAfterPayment").
')');
1988 $content .=
'<span class="star">'.$companylangs->transnoentitiesnoconv(
"Error").
'</span>';
1990 $content .=
'<br>'.
"\n";
1991 foreach ($postactionmessages as $postactionmessage) {
1992 $content .=
' * '.$postactionmessage.
'<br>'.
"\n";
1994 if ($ispostactionok < 0) {
1995 $content .= $langs->transnoentities(
"ARollbackWasPerformedOnPostActions");
1997 $content .=
'<br>'.
"\n";
1999 $content .=
"<br>\n";
2000 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
2001 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
2002 $content .= $companylangs->transnoentitiesnoconv(
"ThisIsTransactionId").
': <strong>'.$TRANSACTIONID.
"</strong><br>\n";
2003 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
2004 $content .=
"<br>\n";
2005 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
2007 if (!empty($ErrorCode)) {
2008 $content .=
"ErrorCode = ".$ErrorCode.
"<br>\n";
2010 if (!empty($ErrorShortMsg)) {
2011 $content .=
"ErrorShortMsg = ".$ErrorShortMsg.
"<br>\n";
2013 if (!empty($ErrorLongMsg)) {
2014 $content .=
"ErrorLongMsg = ".$ErrorLongMsg.
"<br>\n";
2016 if (!empty($ErrorSeverityCode)) {
2017 $content .=
"ErrorSeverityCode = ".$ErrorSeverityCode.
"<br>\n";
2024 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2025 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
2027 $result = $mailfile->sendfile();
2029 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2032 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2040 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
2041 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
2043 $paymentType = $_SESSION[
'PaymentType'];
2044 $currencyCodeType = $_SESSION[
'currencyCodeType'];
2045 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
2047 if (is_object($object) && method_exists($object,
'call_trigger')) {
2049 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_KO', $user);
2059 $companylangs->setDefaultLang($mysoc->default_lang);
2060 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
2062 $sendto = $sendemail;
2065 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
2066 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
2069 $urlback = $_SERVER[
"REQUEST_URI"];
2070 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"ValidationOfPaymentFailed");
2072 $content .=
'<span style="color: orange">'.$companylangs->transnoentitiesnoconv(
"PaymentSystemConfirmPaymentPageWasCalledButFailed").
"</span>\n";
2074 $content .=
"<br><br>\n";
2075 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
2076 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
2077 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
2078 $content .=
"<br>\n";
2079 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
2085 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2086 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
2088 $result = $mailfile->sendfile();
2090 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2092 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2099unset($_SESSION[
"FinalPaymentAmt"]);
2100unset($_SESSION[
"TRANSACTIONID"]);
2104if (empty($doactionsthenredirect)) {
2107 print
"<!-- Info for payment: FinalPaymentAmt=".dol_escape_htmltag($FinalPaymentAmt).
" paymentTypeId=".
dol_escape_htmltag($paymentTypeId).
" currencyCodeType=".
dol_escape_htmltag($currencyCodeType).
" -->\n";
2112if (empty($doactionsthenredirect)) {
2123if (!empty($doactionsthenredirect)) {
2127 $ext_urlok = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentok&fulltag='.$FULLTAG;
2128 print
"<script>window.top.location.href = '".dol_escape_js($ext_urlok) .
"';</script>";
2132 $ext_urlko = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentko&fulltag='.$FULLTAG;
2133 print
"<script>window.top.location.href = '".dol_escape_js($ext_urlko).
"';</script>";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage customers orders.
Class for ConferenceOrBoothAttendee.
Class for ConferenceOrBooth.
Class to manage donations.
Class to manage invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage payments of customer invoices.
Class to manage payments of donations.
Class to manage third parties objects (customers, suppliers, prospects...)
Stripe class @TODO No reason to extends CommonObject.
Class to manage translations.
Class to manage Dolibarr users.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML pages.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_most_recent_file($dir, $regexfilter='', $excludefilter=array('(\.meta|_preview.*\.png) $', '^\.'), $nohook=0, $mode=0)
Return file(s) into a directory (by default most recent)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dolExplodeIntoArray($string, $delimiter=';', $kv='=')
Split a string with 2 keys into key array.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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).
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $tag)
Validate payment.
getDetails($token)
Prepares the parameters for the GetExpressCheckoutDetails API Call.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.