diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php
index 800c6dc469d..bd655362a3d 100644
--- a/htdocs/public/eventorganization/attendee_subscription.php
+++ b/htdocs/public/eventorganization/attendee_subscription.php
@@ -77,6 +77,7 @@ $action = GETPOST('action', 'aZ09');
$key = 'DV3PH';
$id = dol_decode(GETPOST('id'), $key);
+$email = GETPOST("email");
// Securekey check
$securekey = GETPOST('securekey', 'alpha');
@@ -186,21 +187,24 @@ if (empty($reshook) && $action == 'add') {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n";
}
- if (!GETPOST("societe")) {
+ /*if (!GETPOST("societe")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n";
- }
+ }*/
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n";
}
+ if (!GETPOST("country_id")) {
+ $error++;
+ $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n";
+ }
if (!$error) {
- // Vérifier si client existe
+ // Vérifier si client existe par l'email
$thirdparty = new Societe($db);
- $nomsociete = GETPOST("societe");
- $resultfetchthirdparty = $thirdparty->fetch('', $nomsociete);
+ $resultfetchthirdparty = $thirdparty->fetch('','','','','','','','','','',$email);
if ($resultfetchthirdparty<0) {
$error++;
@@ -208,7 +212,7 @@ if (empty($reshook) && $action == 'add') {
$readythirdparty = -1;
} elseif ($resultfetchthirdparty==0) {
// creation of a new thirdparty
- $thirdparty->name = $nomsociete;
+ $thirdparty->name = GETPOST("societe");
$thirdparty->address = GETPOST("address");
$thirdparty->zip = GETPOST("zipcode");
$thirdparty->town = GETPOST("town");
@@ -216,6 +220,7 @@ if (empty($reshook) && $action == 'add') {
$thirdparty->fournisseur = 0;
$thirdparty->country_id = GETPOST("country_id", 'int');
$thirdparty->state_id = GETPOST("state_id", 'int');
+ $thirdparty->email = $email;
// Load object modCodeTiers
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
@@ -331,8 +336,10 @@ jQuery(document).ready(function () {
print '
| '.$langs->trans("Email").' * | |
| '.$langs->trans("Company").' * | |
| '.$langs->trans("Company").' | |
| '.$langs->trans("Address").' | '."\n"; print ' |
| '.$langs->trans('Country').' | '; +print ' |
| '.$langs->trans('Country').'*'.' | '; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); @@ -372,8 +379,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { } print ' |
| '.$langs->trans("Email").' * |