diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 9fb27168fd1..fab0a9733c8 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -374,7 +374,7 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $valid = true; $sourcetouse = 'conferencesubscription'; - $reftouse = $confattendee->id; + $reftouse = $facture->id; $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d6613cb86de..4460988ea60 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -114,23 +114,23 @@ if (!$action) { if ($source == 'conferencesubscription') { // Finding the Attendee - $attendeeid = GETPOST('ref'); - $attendee = new ConferenceOrBoothAttendee($db); - $resultattendee = $attendee->fetch($attendeeid); - if ($resultattendee <= 0) { - setEventMessages(null, $attendee->errors, "errors"); + $invoiceid = GETPOST('ref'); + $invoice = new Facture($db); + $resultinvoice = $invoice->fetch($invoiceid); + if ($resultinvoice <= 0) { + setEventMessages(null, $invoice->errors, "errors"); } else { - $attendee->fetchObjectLinked(); - $linkedInvoices = $attendee->linkedObjectsIds['facture']; + $invoice->fetchObjectLinked(); + $linkedAttendees = $invoice->linkedObjectsIds['conferenceorboothattendee']; - if (is_array($linkedInvoices)) { - $linkedInvoices = array_values($linkedInvoices); + if (is_array($linkedAttendees)) { + $linkedAttendees = array_values($linkedAttendees); - $invoice = new Facture($db); - $resultinvoice = $invoice->fetch($linkedInvoices[0]); - if ($resultinvoice <= 0) { - setEventMessages(null, $invoice->errors, "errors"); + $attendee = new ConferenceOrBoothAttendee($db); + $resultattendee = $attendee->fetch($linkedAttendees[0]); + if ($resultattendee <= 0) { + setEventMessages(null, $attendee->errors, "errors"); } else { $amount = price2num($invoice->total_ttc); // Finding the associated thirdparty @@ -1809,7 +1809,7 @@ if ($source == 'conferencesubscription') { print '