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';
66$hookmanager->initHooks(array(
'newpayment'));
68$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"paybox",
"paypal",
"stripe"));
71if (isModEnabled(
'paypal')) {
72 $PAYPAL_API_USER =
"";
76 $PAYPAL_API_PASSWORD =
"";
80 $PAYPAL_API_SIGNATURE =
"";
84 $PAYPAL_API_SANDBOX =
"";
97 $PAYPALTOKEN =
GETPOST(
'TOKEN');
98 if (empty($PAYPALTOKEN)) {
99 $PAYPALTOKEN =
GETPOST(
'token');
101 $PAYPALPAYERID =
GETPOST(
'PAYERID');
102 if (empty($PAYPALPAYERID)) {
103 $PAYPALPAYERID =
GETPOST(
'PayerID');
108if (empty($FULLTAG)) {
114$suffix =
GETPOST(
"suffix",
'aZ09');
121if (preg_match(
'/PM=([^\.]+)/', $FULLTAG, $reg)) {
122 $paymentmethod = $reg[1];
124if (empty($paymentmethod)) {
125 dol_syslog(
"***** paymentok.php was called with a non valid parameter FULLTAG=".$FULLTAG, LOG_DEBUG, 0,
'_payment');
126 dol_print_error(
null,
'The callback url does not contain a parameter fulltag that should help us to find the payment method used');
130dol_syslog(
"***** paymentok.php is called paymentmethod=".$paymentmethod.
" FULLTAG=".$FULLTAG.
" REQUEST_URI=".$_SERVER[
"REQUEST_URI"], LOG_DEBUG, 0,
'_payment');
133$ws = preg_match(
'/WS=([^\.]+)/', $FULLTAG, $reg_ws) ? $reg_ws[1] : 0;
135 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');
138$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod);
141if (empty($validpaymentmethod)) {
146$creditor = $mysoc->name;
147$paramcreditor =
'ONLINE_PAYMENT_CREDITOR';
148$paramcreditorlong =
'ONLINE_PAYMENT_CREDITOR_'.$suffix;
158$PAYMENTSTATUS = $TRANSACTIONID = $TAXAMT = $NOTE =
'';
160$ErrorCode = $ErrorShortMsg = $ErrorLongMsg = $ErrorSeverityCode =
'';
174 $doactionsthenredirect = 1;
180dol_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');
181dol_syslog(
"_SERVER[SERVER_NAME] = ".(empty($_SERVER[
"SERVER_NAME"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_NAME"])), LOG_DEBUG, 0,
'_payment');
182dol_syslog(
"_SERVER[SERVER_ADDR] = ".(empty($_SERVER[
"SERVER_ADDR"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_ADDR"])), LOG_DEBUG, 0,
'_payment');
185foreach ($_POST as $k => $v) {
186 if (is_scalar($k) && is_scalar($v)) {
187 $tracepost .=
"$k - $v\n";
190dol_syslog(
"POST=".$tracepost, LOG_DEBUG, 0,
'_payment');
192foreach ($_SESSION as $k => $v) {
193 if (is_scalar($k) && is_scalar($v)) {
194 $tracesession .=
"$k - $v\n";
197dol_syslog(
"SESSION=".$tracesession, LOG_DEBUG, 0,
'_payment');
201 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
204$conf->dol_hide_topmenu = 1;
205$conf->dol_hide_leftmenu = 1;
209if (empty($doactionsthenredirect)) {
210 $replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
211 llxHeader($head, $langs->trans(
"PaymentForm"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea);
215 print
'<span id="dolpaymentspan"></span>'.
"\n";
216 print
'<div id="dolpaymentdiv" class="center">'.
"\n";
221 $logosmall = $mysoc->logo_small;
222 $logo = $mysoc->logo;
223 $paramlogo =
'ONLINE_PAYMENT_LOGO_'.$suffix;
233 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
234 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
235 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
236 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
237 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
238 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
243 print
'<div class="backgreypublicpayment">';
244 print
'<div class="logopublicpayment">';
245 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
249 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>';
252 } elseif ($creditor) {
253 print
'<div class="backgreypublicpayment">';
254 print
'<div class="logopublicpayment">';
260 print
'<div class="backimagepublicpayment">';
261 print
'<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' .
getDolGlobalString(
'MAIN_IMAGE_PUBLIC_PAYMENT').
'">';
266 print
'<br><br><br>';
271if (isModEnabled(
'paypal') && $paymentmethod ===
'paypal') {
274 $onlinetoken = $PAYPALTOKEN;
276 $payerID = $PAYPALPAYERID;
278 $currencyCodeType = $_SESSION[
'currencyCodeType'];
279 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
280 $paymentType = $_SESSION[
'PaymentType'];
282 $ipaddress = $_SESSION[
'ipaddress'];
284 dol_syslog(
"Call paymentok with token=".$onlinetoken.
" paymentType=".$paymentType.
" currencyCodeType=".$currencyCodeType.
" payerID=".$payerID.
" ipaddress=".$ipaddress.
" FinalPaymentAmt=".$FinalPaymentAmt.
" fulltag=".$fulltag, LOG_DEBUG, 0,
'_payment');
287 if (!empty($paymentType)) {
288 dol_syslog(
"We call GetExpressCheckoutDetails", LOG_DEBUG, 0,
'_payment');
292 $ack = strtoupper($resArray[
"ACK"]);
293 if ($ack ==
"SUCCESS" || $ack ==
"SUCCESSWITHWARNING") {
295 dol_syslog(
"Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0,
'_payment');
297 dol_syslog(
"Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, 0,
'_payment');
300 dol_syslog(
"We call DoExpressCheckoutPayment token=".$onlinetoken.
" paymentType=".$paymentType.
" currencyCodeType=".$currencyCodeType.
" payerID=".$payerID.
" ipaddress=".$ipaddress.
" FinalPaymentAmt=".$FinalPaymentAmt.
" fulltag=".$fulltag, LOG_DEBUG, 0,
'_payment');
301 $resArray2 =
confirmPayment($onlinetoken, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
304 $ack = strtoupper($resArray2[
"ACK"]);
305 if ($ack ==
"SUCCESS" || $ack ==
"SUCCESSWITHWARNING") {
306 dol_syslog(
"Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0,
'_payment');
312 $object->resArray = $resArray2;
316 $PAYMENTSTATUS = urldecode($resArray2[
"PAYMENTSTATUS"]);
317 $TRANSACTIONID = urldecode($resArray2[
"TRANSACTIONID"]);
318 $TAXAMT = urldecode($resArray2[
"TAXAMT"]);
319 $NOTE = urldecode($resArray2[
"NOTE"]);
323 dol_syslog(
"Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0,
'_payment');
326 $ErrorCode = urldecode($resArray2[
"L_ERRORCODE0"]);
327 $ErrorShortMsg = urldecode($resArray2[
"L_SHORTMESSAGE0"]);
328 $ErrorLongMsg = urldecode($resArray2[
"L_LONGMESSAGE0"]);
329 $ErrorSeverityCode = urldecode($resArray2[
"L_SEVERITYCODE0"]);
332 $ErrorCode =
"SESSIONEXPIRED";
333 $ErrorLongMsg =
"Session expired. Can't retrieve PaymentType. Payment has not been validated.";
334 $ErrorShortMsg =
"Session expired";
336 dol_syslog($ErrorLongMsg, LOG_WARNING, 0,
'_payment');
340 $ErrorCode =
"PAYPALTOKENNOTDEFINED";
341 $ErrorLongMsg =
"The parameter PAYPALTOKEN was not defined. Payment has not been validated.";
342 $ErrorShortMsg =
"Parameter PAYPALTOKEN not defined";
344 dol_syslog($ErrorLongMsg, LOG_WARNING, 0,
'_payment');
349if (isModEnabled(
'paybox')) {
350 if ($paymentmethod ===
'paybox') {
356if (isModEnabled(
'stripe')) {
357 if ($paymentmethod ===
'stripe') {
366 'paymentmethod' => $paymentmethod,
368$reshook = $hookmanager->executeHooks(
'isPaymentOK', $parameters, $object, $action);
370 if (isset($hookmanager->resArray[
'ispaymentok'])) {
371 dol_syslog(
'ispaymentok overwrite by hook return with value='.$hookmanager->resArray[
'ispaymentok'], LOG_DEBUG, 0,
'_payment');
372 $ispaymentok = $hookmanager->resArray[
'ispaymentok'];
378if (empty($ipaddress)) {
379 $ipaddress = $_SESSION[
'ipaddress'];
381if (empty($TRANSACTIONID)) {
382 $TRANSACTIONID = empty($_SESSION[
'TRANSACTIONID']) ?
'' :$_SESSION[
'TRANSACTIONID'];
383 if (empty($TRANSACTIONID) &&
GETPOST(
'payment_intent',
'alphanohtml')) {
385 $TRANSACTIONID =
GETPOST(
'payment_intent',
'alphanohtml');
388if (empty($FinalPaymentAmt)) {
389 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'' : $_SESSION[
"FinalPaymentAmt"];
391if (empty($currencyCodeType)) {
392 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
395if (empty($paymentType)) {
396 $paymentType = empty($_SESSION[
"paymentType"]) ?
'' : $_SESSION[
"paymentType"];
403dol_syslog(
"ispaymentok=".$ispaymentok.
" tmptag=".var_export($tmptag,
true), LOG_DEBUG, 0,
'_payment');
407$appli = $mysoc->name;
412$postactionmessages = array();
415 if (empty($user->rights->societe)) {
416 $user->rights->societe =
new stdClass();
418 if (empty($user->rights->facture)) {
419 $user->rights->facture =
new stdClass();
420 $user->rights->facture->invoice_advance =
new stdClass();
422 if (empty($user->rights->adherent)) {
423 $user->rights->adherent =
new stdClass();
424 $user->rights->adherent->cotisation =
new stdClass();
426 $user->rights->societe->creer = 1;
427 $user->rights->facture->creer = 1;
428 $user->rights->facture->invoice_advance->validate = 1;
429 $user->rights->adherent->cotisation->creer = 1;
431 if (array_key_exists(
'MEM', $tmptag) && $tmptag[
'MEM'] > 0) {
438 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
439 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
440 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
444 $result1 =
$object->fetch((
int) $tmptag[
'MEM']);
445 $result2 = $adht->fetch(
$object->typeid);
447 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
448 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
450 dol_syslog(
"We have to process member with id=".$tmptag[
'MEM'].
" result1=".$result1.
" result2=".$result2, LOG_DEBUG, 0,
'_payment');
452 if ($result1 > 0 && $result2 > 0) {
454 if ($paymentmethod ==
'paybox') {
457 if ($paymentmethod ==
'paypal') {
460 if ($paymentmethod ==
'stripe') {
463 if (empty($paymentTypeId)) {
464 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
466 if (empty($paymentType)) {
471 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
474 if (empty($paymentTypeId) || $paymentTypeId < 0) {
479 dol_syslog(
"FinalPaymentAmt=".$FinalPaymentAmt.
" paymentTypeId=".$paymentTypeId.
" currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0,
'_payment');
482 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
484 if (empty($adht->caneditamount)) {
485 if (
$object->status == $object::STATUS_DRAFT) {
487 $amountbytype = $adht->amountByType(1);
491 $amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid];
501 $amountexpected = max(0, (
float) $amountexpected, (
float)
getDolGlobalInt(
"MEMBER_MIN_AMOUNT"));
503 if ($amountexpected && $amountexpected != $FinalPaymentAmt) {
505 $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 ?';
506 $postactionmessages[] = $errmsg;
507 $ispostactionok = -1;
508 dol_syslog(
"Failed to validate member (bad amount check): ".$errmsg, LOG_ERR, 0,
'_payment');
517 $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 ?';
518 $postactionmessages[] = $errmsg;
519 $ispostactionok = -1;
520 dol_syslog(
"Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0,
'_payment');
525 if ($currencyCodeType && $currencyCodeType != $conf->currency) {
527 $errmsg =
'Value of currencyCodeType ('.$currencyCodeType.
') differs from value expected for membership ('.$conf->currency.
'). May be a hack to try to pay a different amount ?';
528 $postactionmessages[] = $errmsg;
529 $ispostactionok = -1;
530 dol_syslog(
"Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0,
'_payment');
535 $result = (
$object->status == $object::STATUS_EXCLUDED) ? -1 :
$object->validate($user);
536 if ($result < 0 || empty(
$object->datevalid)) {
539 $postactionmessages[] = $errmsg;
540 $postactionmessages = array_merge($postactionmessages,
$object->errors);
541 $ispostactionok = -1;
542 dol_syslog(
"Failed to validate member: ".$errmsg, LOG_ERR, 0,
'_payment');
547 $datesubscription =
$object->datevalid;
564 if ($datesubscription && $defaultdelay && $defaultdelayunit) {
567 while ($datesubend < $now) {
569 $datesubscription =
dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit);
576 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang);
578 $amount = $FinalPaymentAmt;
579 $formatteddate =
dol_print_date($paymentdate,
'dayhour',
'auto', $outputlangs);
580 $label = $langs->trans(
"OnlineSubscriptionPaymentLine", $formatteddate, $paymentmethod, $ipaddress, $TRANSACTIONID);
584 if ($paymentmethod ==
'paybox') {
587 if ($paymentmethod ==
'paypal') {
590 if ($paymentmethod ==
'stripe') {
596 'paymentmethod' => $paymentmethod,
598 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
600 if (isset($hookmanager->resArray[
'bankaccountid'])) {
601 dol_syslog(
'accountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
602 $accountid = $hookmanager->resArray[
'bankaccountid'];
605 if ($accountid < 0) {
607 $errmsg =
'Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
608 $postactionmessages[] = $errmsg;
609 $ispostactionok = -1;
610 dol_syslog(
"Failed to get the bank account to record payment: ".$errmsg, LOG_ERR, 0,
'_payment');
613 $operation =
dol_getIdFromCode($db, $paymentTypeId,
'c_paiement',
'id',
'code', 1);
616 $emetteur_banque =
'';
619 if (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankviainvoice' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
620 $option =
'bankviainvoice';
621 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankdirect' && isModEnabled(
"bank")) {
622 $option =
'bankdirect';
623 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'invoiceonly' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
624 $option =
'invoiceonly';
626 if (empty($option)) {
636 dol_syslog(
"Call ->subscription to create subscription", LOG_DEBUG, 0,
'_payment');
638 $crowid =
$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $membertypeid);
642 $postactionmessages[] = $errmsg;
643 $ispostactionok = -1;
645 $postactionmessages[] =
'Subscription created (id='.$crowid.
')';
651 dol_syslog(
"Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0,
'_payment');
653 $autocreatethirdparty = 1;
655 $result =
$object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty, $TRANSACTIONID, $service);
660 $postactionmessages[] =
$object->error;
661 $postactionmessages = array_merge($postactionmessages,
$object->errors);
662 $ispostactionok = -1;
664 if ($option ==
'bankviainvoice') {
665 $postactionmessages[] =
'Invoice, payment and bank record created';
666 dol_syslog(
"Invoice, payment and bank record created", LOG_DEBUG, 0,
'_payment');
668 if ($option ==
'bankdirect') {
669 $postactionmessages[] =
'Bank record created';
670 dol_syslog(
"Bank record created", LOG_DEBUG, 0,
'_payment');
672 if ($option ==
'invoiceonly') {
673 $postactionmessages[] =
'Invoice recorded';
674 dol_syslog(
"Invoice recorded", LOG_DEBUG, 0,
'_payment');
684 if ($paymentmethod ==
'stripe' && $autocreatethirdparty && $option ==
'bankviainvoice') {
687 dol_syslog(
"Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0,
'_payment');
689 $service =
'StripeTest';
692 $service =
'StripeLive';
697 $thirdparty =
new Societe($db);
698 $thirdparty->fetch($thirdparty_id);
700 include_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
701 $stripe =
new Stripe($db);
704 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
706 if (!$customer && $TRANSACTIONID) {
707 dol_syslog(
"No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0,
'_payment');
710 global $stripearrayofkeysbyenv;
711 \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus][
'secret_key']);
713 if (preg_match(
'/^pi_/', $TRANSACTIONID)) {
715 $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);
718 $chpi = \Stripe\Charge::retrieve($TRANSACTIONID);
722 $stripecu = $chpi->customer;
724 if (empty($stripecu)) {
726 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
729 if (preg_match(
'/^pi_/', $TRANSACTIONID) && $customer) {
730 \Stripe\PaymentIntent::update($chpi->id, array(
'customer' => $customer->id));
733 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)";
734 $sql .=
" VALUES (".$thirdparty_id.
", '', '".$db->escape($stripecu).
"', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus][
'publishable_key']).
"', ".((int) $servicestatus).
", ".((int) $conf->entity).
", '".$db->idate(
dol_now()).
"', 0)";
735 $resql = $db->query($sql);
738 $errmsg =
'Failed to insert customer stripe id in database : '.$db->lasterror();
740 $postactionmessages[] = $errmsg;
741 $ispostactionok = -1;
746 $errmsg =
'Failed to retrieve paymentintent or charge from id';
748 $postactionmessages[] = $errmsg;
749 $ispostactionok = -1;
753 $errmsg =
'Failed to get or save customer stripe id in database : '.$e->getMessage();
755 $postactionmessages[] = $errmsg;
756 $ispostactionok = -1;
773 $nuser =
new User($db);
778 $sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE fk_member = ".((int)
$object->id);
779 $resqlcount = $db->query($sql);
781 $objcount = $db->fetch_object($resqlcount);
783 $found = $objcount->nb;
788 $result = $nuser->create_from_member($tmpuser,
$object->login);
789 $newpassword = $nuser->setPassword($user,
'');
792 $outputlangs->load(
"errors");
793 $postactionmessages[] =
'Error in create external user : '.$nuser->error;
795 $infouserlogin = $outputlangs->trans(
"Login").
': '.$nuser->login.
' '.
"\n".$outputlangs->trans(
"Password").
': '.$newpassword;
796 $postactionmessages[] = $langs->trans(
"NewUserCreated", $nuser->login);
799 $outputlangs->load(
"errors");
800 $postactionmessages[] =
'No user created because a user linked to member already exists';
806 dol_syslog(
"Send email to customer to ".
$object->email.
" if we have to (sendalsoemail = ".$sendalsoemail.
")", LOG_DEBUG, 0,
'_payment');
809 if (
$object->email && $sendalsoemail) {
814 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
817 $outputlangs->loadLangs(array(
"main",
"members"));
819 $arraydefaultmessage =
null;
822 if (!empty($labeltouse)) {
823 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
826 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
827 $subject = $arraydefaultmessage->topic;
828 $msg = $arraydefaultmessage->content;
833 if ($infouserlogin) {
834 $substitutionarray[
'__MEMBER_USER_LOGIN_INFORMATION__'] = $infouserlogin;
843 $listofpaths = array();
844 $listofnames = array();
845 $listofmimes = array();
846 if (is_object(
$object->invoice)) {
847 $invoicediroutput = $conf->facture->dir_output;
849 $file = $fileparams[
'fullname'];
851 $listofpaths = array($file);
852 $listofnames = array(basename($file));
856 $moreinheader =
'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'.
"\r\n";
858 $result =
$object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
"", $moreinheader);
862 $postactionmessages[] = $errmsg;
863 $ispostactionok = -1;
866 $postactionmessages[] =
'Email sent to member (with invoice document attached)';
868 $postactionmessages[] =
'Email sent to member (without any attached document)';
876 $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.';
877 $ispostactionok = -1;
880 $postactionmessages[] =
'Member '.$tmptag[
'MEM'].
' for subscription paid was not found';
881 $ispostactionok = -1;
883 } elseif (array_key_exists(
'INV', $tmptag) && $tmptag[
'INV'] > 0) {
885 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
887 $result =
$object->fetch((
int) $tmptag[
'INV']);
889 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
892 if ($paymentmethod ===
'paybox') {
895 if ($paymentmethod ===
'paypal') {
898 if ($paymentmethod ===
'stripe') {
901 if (empty($paymentTypeId)) {
902 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
904 if (empty($paymentType)) {
909 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
912 if (empty($paymentTypeId) || $paymentTypeId < 0) {
917 dol_syslog(
"FinalPaymentAmt = ".$FinalPaymentAmt.
" paymentTypeId = ".$paymentTypeId, LOG_DEBUG, 0,
'_payment');
920 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
924 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
926 $paiement->datepaye = $now;
927 if ($currencyCodeType == $conf->currency) {
928 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
930 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
932 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
933 $ispostactionok = -1;
936 $paiement->paiementid = $paymentTypeId;
937 $paiement->num_payment =
'';
938 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
939 $paiement->ext_payment_id = $TRANSACTIONID;
941 $paiement->ext_payment_site = $service;
944 $paiement_id = $paiement->create($user, 1);
945 if ($paiement_id < 0) {
946 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
947 $ispostactionok = -1;
950 $postactionmessages[] =
'Payment created';
955 if (!$error && isModEnabled(
"bank")) {
957 if ($paymentmethod ==
'paybox') {
959 } elseif ($paymentmethod ==
'paypal') {
961 } elseif ($paymentmethod ==
'stripe') {
967 'paymentmethod' => $paymentmethod,
969 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
971 if (isset($hookmanager->resArray[
'bankaccountid'])) {
972 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
973 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
976 if ($bankaccountid > 0) {
977 $label =
'(CustomerInvoicePayment)';
979 $label =
'(CustomerInvoicePaymentBack)';
981 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
983 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
984 $ispostactionok = -1;
987 $postactionmessages[] =
'Bank transaction of payment created';
991 $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.';
992 $ispostactionok = -1;
1003 $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.';
1004 $ispostactionok = -1;
1007 $postactionmessages[] =
'Invoice paid '.$tmptag[
'INV'].
' was not found';
1008 $ispostactionok = -1;
1010 } elseif (array_key_exists(
'ORD', $tmptag) && $tmptag[
'ORD'] > 0) {
1011 include_once DOL_DOCUMENT_ROOT .
'/commande/class/commande.class.php';
1013 $result =
$object->fetch((
int) $tmptag[
'ORD']);
1015 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1018 if ($paymentmethod ==
'paybox') {
1021 if ($paymentmethod ==
'paypal') {
1024 if ($paymentmethod ==
'stripe') {
1027 if (empty($paymentTypeId)) {
1028 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1030 if (empty($paymentType)) {
1031 $paymentType =
'CB';
1035 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1038 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1044 if (isModEnabled(
'invoice')) {
1045 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1046 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1048 $result = $invoice->createFromOrder($object, $user);
1050 $object->classifyBilled($user);
1051 $invoice->validate($user);
1053 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1055 $paiement->datepaye = $now;
1056 if ($currencyCodeType == $conf->currency) {
1057 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1059 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1061 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1062 $ispostactionok = -1;
1065 $paiement->paiementid = $paymentTypeId;
1066 $paiement->num_payment =
'';
1067 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1068 $paiement->ext_payment_id = $TRANSACTIONID;
1069 $paiement->ext_payment_site = $service;
1072 $paiement_id = $paiement->create($user, 1);
1073 if ($paiement_id < 0) {
1074 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1075 $ispostactionok = -1;
1078 $postactionmessages[] =
'Payment created';
1079 $ispostactionok = 1;
1083 if (!$error && isModEnabled(
"bank")) {
1085 if ($paymentmethod ==
'paybox') {
1087 } elseif ($paymentmethod ==
'paypal') {
1089 } elseif ($paymentmethod ==
'stripe') {
1095 'paymentmethod' => $paymentmethod,
1097 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1098 if ($reshook >= 0) {
1099 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1100 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1101 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1104 if ($bankaccountid > 0) {
1105 $label =
'(CustomerInvoicePayment)';
1107 $label =
'(CustomerInvoicePaymentBack)';
1109 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1111 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1112 $ispostactionok = -1;
1115 $postactionmessages[] =
'Bank transaction of payment created';
1116 $ispostactionok = 1;
1119 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1120 $ispostactionok = -1;
1131 $postactionmessages[] =
'Failed to create invoice form order ' . $tmptag[
'ORD'] .
'.';
1132 $ispostactionok = -1;
1135 $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.';
1136 $ispostactionok = -1;
1139 $postactionmessages[] =
'Invoice module is not enable';
1140 $ispostactionok = -1;
1143 $postactionmessages[] =
'Order paid ' . $tmptag[
'ORD'] .
' was not found';
1144 $ispostactionok = -1;
1146 } elseif (array_key_exists(
'DON', $tmptag) && $tmptag[
'DON'] > 0) {
1147 include_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
1148 $don =
new Don($db);
1149 $result = $don->fetch((
int) $tmptag[
'DON']);
1152 if ($paymentmethod ==
'paybox') {
1155 if ($paymentmethod ==
'paypal') {
1156 $paymentTypeId =
getDolGlobalInt(
'global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS');
1158 if ($paymentmethod ==
'stripe') {
1161 if (empty($paymentTypeId)) {
1162 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1164 if (empty($paymentType)) {
1165 $paymentType =
'CB';
1169 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1172 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1178 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1182 include_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
1185 $totalpaid = $FinalPaymentAmt;
1187 if ($currencyCodeType == $conf->currency) {
1188 $paiement->amounts = array(
$object->id => $totalpaid);
1191 $postactionmessages[] =
'Payment donation can\'t be paid with different currency than '.$conf->currency;
1192 $ispostactionok = -1;
1196 $paiement->fk_donation = $don->id;
1197 $paiement->datep = $now;
1198 $paiement->paymenttype = $paymentTypeId;
1199 $paiement->num_payment =
'';
1200 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1201 $paiement->ext_payment_id = $TRANSACTIONID;
1202 $paiement->ext_payment_site = $service;
1205 $paiement_id = $paiement->create($user, 1);
1206 if ($paiement_id < 0) {
1207 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1208 $ispostactionok = -1;
1211 $postactionmessages[] =
'Payment created';
1212 $ispostactionok = 1;
1214 if ($totalpaid >= $don->getRemainToPay()) {
1215 $don->setPaid($don->id);
1220 if (!$error && isModEnabled(
"bank")) {
1222 if ($paymentmethod ==
'paybox') {
1224 } elseif ($paymentmethod ==
'paypal') {
1226 } elseif ($paymentmethod ==
'stripe') {
1232 'paymentmethod' => $paymentmethod,
1234 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1235 if ($reshook >= 0) {
1236 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1237 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1238 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1241 if ($bankaccountid > 0) {
1242 $label =
'(DonationPayment)';
1243 $result = $paiement->addPaymentToBank($user,
'payment_donation', $label, $bankaccountid,
'',
'');
1245 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1246 $ispostactionok = -1;
1249 $postactionmessages[] =
'Bank transaction of payment created';
1250 $ispostactionok = 1;
1253 $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.';
1254 $ispostactionok = -1;
1265 $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.';
1266 $ispostactionok = -1;
1269 $postactionmessages[] =
'Donation paid '.$tmptag[
'DON'].
' was not found';
1270 $ispostactionok = -1;
1275 } elseif (array_key_exists(
'ATT', $tmptag) && $tmptag[
'ATT'] > 0) {
1277 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1278 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1279 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1281 $result =
$object->fetch($ref);
1284 if ($paymentmethod ==
'paybox') {
1287 if ($paymentmethod ==
'paypal') {
1290 if ($paymentmethod ==
'stripe') {
1293 if (empty($paymentTypeId)) {
1294 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1296 if (empty($paymentType)) {
1297 $paymentType =
'CB';
1301 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1304 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1310 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1311 $resultvalidate =
$object->validate($user);
1312 if ($resultvalidate < 0) {
1313 $postactionmessages[] =
'Cannot validate invoice';
1314 $ispostactionok = -1;
1320 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1322 $paiement->datepaye = $now;
1323 if ($currencyCodeType == $conf->currency) {
1324 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1326 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1328 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1329 $ispostactionok = -1;
1332 $paiement->paiementid = $paymentTypeId;
1333 $paiement->num_payment =
'';
1334 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress.
' for event registration';
1335 $paiement->ext_payment_id = $TRANSACTIONID;
1336 $paiement->ext_payment_site = $service;
1339 $paiement_id = $paiement->create($user, 1);
1340 if ($paiement_id < 0) {
1341 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1342 $ispostactionok = -1;
1345 $postactionmessages[] =
'Payment created';
1346 $ispostactionok = 1;
1350 if (!$error && isModEnabled(
"bank")) {
1352 if ($paymentmethod ==
'paybox') {
1354 } elseif ($paymentmethod ==
'paypal') {
1356 } elseif ($paymentmethod ==
'stripe') {
1362 'paymentmethod' => $paymentmethod,
1364 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1365 if ($reshook >= 0) {
1366 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1367 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1368 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1371 if ($bankaccountid > 0) {
1372 $label =
'(CustomerInvoicePayment)';
1374 $label =
'(CustomerInvoicePaymentBack)';
1376 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1378 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1379 $ispostactionok = -1;
1382 $postactionmessages[] =
'Bank transaction of payment created';
1383 $ispostactionok = 1;
1386 $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.';
1387 $ispostactionok = -1;
1396 $resultattendee = $attendeetovalidate->fetch((
int) $tmptag[
'ATT']);
1397 if ($resultattendee < 0) {
1401 $attendeetovalidate->validate($user);
1403 $attendeetovalidate->amount = $FinalPaymentAmt;
1404 $attendeetovalidate->date_subscription =
dol_now();
1405 $attendeetovalidate->update($user);
1419 $thirdparty =
new Societe($db);
1420 $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
1421 if ($resultthirdparty < 0) {
1422 setEventMessages($resultthirdparty->error, $resultthirdparty->errors,
"errors");
1424 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1425 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1428 $outputlangs =
new Translate(
'', $conf);
1429 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1431 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1433 $arraydefaultmessage =
null;
1435 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');
1437 if (!empty($idoftemplatetouse)) {
1438 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1441 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1442 $subject = $arraydefaultmessage->topic;
1443 $msg = $arraydefaultmessage->content;
1445 $subject =
'['.$appli.
'] '.
$object->ref.
' - '.$outputlangs->trans(
"NewRegistration");
1446 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfRegistrationWasReceived");
1455 $sendto = $attendeetovalidate->email;
1457 if ($thirdparty->email) {
1458 $cc = $thirdparty->email;
1460 if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
1461 $cc = ($cc ?
', ' :
'').$attendeetovalidate->email_company;
1466 $urlback = $_SERVER[
"REQUEST_URI"];
1472 $listofpaths = array();
1473 $listofnames = array();
1474 $listofmimes = array();
1475 if (is_object($object)) {
1476 $invoicediroutput = $conf->facture->dir_output;
1478 $file = $fileparams[
'fullname'];
1480 $listofpaths = array($file);
1481 $listofnames = array(basename($file));
1485 $trackid =
'inv'.$object->id;
1487 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc,
'', 0, ($ishtml ? 1 : 0),
'',
'', $trackid,
'',
'standard');
1489 $result = $mailfile->sendfile();
1491 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1493 dol_syslog(
"Failed to send EMail to ".$sendto.
' - '.$mailfile->error, LOG_ERR, 0,
'_payment');
1499 $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.';
1500 $ispostactionok = -1;
1503 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1504 $ispostactionok = -1;
1506 } elseif (array_key_exists(
'BOO', $tmptag) && $tmptag[
'BOO'] > 0) {
1508 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1509 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1510 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1512 $result =
$object->fetch($ref);
1514 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1517 if ($paymentmethod ==
'paybox') {
1520 if ($paymentmethod ==
'paypal') {
1523 if ($paymentmethod ==
'stripe') {
1526 if (empty($paymentTypeId)) {
1527 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1529 if (empty($paymentType)) {
1530 $paymentType =
'CB';
1534 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1537 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1543 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1544 $resultvalidate =
$object->validate($user);
1545 if ($resultvalidate < 0) {
1546 $postactionmessages[] =
'Cannot validate invoice';
1547 $ispostactionok = -1;
1553 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1555 $paiement->datepaye = $now;
1556 if ($currencyCodeType == $conf->currency) {
1557 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1559 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1561 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1562 $ispostactionok = -1;
1565 $paiement->paiementid = $paymentTypeId;
1566 $paiement->num_payment =
'';
1567 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1568 $paiement->ext_payment_id = $TRANSACTIONID;
1569 $paiement->ext_payment_site = $service;
1572 $paiement_id = $paiement->create($user, 1);
1573 if ($paiement_id < 0) {
1574 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1575 $ispostactionok = -1;
1578 $postactionmessages[] =
'Payment created';
1579 $ispostactionok = 1;
1583 if (!$error && isModEnabled(
"bank")) {
1585 if ($paymentmethod ==
'paybox') {
1587 } elseif ($paymentmethod ==
'paypal') {
1589 } elseif ($paymentmethod ==
'stripe') {
1595 'paymentmethod' => $paymentmethod,
1597 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1598 if ($reshook >= 0) {
1599 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1600 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1601 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1604 if ($bankaccountid > 0) {
1605 $label =
'(CustomerInvoicePayment)';
1607 $label =
'(CustomerInvoicePaymentBack)';
1609 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1611 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1612 $ispostactionok = -1;
1615 $postactionmessages[] =
'Bank transaction of payment created';
1616 $ispostactionok = 1;
1619 $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.';
1620 $ispostactionok = -1;
1627 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1628 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1630 $resultbooth = $booth->fetch((
int) $tmptag[
'BOO']);
1631 if ($resultbooth < 0) {
1635 $booth->status = ConferenceOrBooth::STATUS_SUGGESTED;
1636 $resultboothupdate = $booth->update($user);
1637 if ($resultboothupdate<0) {
1640 $resultinvoice = $invoice->fetch($ref);
1641 if ($resultinvoice<0) {
1642 $postactionmessages[] =
'Could not find the associated invoice.';
1643 $ispostactionok = -1;
1646 $thirdparty =
new Societe($db);
1647 $resultthirdparty = $thirdparty->fetch($invoice->socid);
1648 if ($resultthirdparty<0) {
1653 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1654 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1657 $outputlangs =
new Translate(
'', $conf);
1658 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1660 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1662 $arraydefaultmessage =
null;
1664 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');
1666 if (!empty($idoftemplatetouse)) {
1667 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1670 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1671 $subject = $arraydefaultmessage->topic;
1672 $msg = $arraydefaultmessage->content;
1674 $subject =
'['.$appli.
'] '.$booth->ref.
' - '.$outputlangs->trans(
"NewRegistration").
']';
1675 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfBoothWasReceived");
1684 $sendto = $thirdparty->email;
1686 $urlback = $_SERVER[
"REQUEST_URI"];
1689 $trackid =
'inv'.$invoice->id;
1691 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
1693 $result = $mailfile->sendfile();
1695 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1697 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
1712 $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.';
1713 $ispostactionok = -1;
1716 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1717 $ispostactionok = -1;
1719 } elseif (array_key_exists(
'CON', $tmptag) && $tmptag[
'CON'] > 0) {
1720 include_once DOL_DOCUMENT_ROOT .
'/contrat/class/contrat.class.php';
1722 $result =
$object->fetch((
int) $tmptag[
'CON']);
1724 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1727 if ($paymentmethod ==
'paybox') {
1730 if ($paymentmethod ==
'paypal') {
1733 if ($paymentmethod ==
'stripe') {
1736 if (empty($paymentTypeId)) {
1737 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1739 if (empty($paymentType)) {
1740 $paymentType =
'CB';
1744 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1747 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1752 $currencyCodeType = $_SESSION[
'currencyCodeType'];
1753 $contract_lines = (array_key_exists(
'COL', $tmptag) && $tmptag[
'COL'] > 0) ? $tmptag[
'COL'] : null;
1756 if (isModEnabled(
'invoice')) {
1757 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1758 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1760 $result = $invoice->createFromContract($object, $user, array((
int) $contract_lines));
1763 $invoice->validate($user);
1765 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1767 $paiement->datepaye = $now;
1768 if ($currencyCodeType == $conf->currency) {
1769 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1771 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1773 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1774 $ispostactionok = -1;
1777 $paiement->paiementid = $paymentTypeId;
1778 $paiement->num_payment =
'';
1779 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1780 $paiement->ext_payment_id = $TRANSACTIONID;
1781 $paiement->ext_payment_site = $service;
1784 $paiement_id = $paiement->create($user, 1);
1785 if ($paiement_id < 0) {
1786 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1787 $ispostactionok = -1;
1790 $postactionmessages[] =
'Payment created';
1791 $ispostactionok = 1;
1795 if (!$error && isModEnabled(
"bank")) {
1797 if ($paymentmethod ==
'paybox') {
1799 } elseif ($paymentmethod ==
'paypal') {
1801 } elseif ($paymentmethod ==
'stripe') {
1807 'paymentmethod' => $paymentmethod,
1809 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1810 if ($reshook >= 0) {
1811 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1812 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1813 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1816 if ($bankaccountid > 0) {
1817 $label =
'(CustomerInvoicePayment)';
1819 $label =
'(CustomerInvoicePaymentBack)';
1821 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1823 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1824 $ispostactionok = -1;
1827 $postactionmessages[] =
'Bank transaction of payment created';
1828 $ispostactionok = 1;
1831 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1832 $ispostactionok = -1;
1843 $msg =
'Failed to create invoice form contract ' . $tmptag[
'CON'];
1844 if (!empty($cols)) {
1845 $msg .=
' and col '. $cols .
'.';
1847 $postactionmessages[] = $msg;
1848 $ispostactionok = -1;
1851 $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.';
1852 $ispostactionok = -1;
1855 $postactionmessages[] =
'Invoice module is not enable';
1856 $ispostactionok = -1;
1859 $msg =
'Contract paid ' . $tmptag[
'CON'] .
' was not found';
1860 if (!empty($cols)) {
1861 $msg .=
' for col '.$tmptag[
'COL'] .
'.';
1863 $postactionmessages[] = $msg;
1864 $ispostactionok = -1;
1873 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
1874 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
1876 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
1877 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'': $_SESSION[
"FinalPaymentAmt"];
1878 $paymentType = empty($_SESSION[
'PaymentType']) ?
'' : $_SESSION[
'PaymentType'];
1880 if (is_object($object) && method_exists($object,
'call_trigger')) {
1882 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1887 } elseif (get_class($object) ==
'stdClass') {
1889 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1891 $result = $paiement->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1900if (empty($doactionsthenredirect)) {
1902 print $langs->trans(
"YourPaymentHasBeenRecorded").
"<br>\n";
1903 if ($TRANSACTIONID) {
1904 print $langs->trans(
"ThisIsTransactionId", $TRANSACTIONID).
"<br><br>\n";
1908 $key =
'ONLINE_PAYMENT_MESSAGE_OK';
1914 print $langs->trans(
'DoExpressCheckoutPaymentAPICallFailed').
"<br>\n";
1915 print $langs->trans(
'DetailedErrorMessage').
": ".$ErrorLongMsg.
"<br>\n";
1916 print $langs->trans(
'ShortErrorMessage').
": ".$ErrorShortMsg.
"<br>\n";
1917 print $langs->trans(
'ErrorCode').
": ".$ErrorCode.
"<br>\n";
1918 print $langs->trans(
'ErrorSeverityCode').
": ".$ErrorSeverityCode.
"<br>\n";
1920 if ($mysoc->email) {
1921 print
"\nPlease, send a screenshot of this page to ".$mysoc->email.
"<br>\n";
1933 dol_syslog(
"Send email to admins if we have to (sendemail = ".$sendemail.
")", LOG_DEBUG, 0,
'_payment');
1937 $companylangs =
new Translate(
'', $conf);
1938 $companylangs->setDefaultLang($mysoc->default_lang);
1939 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
1941 $sendto = $sendemail;
1944 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1945 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1950 $urlback = $_SERVER[
"REQUEST_URI"];
1951 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived");
1953 if (array_key_exists(
'MEM', $tmptag)) {
1954 $url = $urlwithroot.
"/adherents/subscription.php?rowid=".((int) $tmptag[
'MEM']);
1955 $content .=
'<strong>'.$companylangs->trans(
"PaymentSubscription").
"</strong><br><br>\n";
1956 $content .= $companylangs->trans(
"MemberId").
': <strong>'.$tmptag[
'MEM'].
"</strong><br>\n";
1957 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1958 } elseif (array_key_exists(
'INV', $tmptag)) {
1959 $url = $urlwithroot.
"/compta/facture/card.php?id=".((int) $tmptag[
'INV']);
1960 $content .=
'<strong>'.$companylangs->trans(
"Payment").
"</strong><br><br>\n";
1961 $content .= $companylangs->trans(
"InvoiceId").
': <strong>'.$tmptag[
'INV'].
"</strong><br>\n";
1963 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1965 $content .= $companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived").
"<br>\n";
1967 $content .= $companylangs->transnoentities(
"PostActionAfterPayment").
' : ';
1968 if ($ispostactionok > 0) {
1970 $content .=
'<span style="color: green">'.$companylangs->transnoentitiesnoconv(
"OK").
'</span>';
1971 } elseif ($ispostactionok == 0) {
1972 $content .= $companylangs->transnoentitiesnoconv(
"None");
1974 $topic .= ($ispostactionok ?
'' :
' ('.$companylangs->trans(
"WarningPostActionErrorAfterPayment").
')');
1975 $content .=
'<span class="star">'.$companylangs->transnoentitiesnoconv(
"Error").
'</span>';
1977 $content .=
'<br>'.
"\n";
1978 foreach ($postactionmessages as $postactionmessage) {
1979 $content .=
' * '.$postactionmessage.
'<br>'.
"\n";
1981 if ($ispostactionok < 0) {
1982 $content .= $langs->transnoentities(
"ARollbackWasPerformedOnPostActions");
1984 $content .=
'<br>'.
"\n";
1986 $content .=
"<br>\n";
1987 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
1988 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
1989 $content .= $companylangs->transnoentitiesnoconv(
"ThisIsTransactionId").
': <strong>'.$TRANSACTIONID.
"</strong><br>\n";
1990 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
1991 $content .=
"<br>\n";
1992 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
1994 if (!empty($ErrorCode)) {
1995 $content .=
"ErrorCode = ".$ErrorCode.
"<br>\n";
1997 if (!empty($ErrorShortMsg)) {
1998 $content .=
"ErrorShortMsg = ".$ErrorShortMsg.
"<br>\n";
2000 if (!empty($ErrorLongMsg)) {
2001 $content .=
"ErrorLongMsg = ".$ErrorLongMsg.
"<br>\n";
2003 if (!empty($ErrorSeverityCode)) {
2004 $content .=
"ErrorSeverityCode = ".$ErrorSeverityCode.
"<br>\n";
2011 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2012 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
2014 $result = $mailfile->sendfile();
2016 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2019 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2027 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
2028 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
2030 $paymentType = $_SESSION[
'PaymentType'];
2031 $currencyCodeType = $_SESSION[
'currencyCodeType'];
2032 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
2034 if (is_object($object) && method_exists($object,
'call_trigger')) {
2036 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_KO', $user);
2045 $companylangs =
new Translate(
'', $conf);
2046 $companylangs->setDefaultLang($mysoc->default_lang);
2047 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
2049 $sendto = $sendemail;
2052 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
2053 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
2056 $urlback = $_SERVER[
"REQUEST_URI"];
2057 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"ValidationOfPaymentFailed");
2059 $content .=
'<span style="color: orange">'.$companylangs->transnoentitiesnoconv(
"PaymentSystemConfirmPaymentPageWasCalledButFailed").
"</span>\n";
2061 $content .=
"<br><br>\n";
2062 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
2063 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
2064 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
2065 $content .=
"<br>\n";
2066 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
2072 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2073 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid,
'',
'standard');
2075 $result = $mailfile->sendfile();
2077 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2079 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2086unset($_SESSION[
"FinalPaymentAmt"]);
2087unset($_SESSION[
"TRANSACTIONID"]);
2091if (empty($doactionsthenredirect)) {
2094 print
"<!-- Info for payment: FinalPaymentAmt=".dol_escape_htmltag($FinalPaymentAmt).
" paymentTypeId=".
dol_escape_htmltag($paymentTypeId).
" currencyCodeType=".
dol_escape_htmltag($currencyCodeType).
" -->\n";
2099if (empty($doactionsthenredirect)) {
2110if (!empty($doactionsthenredirect)) {
2114 $ext_urlok = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentok&fulltag='.$FULLTAG;
2115 print
"<script>window.top.location.href = '".dol_escape_js($ext_urlok) .
"';</script>";
2119 $ext_urlko = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentko&fulltag='.$FULLTAG;
2120 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.
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_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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_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...
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.