wip on paymentok page
This commit is contained in:
parent
b43e85dbf4
commit
3b17a0d66a
@ -164,18 +164,36 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
|
|||||||
if ($resultinvoice < 0) {
|
if ($resultinvoice < 0) {
|
||||||
setEventMessages(null, $paidinvoice->errors, "errors");
|
setEventMessages(null, $paidinvoice->errors, "errors");
|
||||||
} else {
|
} else {
|
||||||
// Creation of payment line
|
// Finding thirdparty
|
||||||
$paiement = new Paiement($db);
|
$thirdparty = new Societe($db);
|
||||||
$paiement->datepaye = dol_now();
|
$resultthirdparty = $thirdparty->fetch($paidinvoice->socid);
|
||||||
$paiement->amounts[] = $paidinvoice->total_ttc; // Array with all payments dispatching with invoice id
|
if ($resultthirdparty <= 0) {
|
||||||
|
$mesg = $thirdparty->error;
|
||||||
// Validating the attendee
|
$error++;
|
||||||
$attendeetovalidate = new ConferenceOrBoothAttendee($db);
|
|
||||||
$resultattendee = $attendeetovalidate->fetch($ref);
|
|
||||||
if ($resultattendee < 0) {
|
|
||||||
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
|
||||||
} else {
|
} else {
|
||||||
$attendeetovalidate->setStatut(1);
|
// Creation of payment line
|
||||||
|
$paiement = new Paiement($db);
|
||||||
|
$paiement->facid = $paidinvoice->id;
|
||||||
|
$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 {
|
||||||
|
// Validating the attendee
|
||||||
|
$attendeetovalidate = new ConferenceOrBoothAttendee($db);
|
||||||
|
$resultattendee = $attendeetovalidate->fetch($ref);
|
||||||
|
if ($resultattendee < 0) {
|
||||||
|
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
||||||
|
} else {
|
||||||
|
$attendeetovalidate->setStatut(1);
|
||||||
|
// @todo send email
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user