wip on paymentok page

This commit is contained in:
Dorian Vabre 2021-04-20 10:42:50 +02:00
parent b43e85dbf4
commit 3b17a0d66a

View File

@ -163,12 +163,27 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
$resultinvoice = $paidinvoice->fetch($invoiceref); $resultinvoice = $paidinvoice->fetch($invoiceref);
if ($resultinvoice < 0) { if ($resultinvoice < 0) {
setEventMessages(null, $paidinvoice->errors, "errors"); setEventMessages(null, $paidinvoice->errors, "errors");
} else {
// Finding thirdparty
$thirdparty = new Societe($db);
$resultthirdparty = $thirdparty->fetch($paidinvoice->socid);
if ($resultthirdparty <= 0) {
$mesg = $thirdparty->error;
$error++;
} else { } else {
// Creation of payment line // Creation of payment line
$paiement = new Paiement($db); $paiement = new Paiement($db);
$paiement->facid = $paidinvoice->id;
$paiement->datepaye = dol_now(); $paiement->datepaye = dol_now();
$paiement->amounts[] = $paidinvoice->total_ttc; // Array with all payments dispatching with invoice id $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 {
// Validating the attendee // Validating the attendee
$attendeetovalidate = new ConferenceOrBoothAttendee($db); $attendeetovalidate = new ConferenceOrBoothAttendee($db);
$resultattendee = $attendeetovalidate->fetch($ref); $resultattendee = $attendeetovalidate->fetch($ref);
@ -176,6 +191,9 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
setEventMessages(null, $attendeetovalidate->errors, "errors"); setEventMessages(null, $attendeetovalidate->errors, "errors");
} else { } else {
$attendeetovalidate->setStatut(1); $attendeetovalidate->setStatut(1);
// @todo send email
}
}
} }
} }
} }