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 PublicAttendeeSubscriptionPage = Public link of registration to a conference
MissingOrBadSecureKey = The security key is invalid or missing MissingOrBadSecureKey = The security key is invalid or missing
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference
EvntOrgStartDuration = This conference starts on EvntOrgDuration = This conference starts on %s and ends on %s
EvntOrgEndDuration = and ends on
ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s
# #
# SubscriptionOk page # SubscriptionOk page

View File

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