fix on creating attendee

This commit is contained in:
Dorian Vabre 2021-04-21 17:26:46 +02:00
parent 1700ac937a
commit 22dab0e0af

View File

@ -228,7 +228,7 @@ if (empty($reshook) && $action == 'add') {
} }
if (!$error) { if (!$error) {
// Check if attendee already exists (by email) // Check if attendee already exists (by email and for this event)
$confattendee = new ConferenceOrBoothAttendee($db); $confattendee = new ConferenceOrBoothAttendee($db);
$resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 't.email'=>$email)); $resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 't.email'=>$email));
if ($resultfetchconfattendee != 0 && count($resultfetchconfattendee)>0) { if ($resultfetchconfattendee != 0 && count($resultfetchconfattendee)>0) {
@ -236,7 +236,6 @@ if (empty($reshook) && $action == 'add') {
$confattendee = $resultfetchconfattendee[0]; $confattendee = $resultfetchconfattendee[0];
} else { } else {
// Need to create a confattendee // Need to create a confattendee
}
$confattendee->date_subscription = dol_now(); $confattendee->date_subscription = dol_now();
$confattendee->email = GETPOST("email"); $confattendee->email = GETPOST("email");
$confattendee->fk_actioncomm = $id; $confattendee->fk_actioncomm = $id;
@ -245,6 +244,8 @@ if (empty($reshook) && $action == 'add') {
$error++; $error++;
$errmsg .= $confattendee->error; $errmsg .= $confattendee->error;
} }
}
// Getting the thirdparty or creating it // Getting the thirdparty or creating it
$thirdparty = new Societe($db); $thirdparty = new Societe($db);
$resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc); $resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc);