diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 863cec82164..6ef39e81ff6 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -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 diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 91bc2da646b..2bacd3a1951 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -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 '