32if (!defined(
'NOLOGIN')) {
35if (!defined(
'NOCSRFCHECK')) {
36 define(
"NOCSRFCHECK", 1);
38if (!defined(
'NOIPCHECK')) {
39 define(
'NOIPCHECK',
'1');
41if (!defined(
'NOBROWSERNOTIF')) {
42 define(
'NOBROWSERNOTIF',
'1');
48$entity = (!empty($_GET[
'e']) ? (int) $_GET[
'e'] : (!empty($_POST[
'e']) ? (int) $_POST[
'e'] : 1));
49if (is_numeric($entity)) {
50 define(
"DOLENTITY", $entity);
54require
'../../main.inc.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
57if (isModEnabled(
'paypal')) {
58 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypal.lib.php';
59 require_once DOL_DOCUMENT_ROOT.
'/paypal/lib/paypalfunctions.lib.php';
65$hookmanager->initHooks(array(
'newpayment'));
67$langs->loadLangs(array(
"main",
"other",
"dict",
"bills",
"companies",
"paybox",
"paypal",
"stripe"));
70if (isModEnabled(
'paypal')) {
71 $PAYPAL_API_USER =
"";
75 $PAYPAL_API_PASSWORD =
"";
79 $PAYPAL_API_SIGNATURE =
"";
83 $PAYPAL_API_SANDBOX =
"";
96 $PAYPALTOKEN =
GETPOST(
'TOKEN');
97 if (empty($PAYPALTOKEN)) {
98 $PAYPALTOKEN =
GETPOST(
'token');
100 $PAYPALPAYERID =
GETPOST(
'PAYERID');
101 if (empty($PAYPALPAYERID)) {
102 $PAYPALPAYERID =
GETPOST(
'PayerID');
107if (empty($FULLTAG)) {
113$suffix =
GETPOST(
"suffix",
'aZ09');
120if (preg_match(
'/PM=([^\.]+)/', $FULLTAG, $reg)) {
121 $paymentmethod = $reg[1];
123if (empty($paymentmethod)) {
124 dol_syslog(
"***** paymentok.php was called with a non valid parameter FULLTAG=".$FULLTAG, LOG_DEBUG, 0,
'_payment');
125 dol_print_error(
null,
'The callback url does not contain a parameter fulltag that should help us to find the payment method used');
129dol_syslog(
"***** paymentok.php is called paymentmethod=".$paymentmethod.
" FULLTAG=".$FULLTAG.
" REQUEST_URI=".$_SERVER[
"REQUEST_URI"], LOG_DEBUG, 0,
'_payment');
132$ws = preg_match(
'/WS=([^\.]+)/', $FULLTAG, $reg_ws) ? $reg_ws[1] : 0;
134 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');
137$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod);
140if (empty($validpaymentmethod)) {
145$creditor = $mysoc->name;
146$paramcreditor =
'ONLINE_PAYMENT_CREDITOR';
147$paramcreditorlong =
'ONLINE_PAYMENT_CREDITOR_'.$suffix;
157$PAYMENTSTATUS = $TRANSACTIONID = $TAXAMT = $NOTE =
'';
159$ErrorCode = $ErrorShortMsg = $ErrorLongMsg = $ErrorSeverityCode =
'';
173 $doactionsthenredirect = 1;
179dol_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');
180dol_syslog(
"_SERVER[SERVER_NAME] = ".(empty($_SERVER[
"SERVER_NAME"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_NAME"])), LOG_DEBUG, 0,
'_payment');
181dol_syslog(
"_SERVER[SERVER_ADDR] = ".(empty($_SERVER[
"SERVER_ADDR"]) ?
'' :
dol_escape_htmltag($_SERVER[
"SERVER_ADDR"])), LOG_DEBUG, 0,
'_payment');
184foreach ($_POST as $k => $v) {
185 if (is_scalar($k) && is_scalar($v)) {
186 $tracepost .=
"$k - $v\n";
189dol_syslog(
"POST=".$tracepost, LOG_DEBUG, 0,
'_payment');
191foreach ($_SESSION as $k => $v) {
192 if (is_scalar($k) && is_scalar($v)) {
193 $tracesession .=
"$k - $v\n";
196dol_syslog(
"SESSION=".$tracesession, LOG_DEBUG, 0,
'_payment');
200 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'ONLINE_PAYMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
203$conf->dol_hide_topmenu = 1;
204$conf->dol_hide_leftmenu = 1;
208if (empty($doactionsthenredirect)) {
209 $replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
210 llxHeader($head, $langs->trans(
"PaymentForm"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea);
214 print
'<span id="dolpaymentspan"></span>'.
"\n";
215 print
'<div id="dolpaymentdiv" class="center">'.
"\n";
220 $logosmall = $mysoc->logo_small;
221 $logo = $mysoc->logo;
222 $paramlogo =
'ONLINE_PAYMENT_LOGO_'.$suffix;
223 if (!empty($conf->global->$paramlogo)) {
232 if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
233 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
234 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
235 } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
236 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
237 $urllogofull = $dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
242 print
'<div class="backgreypublicpayment">';
243 print
'<div class="logopublicpayment">';
244 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
248 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>';
251 } elseif ($creditor) {
252 print
'<div class="backgreypublicpayment">';
253 print
'<div class="logopublicpayment">';
259 print
'<div class="backimagepublicpayment">';
260 print
'<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' .
getDolGlobalString(
'MAIN_IMAGE_PUBLIC_PAYMENT').
'">';
265 print
'<br><br><br>';
270if (isModEnabled(
'paypal')) {
271 if ($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,
'_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');
350if (isModEnabled(
'paybox')) {
351 if ($paymentmethod ===
'paybox') {
357if (isModEnabled(
'stripe')) {
358 if ($paymentmethod ===
'stripe') {
367 'paymentmethod' => $paymentmethod,
369$reshook = $hookmanager->executeHooks(
'isPaymentOK', $parameters, $object, $action);
371 if (isset($hookmanager->resArray[
'ispaymentok'])) {
372 dol_syslog(
'ispaymentok overwrite by hook return with value='.$hookmanager->resArray[
'ispaymentok'], LOG_DEBUG, 0,
'_payment');
373 $ispaymentok = $hookmanager->resArray[
'ispaymentok'];
379if (empty($ipaddress)) {
380 $ipaddress = $_SESSION[
'ipaddress'];
382if (empty($TRANSACTIONID)) {
383 $TRANSACTIONID = empty($_SESSION[
'TRANSACTIONID']) ?
'' :$_SESSION[
'TRANSACTIONID'];
384 if (empty($TRANSACTIONID) &&
GETPOST(
'payment_intent',
'alphanohtml')) {
386 $TRANSACTIONID =
GETPOST(
'payment_intent',
'alphanohtml');
389if (empty($FinalPaymentAmt)) {
390 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'' : $_SESSION[
"FinalPaymentAmt"];
392if (empty($currencyCodeType)) {
393 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
396if (empty($paymentType)) {
397 $paymentType = empty($_SESSION[
"paymentType"]) ?
'' : $_SESSION[
"paymentType"];
404dol_syslog(
"ispaymentok=".$ispaymentok.
" tmptag=".var_export($tmptag,
true), LOG_DEBUG, 0,
'_payment');
408$appli = $mysoc->name;
413$postactionmessages = array();
416 if (empty($user->rights->societe)) {
417 $user->rights->societe =
new stdClass();
419 if (empty($user->rights->facture)) {
420 $user->rights->facture =
new stdClass();
421 $user->rights->facture->invoice_advance =
new stdClass();
423 if (empty($user->rights->adherent)) {
424 $user->rights->adherent =
new stdClass();
425 $user->rights->adherent->cotisation =
new stdClass();
427 $user->rights->societe->creer = 1;
428 $user->rights->facture->creer = 1;
429 $user->rights->facture->invoice_advance->validate = 1;
430 $user->rights->adherent->cotisation->creer = 1;
432 if (array_key_exists(
'MEM', $tmptag) && $tmptag[
'MEM'] > 0) {
439 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
440 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
441 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
445 $result1 =
$object->fetch((
int) $tmptag[
'MEM']);
446 $result2 = $adht->fetch(
$object->typeid);
448 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
449 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
451 dol_syslog(
"We have to process member with id=".$tmptag[
'MEM'].
" result1=".$result1.
" result2=".$result2, LOG_DEBUG, 0,
'_payment');
453 if ($result1 > 0 && $result2 > 0) {
455 if ($paymentmethod ==
'paybox') {
458 if ($paymentmethod ==
'paypal') {
461 if ($paymentmethod ==
'stripe') {
464 if (empty($paymentTypeId)) {
465 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
467 if (empty($paymentType)) {
472 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
475 if (empty($paymentTypeId) || $paymentTypeId < 0) {
480 dol_syslog(
"FinalPaymentAmt=".$FinalPaymentAmt.
" paymentTypeId=".$paymentTypeId.
" currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0,
'_payment');
483 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
485 if (empty($adht->caneditamount)) {
486 if (
$object->status == $object::STATUS_DRAFT) {
488 $amountbytype = $adht->amountByType(1);
492 $amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid];
502 $amountexpected = max(0, (
float) $amountexpected, (
float)
getDolGlobalInt(
"MEMBER_MIN_AMOUNT"));
504 if ($amountexpected && $amountexpected != $FinalPaymentAmt) {
506 $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 ?';
507 $postactionmessages[] = $errmsg;
508 $ispostactionok = -1;
509 dol_syslog(
"Failed to validate member (bad amount check): ".$errmsg, LOG_ERR, 0,
'_payment');
518 $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 ?';
519 $postactionmessages[] = $errmsg;
520 $ispostactionok = -1;
521 dol_syslog(
"Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0,
'_payment');
526 if ($currencyCodeType && $currencyCodeType != $conf->currency) {
528 $errmsg =
'Value of currencyCodeType ('.$currencyCodeType.
') differs from value expected for membership ('.$conf->currency.
'). May be a hack to try to pay a different amount ?';
529 $postactionmessages[] = $errmsg;
530 $ispostactionok = -1;
531 dol_syslog(
"Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0,
'_payment');
536 $result = (
$object->status == $object::STATUS_EXCLUDED) ? -1 :
$object->validate($user);
537 if ($result < 0 || empty(
$object->datevalid)) {
540 $postactionmessages[] = $errmsg;
541 $postactionmessages = array_merge($postactionmessages,
$object->errors);
542 $ispostactionok = -1;
543 dol_syslog(
"Failed to validate member: ".$errmsg, LOG_ERR, 0,
'_payment');
548 $datesubscription =
$object->datevalid;
562 if ($datesubscription && $defaultdelay && $defaultdelayunit) {
565 while ($datesubend < $now) {
567 $datesubscription =
dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit);
574 $outputlangs->setDefaultLang(empty(
$object->thirdparty->default_lang) ? $mysoc->default_lang :
$object->thirdparty->default_lang);
576 $amount = $FinalPaymentAmt;
577 $formatteddate =
dol_print_date($paymentdate,
'dayhour',
'auto', $outputlangs);
578 $label = $langs->trans(
"OnlineSubscriptionPaymentLine", $formatteddate, $paymentmethod, $ipaddress, $TRANSACTIONID);
582 if ($paymentmethod ==
'paybox') {
585 if ($paymentmethod ==
'paypal') {
588 if ($paymentmethod ==
'stripe') {
594 'paymentmethod' => $paymentmethod,
596 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
598 if (isset($hookmanager->resArray[
'bankaccountid'])) {
599 dol_syslog(
'accountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
600 $accountid = $hookmanager->resArray[
'bankaccountid'];
603 if ($accountid < 0) {
605 $errmsg =
'Setup of bank account to use for payment is not correctly done for payment method '.$paymentmethod;
606 $postactionmessages[] = $errmsg;
607 $ispostactionok = -1;
608 dol_syslog(
"Failed to get the bank account to record payment: ".$errmsg, LOG_ERR, 0,
'_payment');
611 $operation =
dol_getIdFromCode($db, $paymentTypeId,
'c_paiement',
'id',
'code', 1);
614 $emetteur_banque =
'';
617 if (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankviainvoice' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
618 $option =
'bankviainvoice';
619 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'bankdirect' && isModEnabled(
"bank")) {
620 $option =
'bankdirect';
621 } elseif (
getDolGlobalString(
'ADHERENT_BANK_USE') ==
'invoiceonly' && isModEnabled(
"bank") && isModEnabled(
"societe") && isModEnabled(
'invoice')) {
622 $option =
'invoiceonly';
624 if (empty($option)) {
634 dol_syslog(
"Call ->subscription to create subscription", LOG_DEBUG, 0,
'_payment');
636 $crowid =
$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $membertypeid);
640 $postactionmessages[] = $errmsg;
641 $ispostactionok = -1;
643 $postactionmessages[] =
'Subscription created (id='.$crowid.
')';
649 dol_syslog(
"Call ->subscriptionComplementaryActions option=".$option, LOG_DEBUG, 0,
'_payment');
651 $autocreatethirdparty = 1;
653 $result =
$object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque, $autocreatethirdparty, $TRANSACTIONID, $service);
658 $postactionmessages[] =
$object->error;
659 $postactionmessages = array_merge($postactionmessages,
$object->errors);
660 $ispostactionok = -1;
662 if ($option ==
'bankviainvoice') {
663 $postactionmessages[] =
'Invoice, payment and bank record created';
664 dol_syslog(
"Invoice, payment and bank record created", LOG_DEBUG, 0,
'_payment');
666 if ($option ==
'bankdirect') {
667 $postactionmessages[] =
'Bank record created';
668 dol_syslog(
"Bank record created", LOG_DEBUG, 0,
'_payment');
670 if ($option ==
'invoiceonly') {
671 $postactionmessages[] =
'Invoice recorded';
672 dol_syslog(
"Invoice recorded", LOG_DEBUG, 0,
'_payment');
682 if ($paymentmethod ==
'stripe' && $autocreatethirdparty && $option ==
'bankviainvoice') {
685 dol_syslog(
"Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0,
'_payment');
687 $service =
'StripeTest';
690 $service =
'StripeLive';
695 $thirdparty =
new Societe($db);
696 $thirdparty->fetch($thirdparty_id);
698 include_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
699 $stripe =
new Stripe($db);
702 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
704 if (!$customer && $TRANSACTIONID) {
705 dol_syslog(
"No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0,
'_payment');
708 global $stripearrayofkeysbyenv;
709 \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus][
'secret_key']);
711 if (preg_match(
'/^pi_/', $TRANSACTIONID)) {
713 $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);
716 $chpi = \Stripe\Charge::retrieve($TRANSACTIONID);
720 $stripecu = $chpi->customer;
722 if (empty($stripecu)) {
724 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
727 if (preg_match(
'/^pi_/', $TRANSACTIONID) && $customer) {
728 \Stripe\PaymentIntent::update($chpi->id, array(
'customer' => $customer->id));
731 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)";
732 $sql .=
" VALUES (".$thirdparty_id.
", '', '".$db->escape($stripecu).
"', 'stripe', '".$db->escape($stripearrayofkeysbyenv[$servicestatus][
'publishable_key']).
"', ".((int) $servicestatus).
", ".((int) $conf->entity).
", '".$db->idate(
dol_now()).
"', 0)";
733 $resql = $db->query($sql);
736 $errmsg =
'Failed to insert customer stripe id in database : '.$db->lasterror();
738 $postactionmessages[] = $errmsg;
739 $ispostactionok = -1;
744 $errmsg =
'Failed to retrieve paymentintent or charge from id';
746 $postactionmessages[] = $errmsg;
747 $ispostactionok = -1;
751 $errmsg =
'Failed to get or save customer stripe id in database : '.$e->getMessage();
753 $postactionmessages[] = $errmsg;
754 $ispostactionok = -1;
771 $nuser =
new User($db);
776 $sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE fk_member = ".((int)
$object->id);
777 $resqlcount = $db->query($sql);
779 $objcount = $db->fetch_object($resqlcount);
781 $found = $objcount->nb;
786 $result = $nuser->create_from_member($tmpuser,
$object->login);
787 $newpassword = $nuser->setPassword($user,
'');
790 $outputlangs->load(
"errors");
791 $postactionmessages[] =
'Error in create external user : '.$nuser->error;
793 $infouserlogin = $outputlangs->trans(
"Login").
': '.$nuser->login.
' '.
"\n".$outputlangs->trans(
"Password").
': '.$newpassword;
794 $postactionmessages[] = $langs->trans(
"NewUserCreated", $nuser->login);
797 $outputlangs->load(
"errors");
798 $postactionmessages[] =
'No user created because a user linked to member already exists';
804 dol_syslog(
"Send email to customer to ".
$object->email.
" if we have to (sendalsoemail = ".$sendalsoemail.
")", LOG_DEBUG, 0,
'_payment');
807 if (
$object->email && $sendalsoemail) {
812 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
815 $outputlangs->loadLangs(array(
"main",
"members"));
817 $arraydefaultmessage =
null;
820 if (!empty($labeltouse)) {
821 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
824 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
825 $subject = $arraydefaultmessage->topic;
826 $msg = $arraydefaultmessage->content;
831 if ($infouserlogin) {
832 $substitutionarray[
'__MEMBER_USER_LOGIN_INFORMATION__'] = $infouserlogin;
841 $listofpaths = array();
842 $listofnames = array();
843 $listofmimes = array();
844 if (is_object(
$object->invoice)) {
845 $invoicediroutput = $conf->facture->dir_output;
847 $file = $fileparams[
'fullname'];
849 $listofpaths = array($file);
850 $listofnames = array(basename($file));
854 $moreinheader =
'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'.
"\r\n";
856 $result =
$object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
"", $moreinheader);
860 $postactionmessages[] = $errmsg;
861 $ispostactionok = -1;
864 $postactionmessages[] =
'Email sent to member (with invoice document attached)';
866 $postactionmessages[] =
'Email sent to member (without any attached document)';
874 $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.';
875 $ispostactionok = -1;
878 $postactionmessages[] =
'Member '.$tmptag[
'MEM'].
' for subscription paid was not found';
879 $ispostactionok = -1;
881 } elseif (array_key_exists(
'INV', $tmptag) && $tmptag[
'INV'] > 0) {
883 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
885 $result =
$object->fetch((
int) $tmptag[
'INV']);
887 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
890 if ($paymentmethod ===
'paybox') {
893 if ($paymentmethod ===
'paypal') {
896 if ($paymentmethod ===
'stripe') {
899 if (empty($paymentTypeId)) {
900 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
902 if (empty($paymentType)) {
907 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
910 if (empty($paymentTypeId) || $paymentTypeId < 0) {
915 dol_syslog(
"FinalPaymentAmt = ".$FinalPaymentAmt.
" paymentTypeId = ".$paymentTypeId, LOG_DEBUG, 0,
'_payment');
918 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
922 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
924 $paiement->datepaye = $now;
925 if ($currencyCodeType == $conf->currency) {
926 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
928 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
930 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
931 $ispostactionok = -1;
934 $paiement->paiementid = $paymentTypeId;
935 $paiement->num_payment =
'';
936 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
937 $paiement->ext_payment_id = $TRANSACTIONID;
939 $paiement->ext_payment_site = $service;
942 $paiement_id = $paiement->create($user, 1);
943 if ($paiement_id < 0) {
944 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
945 $ispostactionok = -1;
948 $postactionmessages[] =
'Payment created';
953 if (!$error && isModEnabled(
"bank")) {
955 if ($paymentmethod ==
'paybox') {
957 } elseif ($paymentmethod ==
'paypal') {
959 } elseif ($paymentmethod ==
'stripe') {
965 'paymentmethod' => $paymentmethod,
967 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
969 if (isset($hookmanager->resArray[
'bankaccountid'])) {
970 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
971 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
974 if ($bankaccountid > 0) {
975 $label =
'(CustomerInvoicePayment)';
977 $label =
'(CustomerInvoicePaymentBack)';
979 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
981 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
982 $ispostactionok = -1;
985 $postactionmessages[] =
'Bank transaction of payment created';
989 $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.';
990 $ispostactionok = -1;
1001 $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.';
1002 $ispostactionok = -1;
1005 $postactionmessages[] =
'Invoice paid '.$tmptag[
'INV'].
' was not found';
1006 $ispostactionok = -1;
1008 } elseif (array_key_exists(
'ORD', $tmptag) && $tmptag[
'ORD'] > 0) {
1009 include_once DOL_DOCUMENT_ROOT .
'/commande/class/commande.class.php';
1011 $result =
$object->fetch((
int) $tmptag[
'ORD']);
1013 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1016 if ($paymentmethod ==
'paybox') {
1019 if ($paymentmethod ==
'paypal') {
1022 if ($paymentmethod ==
'stripe') {
1025 if (empty($paymentTypeId)) {
1026 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1028 if (empty($paymentType)) {
1029 $paymentType =
'CB';
1033 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1036 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1042 if (isModEnabled(
'invoice')) {
1043 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1044 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1046 $result = $invoice->createFromOrder($object, $user);
1048 $object->classifyBilled($user);
1049 $invoice->validate($user);
1051 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1053 $paiement->datepaye = $now;
1054 if ($currencyCodeType == $conf->currency) {
1055 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1057 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1059 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1060 $ispostactionok = -1;
1063 $paiement->paiementid = $paymentTypeId;
1064 $paiement->num_payment =
'';
1065 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1066 $paiement->ext_payment_id = $TRANSACTIONID;
1067 $paiement->ext_payment_site = $service;
1070 $paiement_id = $paiement->create($user, 1);
1071 if ($paiement_id < 0) {
1072 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1073 $ispostactionok = -1;
1076 $postactionmessages[] =
'Payment created';
1077 $ispostactionok = 1;
1081 if (!$error && isModEnabled(
"bank")) {
1083 if ($paymentmethod ==
'paybox') {
1085 } elseif ($paymentmethod ==
'paypal') {
1087 } elseif ($paymentmethod ==
'stripe') {
1093 'paymentmethod' => $paymentmethod,
1095 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1096 if ($reshook >= 0) {
1097 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1098 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1099 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1102 if ($bankaccountid > 0) {
1103 $label =
'(CustomerInvoicePayment)';
1105 $label =
'(CustomerInvoicePaymentBack)';
1107 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1109 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1110 $ispostactionok = -1;
1113 $postactionmessages[] =
'Bank transaction of payment created';
1114 $ispostactionok = 1;
1117 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1118 $ispostactionok = -1;
1129 $postactionmessages[] =
'Failed to create invoice form order ' . $tmptag[
'ORD'] .
'.';
1130 $ispostactionok = -1;
1133 $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.';
1134 $ispostactionok = -1;
1137 $postactionmessages[] =
'Invoice module is not enable';
1138 $ispostactionok = -1;
1141 $postactionmessages[] =
'Order paid ' . $tmptag[
'ORD'] .
' was not found';
1142 $ispostactionok = -1;
1144 } elseif (array_key_exists(
'DON', $tmptag) && $tmptag[
'DON'] > 0) {
1145 include_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
1146 $don =
new Don($db);
1147 $result = $don->fetch((
int) $tmptag[
'DON']);
1150 if ($paymentmethod ==
'paybox') {
1153 if ($paymentmethod ==
'paypal') {
1154 $paymentTypeId =
getDolGlobalInt(
'global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS');
1156 if ($paymentmethod ==
'stripe') {
1159 if (empty($paymentTypeId)) {
1160 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1162 if (empty($paymentType)) {
1163 $paymentType =
'CB';
1167 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1170 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1176 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1180 include_once DOL_DOCUMENT_ROOT.
'/don/class/paymentdonation.class.php';
1183 $totalpaid = $FinalPaymentAmt;
1185 if ($currencyCodeType == $conf->currency) {
1186 $paiement->amounts = array(
$object->id => $totalpaid);
1189 $postactionmessages[] =
'Payment donation can\'t be paid with different currency than '.$conf->currency;
1190 $ispostactionok = -1;
1194 $paiement->fk_donation = $don->id;
1195 $paiement->datep = $now;
1196 $paiement->paymenttype = $paymentTypeId;
1197 $paiement->num_payment =
'';
1198 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1199 $paiement->ext_payment_id = $TRANSACTIONID;
1200 $paiement->ext_payment_site = $service;
1203 $paiement_id = $paiement->create($user, 1);
1204 if ($paiement_id < 0) {
1205 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1206 $ispostactionok = -1;
1209 $postactionmessages[] =
'Payment created';
1210 $ispostactionok = 1;
1212 if ($totalpaid >= $don->getRemainToPay()) {
1213 $don->setPaid($don->id);
1218 if (!$error && isModEnabled(
"bank")) {
1220 if ($paymentmethod ==
'paybox') {
1222 } elseif ($paymentmethod ==
'paypal') {
1224 } elseif ($paymentmethod ==
'stripe') {
1230 'paymentmethod' => $paymentmethod,
1232 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1233 if ($reshook >= 0) {
1234 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1235 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1236 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1239 if ($bankaccountid > 0) {
1240 $label =
'(DonationPayment)';
1241 $result = $paiement->addPaymentToBank($user,
'payment_donation', $label, $bankaccountid,
'',
'');
1243 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1244 $ispostactionok = -1;
1247 $postactionmessages[] =
'Bank transaction of payment created';
1248 $ispostactionok = 1;
1251 $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.';
1252 $ispostactionok = -1;
1263 $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.';
1264 $ispostactionok = -1;
1267 $postactionmessages[] =
'Donation paid '.$tmptag[
'DON'].
' was not found';
1268 $ispostactionok = -1;
1273 } elseif (array_key_exists(
'ATT', $tmptag) && $tmptag[
'ATT'] > 0) {
1275 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1276 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1277 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1279 $result =
$object->fetch($ref);
1282 if ($paymentmethod ==
'paybox') {
1285 if ($paymentmethod ==
'paypal') {
1288 if ($paymentmethod ==
'stripe') {
1291 if (empty($paymentTypeId)) {
1292 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1294 if (empty($paymentType)) {
1295 $paymentType =
'CB';
1299 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1302 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1308 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1309 $resultvalidate =
$object->validate($user);
1310 if ($resultvalidate < 0) {
1311 $postactionmessages[] =
'Cannot validate invoice';
1312 $ispostactionok = -1;
1318 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1320 $paiement->datepaye = $now;
1321 if ($currencyCodeType == $conf->currency) {
1322 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1324 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1326 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1327 $ispostactionok = -1;
1330 $paiement->paiementid = $paymentTypeId;
1331 $paiement->num_payment =
'';
1332 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress.
' for event registration';
1333 $paiement->ext_payment_id = $TRANSACTIONID;
1334 $paiement->ext_payment_site = $service;
1337 $paiement_id = $paiement->create($user, 1);
1338 if ($paiement_id < 0) {
1339 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1340 $ispostactionok = -1;
1343 $postactionmessages[] =
'Payment created';
1344 $ispostactionok = 1;
1348 if (!$error && isModEnabled(
"bank")) {
1350 if ($paymentmethod ==
'paybox') {
1352 } elseif ($paymentmethod ==
'paypal') {
1354 } elseif ($paymentmethod ==
'stripe') {
1360 'paymentmethod' => $paymentmethod,
1362 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1363 if ($reshook >= 0) {
1364 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1365 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1366 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1369 if ($bankaccountid > 0) {
1370 $label =
'(CustomerInvoicePayment)';
1372 $label =
'(CustomerInvoicePaymentBack)';
1374 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1376 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1377 $ispostactionok = -1;
1380 $postactionmessages[] =
'Bank transaction of payment created';
1381 $ispostactionok = 1;
1384 $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.';
1385 $ispostactionok = -1;
1394 $resultattendee = $attendeetovalidate->fetch((
int) $tmptag[
'ATT']);
1395 if ($resultattendee < 0) {
1399 $attendeetovalidate->validate($user);
1401 $attendeetovalidate->amount = $FinalPaymentAmt;
1402 $attendeetovalidate->date_subscription =
dol_now();
1403 $attendeetovalidate->update($user);
1417 $thirdparty =
new Societe($db);
1418 $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
1419 if ($resultthirdparty < 0) {
1420 setEventMessages($resultthirdparty->error, $resultthirdparty->errors,
"errors");
1422 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1423 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1426 $outputlangs =
new Translate(
'', $conf);
1427 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1429 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1431 $arraydefaultmessage =
null;
1433 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');
1435 if (!empty($idoftemplatetouse)) {
1436 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1439 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1440 $subject = $arraydefaultmessage->topic;
1441 $msg = $arraydefaultmessage->content;
1443 $subject =
'['.$appli.
'] '.
$object->ref.
' - '.$outputlangs->trans(
"NewRegistration");
1444 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfRegistrationWasReceived");
1453 $sendto = $attendeetovalidate->email;
1455 if ($thirdparty->email) {
1456 $cc = $thirdparty->email;
1458 if ($attendeetovalidate->email_company && $attendeetovalidate->email_company != $thirdparty->email) {
1459 $cc = ($cc ?
', ' :
'').$attendeetovalidate->email_company;
1464 $urlback = $_SERVER[
"REQUEST_URI"];
1470 $listofpaths = array();
1471 $listofnames = array();
1472 $listofmimes = array();
1473 if (is_object($object)) {
1474 $invoicediroutput = $conf->facture->dir_output;
1476 $file = $fileparams[
'fullname'];
1478 $listofpaths = array($file);
1479 $listofnames = array(basename($file));
1483 $trackid =
'inv'.$object->id;
1485 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, $cc,
'', 0, $ishtml,
'',
'', $trackid,
'',
'standard');
1487 $result = $mailfile->sendfile();
1489 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1491 dol_syslog(
"Failed to send EMail to ".$sendto.
' - '.$mailfile->error, LOG_ERR, 0,
'_payment');
1497 $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.';
1498 $ispostactionok = -1;
1501 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1502 $ispostactionok = -1;
1504 } elseif (array_key_exists(
'BOO', $tmptag) && $tmptag[
'BOO'] > 0) {
1506 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1507 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1508 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1510 $result =
$object->fetch($ref);
1512 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1515 if ($paymentmethod ==
'paybox') {
1518 if ($paymentmethod ==
'paypal') {
1521 if ($paymentmethod ==
'stripe') {
1524 if (empty($paymentTypeId)) {
1525 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1527 if (empty($paymentType)) {
1528 $paymentType =
'CB';
1532 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1535 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1541 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1542 $resultvalidate =
$object->validate($user);
1543 if ($resultvalidate < 0) {
1544 $postactionmessages[] =
'Cannot validate invoice';
1545 $ispostactionok = -1;
1551 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1553 $paiement->datepaye = $now;
1554 if ($currencyCodeType == $conf->currency) {
1555 $paiement->amounts = array(
$object->id => $FinalPaymentAmt);
1557 $paiement->multicurrency_amounts = array(
$object->id => $FinalPaymentAmt);
1559 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1560 $ispostactionok = -1;
1563 $paiement->paiementid = $paymentTypeId;
1564 $paiement->num_payment =
'';
1565 $paiement->note_public =
'Online payment '.dol_print_date($now,
'standard').
' from '.$ipaddress;
1566 $paiement->ext_payment_id = $TRANSACTIONID;
1567 $paiement->ext_payment_site = $service;
1570 $paiement_id = $paiement->create($user, 1);
1571 if ($paiement_id < 0) {
1572 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1573 $ispostactionok = -1;
1576 $postactionmessages[] =
'Payment created';
1577 $ispostactionok = 1;
1581 if (!$error && isModEnabled(
"bank")) {
1583 if ($paymentmethod ==
'paybox') {
1585 } elseif ($paymentmethod ==
'paypal') {
1587 } elseif ($paymentmethod ==
'stripe') {
1593 'paymentmethod' => $paymentmethod,
1595 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1596 if ($reshook >= 0) {
1597 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1598 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1599 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1602 if ($bankaccountid > 0) {
1603 $label =
'(CustomerInvoicePayment)';
1605 $label =
'(CustomerInvoicePaymentBack)';
1607 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1609 $postactionmessages[] = $paiement->error.
' '.implode(
"<br>\n", $paiement->errors);
1610 $ispostactionok = -1;
1613 $postactionmessages[] =
'Bank transaction of payment created';
1614 $ispostactionok = 1;
1617 $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.';
1618 $ispostactionok = -1;
1625 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorboothattendee.class.php';
1626 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
1628 $resultbooth = $booth->fetch((
int) $tmptag[
'BOO']);
1629 if ($resultbooth < 0) {
1633 $booth->status = ConferenceOrBooth::STATUS_SUGGESTED;
1634 $resultboothupdate = $booth->update($user);
1635 if ($resultboothupdate<0) {
1638 $resultinvoice = $invoice->fetch($ref);
1639 if ($resultinvoice<0) {
1640 $postactionmessages[] =
'Could not find the associated invoice.';
1641 $ispostactionok = -1;
1644 $thirdparty =
new Societe($db);
1645 $resultthirdparty = $thirdparty->fetch($invoice->socid);
1646 if ($resultthirdparty<0) {
1651 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
1652 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1655 $outputlangs =
new Translate(
'', $conf);
1656 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
1658 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
1660 $arraydefaultmessage =
null;
1662 $idoftemplatetouse =
getDolGlobalString(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');
1664 if (!empty($idoftemplatetouse)) {
1665 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1,
'');
1668 if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1669 $subject = $arraydefaultmessage->topic;
1670 $msg = $arraydefaultmessage->content;
1672 $subject =
'['.$appli.
'] '.$booth->ref.
' - '.$outputlangs->trans(
"NewRegistration").
']';
1673 $msg = $outputlangs->trans(
"OrganizationEventPaymentOfBoothWasReceived");
1682 $sendto = $thirdparty->email;
1684 $urlback = $_SERVER[
"REQUEST_URI"];
1687 $trackid =
'inv'.$invoice->id;
1689 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml,
'',
'', $trackid,
'',
'standard');
1691 $result = $mailfile->sendfile();
1693 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
1695 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
1710 $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.';
1711 $ispostactionok = -1;
1714 $postactionmessages[] =
'Invoice paid '.$tmptag[
'ATT'].
' was not found';
1715 $ispostactionok = -1;
1717 } elseif (array_key_exists(
'CON', $tmptag) && $tmptag[
'CON'] > 0) {
1718 include_once DOL_DOCUMENT_ROOT .
'/contrat/class/contrat.class.php';
1720 $result =
$object->fetch((
int) $tmptag[
'CON']);
1722 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
1725 if ($paymentmethod ==
'paybox') {
1728 if ($paymentmethod ==
'paypal') {
1731 if ($paymentmethod ==
'stripe') {
1734 if (empty($paymentTypeId)) {
1735 dol_syslog(
"paymentType = ".$paymentType, LOG_DEBUG, 0,
'_payment');
1737 if (empty($paymentType)) {
1738 $paymentType =
'CB';
1742 $paymentTypeId =
dol_getIdFromCode($db, $paymentType,
'c_paiement',
'code',
'id', 1);
1745 if (empty($paymentTypeId) || $paymentTypeId < 0) {
1750 $currencyCodeType = $_SESSION[
'currencyCodeType'];
1751 $contract_lines = (array_key_exists(
'COL', $tmptag) && $tmptag[
'COL'] > 0) ? $tmptag[
'COL'] : null;
1754 if (isModEnabled(
'invoice')) {
1755 if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1756 include_once DOL_DOCUMENT_ROOT .
'/compta/facture/class/facture.class.php';
1758 $result = $invoice->createFromContract($object, $user, array((
int) $contract_lines));
1761 $invoice->validate($user);
1763 include_once DOL_DOCUMENT_ROOT .
'/compta/paiement/class/paiement.class.php';
1765 $paiement->datepaye = $now;
1766 if ($currencyCodeType == $conf->currency) {
1767 $paiement->amounts = array($invoice->id => $FinalPaymentAmt);
1769 $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt);
1771 $postactionmessages[] =
'Payment was done in a currency ('.$currencyCodeType.
') other than the expected currency of company ('.$conf->currency.
')';
1772 $ispostactionok = -1;
1775 $paiement->paiementid = $paymentTypeId;
1776 $paiement->num_payment =
'';
1777 $paiement->note_public =
'Online payment ' .
dol_print_date($now,
'standard') .
' from ' . $ipaddress;
1778 $paiement->ext_payment_id = $TRANSACTIONID;
1779 $paiement->ext_payment_site = $service;
1782 $paiement_id = $paiement->create($user, 1);
1783 if ($paiement_id < 0) {
1784 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1785 $ispostactionok = -1;
1788 $postactionmessages[] =
'Payment created';
1789 $ispostactionok = 1;
1793 if (!$error && isModEnabled(
"bank")) {
1795 if ($paymentmethod ==
'paybox') {
1797 } elseif ($paymentmethod ==
'paypal') {
1799 } elseif ($paymentmethod ==
'stripe') {
1805 'paymentmethod' => $paymentmethod,
1807 $reshook = $hookmanager->executeHooks(
'getBankAccountPaymentMethod', $parameters, $object, $action);
1808 if ($reshook >= 0) {
1809 if (isset($hookmanager->resArray[
'bankaccountid'])) {
1810 dol_syslog(
'bankaccountid overwrite by hook return with value='.$hookmanager->resArray[
'bankaccountid'], LOG_DEBUG, 0,
'_payment');
1811 $bankaccountid = $hookmanager->resArray[
'bankaccountid'];
1814 if ($bankaccountid > 0) {
1815 $label =
'(CustomerInvoicePayment)';
1817 $label =
'(CustomerInvoicePaymentBack)';
1819 $result = $paiement->addPaymentToBank($user,
'payment', $label, $bankaccountid,
'',
'');
1821 $postactionmessages[] = $paiement->error .
' ' . implode(
"<br>\n", $paiement->errors);
1822 $ispostactionok = -1;
1825 $postactionmessages[] =
'Bank transaction of payment created';
1826 $ispostactionok = 1;
1829 $postactionmessages[] =
'Setup of bank account to use in module ' . $paymentmethod .
' was not set. No way to record the payment.';
1830 $ispostactionok = -1;
1841 $msg =
'Failed to create invoice form contract ' . $tmptag[
'CON'];
1842 if (!empty($cols)) {
1843 $msg .=
' and col '. $cols .
'.';
1845 $postactionmessages[] = $msg;
1846 $ispostactionok = -1;
1849 $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.';
1850 $ispostactionok = -1;
1853 $postactionmessages[] =
'Invoice module is not enable';
1854 $ispostactionok = -1;
1857 $msg =
'Contract paid ' . $tmptag[
'CON'] .
' was not found';
1858 if (!empty($cols)) {
1859 $msg .=
' for col '.$tmptag[
'COL'] .
'.';
1861 $postactionmessages[] = $msg;
1862 $ispostactionok = -1;
1871 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
1872 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
1874 $currencyCodeType = empty($_SESSION[
'currencyCodeType']) ?
'' : $_SESSION[
'currencyCodeType'];
1875 $FinalPaymentAmt = empty($_SESSION[
"FinalPaymentAmt"]) ?
'': $_SESSION[
"FinalPaymentAmt"];
1876 $paymentType = empty($_SESSION[
'PaymentType']) ?
'' : $_SESSION[
'PaymentType'];
1878 if (is_object($object) && method_exists($object,
'call_trigger')) {
1880 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1885 } elseif (get_class($object) ==
'stdClass') {
1887 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
1889 $result = $paiement->call_trigger(
'PAYMENTONLINE_PAYMENT_OK', $user);
1898if (empty($doactionsthenredirect)) {
1900 print $langs->trans(
"YourPaymentHasBeenRecorded").
"<br>\n";
1901 if ($TRANSACTIONID) {
1902 print $langs->trans(
"ThisIsTransactionId", $TRANSACTIONID).
"<br><br>\n";
1906 $key =
'ONLINE_PAYMENT_MESSAGE_OK';
1912 print $langs->trans(
'DoExpressCheckoutPaymentAPICallFailed').
"<br>\n";
1913 print $langs->trans(
'DetailedErrorMessage').
": ".$ErrorLongMsg.
"<br>\n";
1914 print $langs->trans(
'ShortErrorMessage').
": ".$ErrorShortMsg.
"<br>\n";
1915 print $langs->trans(
'ErrorCode').
": ".$ErrorCode.
"<br>\n";
1916 print $langs->trans(
'ErrorSeverityCode').
": ".$ErrorSeverityCode.
"<br>\n";
1918 if ($mysoc->email) {
1919 print
"\nPlease, send a screenshot of this page to ".$mysoc->email.
"<br>\n";
1931 dol_syslog(
"Send email to admins if we have to (sendemail = ".$sendemail.
")", LOG_DEBUG, 0,
'_payment');
1935 $companylangs =
new Translate(
'', $conf);
1936 $companylangs->setDefaultLang($mysoc->default_lang);
1937 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
1939 $sendto = $sendemail;
1942 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1943 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1948 $urlback = $_SERVER[
"REQUEST_URI"];
1949 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived");
1951 if (array_key_exists(
'MEM', $tmptag)) {
1952 $url = $urlwithroot.
"/adherents/subscription.php?rowid=".((int) $tmptag[
'MEM']);
1953 $content .=
'<strong>'.$companylangs->trans(
"PaymentSubscription").
"</strong><br><br>\n";
1954 $content .= $companylangs->trans(
"MemberId").
': <strong>'.$tmptag[
'MEM'].
"</strong><br>\n";
1955 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1956 } elseif (array_key_exists(
'INV', $tmptag)) {
1957 $url = $urlwithroot.
"/compta/facture/card.php?id=".((int) $tmptag[
'INV']);
1958 $content .=
'<strong>'.$companylangs->trans(
"Payment").
"</strong><br><br>\n";
1959 $content .= $companylangs->trans(
"InvoiceId").
': <strong>'.$tmptag[
'INV'].
"</strong><br>\n";
1961 $content .= $companylangs->trans(
"Link").
': <a href="'.$url.
'">'.$url.
'</a>'.
"<br>\n";
1963 $content .= $companylangs->transnoentitiesnoconv(
"NewOnlinePaymentReceived").
"<br>\n";
1965 $content .= $companylangs->transnoentities(
"PostActionAfterPayment").
' : ';
1966 if ($ispostactionok > 0) {
1968 $content .=
'<span style="color: green">'.$companylangs->transnoentitiesnoconv(
"OK").
'</span>';
1969 } elseif ($ispostactionok == 0) {
1970 $content .= $companylangs->transnoentitiesnoconv(
"None");
1972 $topic .= ($ispostactionok ?
'' :
' ('.$companylangs->trans(
"WarningPostActionErrorAfterPayment").
')');
1973 $content .=
'<span class="star">'.$companylangs->transnoentitiesnoconv(
"Error").
'</span>';
1975 $content .=
'<br>'.
"\n";
1976 foreach ($postactionmessages as $postactionmessage) {
1977 $content .=
' * '.$postactionmessage.
'<br>'.
"\n";
1979 if ($ispostactionok < 0) {
1980 $content .= $langs->transnoentities(
"ARollbackWasPerformedOnPostActions");
1982 $content .=
'<br>'.
"\n";
1984 $content .=
"<br>\n";
1985 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
1986 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
1987 $content .= $companylangs->transnoentitiesnoconv(
"ThisIsTransactionId").
': <strong>'.$TRANSACTIONID.
"</strong><br>\n";
1988 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
1989 $content .=
"<br>\n";
1990 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
1992 if (!empty($ErrorCode)) {
1993 $content .=
"ErrorCode = ".$ErrorCode.
"<br>\n";
1995 if (!empty($ErrorShortMsg)) {
1996 $content .=
"ErrorShortMsg = ".$ErrorShortMsg.
"<br>\n";
1998 if (!empty($ErrorLongMsg)) {
1999 $content .=
"ErrorLongMsg = ".$ErrorLongMsg.
"<br>\n";
2001 if (!empty($ErrorSeverityCode)) {
2002 $content .=
"ErrorSeverityCode = ".$ErrorSeverityCode.
"<br>\n";
2009 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2010 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml,
'',
'', $trackid,
'',
'standard');
2012 $result = $mailfile->sendfile();
2014 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2017 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2025 $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION[
'onlinetoken'] : $PAYPALTOKEN;
2026 $payerID = empty($PAYPALPAYERID) ? $_SESSION[
'payerID'] : $PAYPALPAYERID;
2028 $paymentType = $_SESSION[
'PaymentType'];
2029 $currencyCodeType = $_SESSION[
'currencyCodeType'];
2030 $FinalPaymentAmt = $_SESSION[
"FinalPaymentAmt"];
2032 if (is_object($object) && method_exists($object,
'call_trigger')) {
2034 $result =
$object->call_trigger(
'PAYMENTONLINE_PAYMENT_KO', $user);
2043 $companylangs =
new Translate(
'', $conf);
2044 $companylangs->setDefaultLang($mysoc->default_lang);
2045 $companylangs->loadLangs(array(
'main',
'members',
'bills',
'paypal',
'paybox',
'stripe'));
2047 $sendto = $sendemail;
2050 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
2051 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
2054 $urlback = $_SERVER[
"REQUEST_URI"];
2055 $topic =
'['.$appli.
'] '.$companylangs->transnoentitiesnoconv(
"ValidationOfPaymentFailed");
2057 $content .=
'<span style="color: orange">'.$companylangs->transnoentitiesnoconv(
"PaymentSystemConfirmPaymentPageWasCalledButFailed").
"</span>\n";
2059 $content .=
"<br><br>\n";
2060 $content .=
'<u>'.$companylangs->transnoentitiesnoconv(
"TechnicalInformation").
":</u><br>\n";
2061 $content .= $companylangs->transnoentitiesnoconv(
"OnlinePaymentSystem").
': <strong>'.$paymentmethod.
"</strong><br>\n";
2062 $content .= $companylangs->transnoentitiesnoconv(
"ReturnURLAfterPayment").
': '.$urlback.
"<br>\n";
2063 $content .=
"<br>\n";
2064 $content .=
"tag=".$fulltag.
"<br>\ntoken=".$onlinetoken.
"<br>\npaymentType=".$paymentType.
"<br>\ncurrencycodeType=".$currencyCodeType.
"<br>\npayerId=".$payerID.
"<br>\nipaddress=".$ipaddress.
"<br>\nFinalPaymentAmt=".$FinalPaymentAmt.
"<br>\n";
2070 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
2071 $mailfile =
new CMailFile($topic, $sendto, $from, $content, array(), array(), array(),
'',
'', 0, $ishtml,
'',
'', $trackid,
'',
'standard');
2073 $result = $mailfile->sendfile();
2075 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
2077 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
2084unset($_SESSION[
"FinalPaymentAmt"]);
2085unset($_SESSION[
"TRANSACTIONID"]);
2089if (empty($doactionsthenredirect)) {
2092 print
"<!-- Info for payment: FinalPaymentAmt=".dol_escape_htmltag($FinalPaymentAmt).
" paymentTypeId=".
dol_escape_htmltag($paymentTypeId).
" currencyCodeType=".
dol_escape_htmltag($currencyCodeType).
" -->\n";
2097if (empty($doactionsthenredirect)) {
2108if (!empty($doactionsthenredirect)) {
2112 $ext_urlok = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentok&fulltag='.$FULLTAG;
2113 print
"<script>window.top.location.href = '".dol_escape_js($ext_urlok) .
"';</script>";
2117 $ext_urlko = DOL_URL_ROOT.
'/public/website/index.php?website='.urlencode($ws).
'&pageref=paymentko&fulltag='.$FULLTAG;
2118 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()
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 contracts.
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)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.