diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 7fc72f78e7c..3fcf74a4c0c 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -109,7 +109,24 @@ $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); if ($subjecttosend && $texttosend) { $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + global $conf, $langs; + + // Envoi mail confirmation + $from = $conf->email_from; + if (!empty($conf->global->ADHERENT_MAIL_FROM)) { + $from = $conf->global->ADHERENT_MAIL_FROM; + } + + $trackid = 'mem'.$this->id; + + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subjecttosend, $thirdparty->email, $from, $texttosend, array(), array(), array(), "", "", 0, -1, '', '', $trackid, $moreinheader); + if ($mailfile->sendfile()) { + return 1; + } else { + $this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email).'. '.$mailfile->error; + return -1; + } } /* diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 533ce56cee1..90cf38a6051 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -177,13 +177,11 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) { $paiement->datepaye = dol_now(); $paiement->amount = $paidinvoice->total_ttc; $paiement->amounts[] = $paidinvoice->total_ttc; - $paiement_id = $paiement->create($user, 1, $thirdparty); // This include closing invoices and regenerating documents if ($paiement_id < 0) { setEventMessages($paiement->error, $paiement->errors, 'errors'); $error++; - } - else { + } else { // Validating the attendee $attendeetovalidate = new ConferenceOrBoothAttendee($db); $resultattendee = $attendeetovalidate->fetch($ref); @@ -191,7 +189,6 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) { setEventMessages(null, $attendeetovalidate->errors, "errors"); } else { $attendeetovalidate->setStatut(1); - // @todo send email } } }