From d9513da8de4670dc058f4949be65a63941146e6a Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 12 Apr 2021 17:05:09 +0200 Subject: [PATCH] email now required in the attendee_subscription page, company name no longer required. Check on existing third party now depends on the email. todo: what if the name is empty? --- .../attendee_subscription.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) 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 ''."\n"; +// Email +print ''."\n"; // Company -print ''."\n"; +print ''."\n"; // Address print ''."\n"; @@ -343,7 +350,7 @@ print ' / '; print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); print ''; // Country -print ''; } -// Email -print ''."\n"; 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").' *
\n";