wip on getting the existing attendee

This commit is contained in:
Dorian Vabre 2021-04-21 16:37:02 +02:00
parent ebf2466d7b
commit e81637b608
2 changed files with 21 additions and 14 deletions

View File

@ -105,8 +105,7 @@ ViewAndVote = View and vote for suggested events
PublicAttendeeSubscriptionPage = Public link of registration to a conference
MissingOrBadSecureKey = The security key is invalid or missing
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference
EvntOrgStartDuration = This conference starts on
EvntOrgEndDuration = and ends on
EvntOrgDuration = This conference starts on %s and ends on %s
ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s
#
# SubscriptionOk page

View File

@ -284,14 +284,24 @@ if (empty($reshook) && $action == 'add') {
} else {
// creation of an attendee
$confattendee = new ConferenceOrBoothAttendee($db);
$confattendee->fk_soc = $thirdparty->id;
$confattendee->date_subscription = dol_now();
$confattendee->email = GETPOST("email");
$confattendee->fk_actioncomm = $id;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
$error++;
$errmsg .= $confattendee->error;
$resultfetchattendee = $confattendee->fetchAll('','', 1, 0, array('t.fk_soc'=>$thirdparty->id, 't.fk_actioncomm'=>$id));
if ($resultfetchattendee == 0 || count($resultfetchattendee) == 0) {
// Need to create an attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->date_subscription = dol_now();
$confattendee->email = GETPOST("email");
$confattendee->fk_actioncomm = $id;
$resultconfattendee = $confattendee->create($user);
if ($resultconfattendee < 0) {
$error++;
$errmsg .= $confattendee->error;
}
print 'created attendee';
} else {
// Found an attendee
print 'found attendee';
var_dump($resultfetchattendee);
$confattendee = $resultfetchattendee[0];
}
}
}
@ -312,6 +322,7 @@ if (empty($reshook) && $action == 'add') {
$facture->paye = 0;
$facture->date = dol_now();
$facture->cond_reglement_id = $confattendee->cond_reglement_id;
if (empty($facture->cond_reglement_id)) {
$paymenttermstatic = new PaymentTerm($confattendee->db);
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
@ -437,10 +448,7 @@ print '<div class="center subscriptionformhelptext justify">';
// Welcome message
print $langs->trans("EvntOrgWelcomeMessage");
print $id.".".'<br>';
print $langs->trans("EvntOrgStartDuration");
print dol_print_date($conference->datep).' ';
print $langs->trans("EvntOrgEndDuration");
print ' '.dol_print_date($conference->datef).".";
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
print '</div>';
dol_htmloutput_errors($errmsg);