Fix online registration

This commit is contained in:
Laurent Destailleur 2021-09-14 21:12:11 +02:00
parent 81863e45f4
commit 3f2f6c3ed3
4 changed files with 20 additions and 17 deletions

View File

@ -418,15 +418,15 @@ class ConferenceOrBoothAttendee extends CommonObject
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.rowid' || $key == 't.fk_soc' || $key == 't.fk_project' || $key == 't.fk_actioncomm') {
$sqlwhere[] = $key.'='.$value;
$sqlwhere[] = $key.'='.((int) $value);
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
} else {
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
}
}
}

View File

@ -513,7 +513,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
print "</td></tr>";
}
print '<tr><td>';
print '<tr><td class="nowrap">';
$typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : '');
$htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp");
print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext);

View File

@ -142,17 +142,10 @@ VoteOk = Your vote has been accepted.
AlreadyVoted = You have already voted for this event.
VoteError = An error has occurred during the vote, please try again.
#
# SubscriptionOk page
#
SubscriptionOk = Your subscription has been validated
#
# Subscription validation mail
#
SubscriptionOk = Your registration has been validated
ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an event
#
# Payment page
#
Attendee = Attendee
PaymentConferenceAttendee = Conference attendee payment
PaymentBoothLocation = Booth location payment
RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email <b>%s</b>

View File

@ -279,10 +279,16 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// At this point, we have an existing $confattendee. It may not be linked to a thirdparty.
//var_dump($confattendee);
// If the attendee has already been paid
if (!empty($confattendee->date_subscription)) {
$securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
// If the registration has already been paid for this attendee
if (!empty($confattendee->date_subscription) && !empty($confattendee->amount)) {
$securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'master');
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl);
$mesg = $langs->trans("RegistrationAndPaymentWereAlreadyRecorder", $email);
setEventMessages($mesg, null, 'mesgs');
$db->commit();
Header("Location: ".$redirection);
exit;
}
@ -359,6 +365,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
$thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
// Update attendee country to match country of thirdparty
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
}
@ -370,6 +377,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$outputlangs = $langs;
// TODO Use default language of $thirdparty->default_lang to build $outputlang
// Get product to use for invoice
$productforinvoicerow = new Product($db);
$productforinvoicerow->id = 0;
@ -378,6 +386,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION);
}
// Create invoice
if ($resultprod < 0) {
$error++;
$errmsg .= $productforinvoicerow->error;
@ -442,6 +451,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$redirection .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
}
}
Header("Location: ".$redirection);
exit;
} else {