diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index d9cfdc28b69..a52ddb5fbcc 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -113,36 +113,6 @@ $uncryptedconferencesubscription = dol_decode($conferencesubscription, $dolibarr $subscription = substr($uncryptedconferencesubscription, 0, strlen($uncryptedconferencesubscription)-strlen($ref)); $reffrompayment = substr($uncryptedconferencesubscription, -strlen($ref), strlen($ref)); -// After a conference attendee payment -if ($subscription == 'subscriptionok' && $ref == $reffrompayment) { - // Looking for the invoice to which add a payment - $paidinvoice = new Facture($db); - $resultinvoice = $paidinvoice->fetch($invoiceref); - if ($resultinvoice < 0) { - setEventMessages(null, $paidinvoice->errors, "errors"); - } else { - // Creation of payment line - $paiement = new Paiement($db); - $paiement->datepaye = dol_now(); - $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id - $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching - $paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1); - $paiement->num_payment = GETPOST('num_paiement', 'alpha'); - $paiement->note_private = GETPOST('comment', 'alpha'); - - // Validating the attendee - $attendeetovalidate = new ConferenceOrBoothAttendee($db); - $resultattendee = $attendeetovalidate->fetch($ref); - if ($resultattendee < 0) { - setEventMessages(null, $attendeetovalidate->errors, "errors"); - } else { - $attendeetovalidate->setStatut(1); - } - } - - - -} // Detect $paymentmethod $paymentmethod = ''; @@ -186,6 +156,33 @@ $object = new stdClass(); // For triggers $error = 0; +// After a conference attendee payment +if ($subscription == 'subscriptionok' && $ref == $reffrompayment) { + // Looking for the invoice to which add a payment + $paidinvoice = new Facture($db); + $resultinvoice = $paidinvoice->fetch($invoiceref); + if ($resultinvoice < 0) { + setEventMessages(null, $paidinvoice->errors, "errors"); + } else { + // Creation of payment line + $paiement = new Paiement($db); + $paiement->datepaye = dol_now(); + $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id + $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching + $paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1); + $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->note_private = GETPOST('comment', 'alpha'); + + // Validating the attendee + $attendeetovalidate = new ConferenceOrBoothAttendee($db); + $resultattendee = $attendeetovalidate->fetch($ref); + if ($resultattendee < 0) { + setEventMessages(null, $attendeetovalidate->errors, "errors"); + } else { + $attendeetovalidate->setStatut(1); + } + } +} /* * Actions