diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index d0a3bb81d74..72e486a67f4 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -34,6 +34,9 @@ if (!defined('NOIPCHECK')) { if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} // For MultiCompany module. @@ -626,7 +629,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); } diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 772822374d4..d59cba09779 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -84,7 +84,7 @@ if ($resultproject < 0) { } // Security check -$securekeyreceived = GETPOST("securekey"); +$securekeyreceived = GETPOST('securekey', 'alpha'); $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5'); if ($securekeytocompare != $securekeyreceived) { @@ -203,10 +203,22 @@ if (empty($reshook) && $action == 'add') { $db->begin(); + if (!GETPOST("lastname")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; + } if (!GETPOST("email")) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; } + if (!GETPOST("country_id") && !empty(floatval($project->price_booth))) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; + } + if (!GETPOST("societe")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; + } if (!GETPOST("label")) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."
\n"; @@ -215,44 +227,37 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
\n"; } - if (!GETPOST("email")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; - } - if (!GETPOST("lastname")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; - } - 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") && !empty(floatval($project->price_booth))) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; - } if (!$error) { // Getting the thirdparty or creating it $thirdparty = new Societe($db); $resultfetchthirdparty = $thirdparty->fetch('', $societe); - if ($resultfetchthirdparty<=0) { - // Need to create a new one (not found or multiple with the same name) - $thirdparty->name = $societe; + if ($resultfetchthirdparty < 0) { + // If an error was found + $error++; + $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); + } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected + // Creation of a new thirdparty + if (!empty($societe)) { + $thirdparty->name = $societe; + } else { + $thirdparty->name = $genericcompanyname; + } $thirdparty->address = GETPOST("address"); $thirdparty->zip = GETPOST("zipcode"); $thirdparty->town = GETPOST("town"); - $thirdparty->client = 2; + $thirdparty->client = $thirdparty::PROSPECT; $thirdparty->fournisseur = 0; $thirdparty->country_id = GETPOST("country_id", 'int'); $thirdparty->state_id = GETPOST("state_id", 'int'); - $thirdparty->email = $email; + $thirdparty->email = ($emailcompany ? $emailcompany : $email); // Load object modCodeTiers $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); @@ -276,6 +281,7 @@ if (empty($reshook) && $action == 'add') { if ($readythirdparty <0) { $error++; $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); } else { $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); @@ -549,18 +555,19 @@ print '
'; print '
'; -// Event summary -print '
'; +// Sub banner +print '
'; +print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); +// Welcome message +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").''; +print '
'; +// Title print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; -print '

'."\n"; -print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -print $project->note_public."\n"; -//print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; // Help text -print '
'; +print '
'; if ($project->date_start_event || $project->date_end_event) { print '
'; @@ -590,15 +597,16 @@ if ($project->date_start_event || $project->date_end_event) { if ($project->location) { print ''.dol_escape_htmltag($project->location).'
'; } +if ($project->note_public) { + print '
'.dol_htmlentitiesbr($project->note_public).'
'; +} print '
'; print '
'; -print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center'); - -dol_htmloutput_errors($errmsg); +dol_htmloutput_errors($errmsg, $errors); // Print form print '
'."\n"; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 77196c8c6fa..8fe19b940d8 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -85,7 +85,7 @@ if ($resultproject < 0) { } // Security check -$securekeyreceived = GETPOST("securekey"); +$securekeyreceived = GETPOST('securekey', 'alpha'); $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5'); if ($securekeytocompare != $securekeyreceived) { @@ -239,17 +239,26 @@ if (empty($reshook) && $action == 'add') { $thirdparty = new Societe($db); $resultfetchthirdparty = $thirdparty->fetch('', $societe); - if ($resultfetchthirdparty<=0) { - // Need to create a new one (not found or multiple with the same name) - $thirdparty->name = $societe; + if ($resultfetchthirdparty < 0) { + // If an error was found + $error++; + $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); + } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected + // Creation of a new thirdparty + if (!empty($societe)) { + $thirdparty->name = $societe; + } else { + $thirdparty->name = $genericcompanyname; + } $thirdparty->address = GETPOST("address"); $thirdparty->zip = GETPOST("zipcode"); $thirdparty->town = GETPOST("town"); - $thirdparty->client = 2; + $thirdparty->client = $thirdparty::PROSPECT; $thirdparty->fournisseur = 0; $thirdparty->country_id = GETPOST("country_id", 'int'); $thirdparty->state_id = GETPOST("state_id", 'int'); - $thirdparty->email = $email; + $thirdparty->email = ($emailcompany ? $emailcompany : $email); // Load object modCodeTiers $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); @@ -273,6 +282,7 @@ if (empty($reshook) && $action == 'add') { if ($readythirdparty <0) { $error++; $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); } else { $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); @@ -420,7 +430,7 @@ if (empty($reshook) && $action == 'add') { // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF; + $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } @@ -458,7 +468,7 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $db->commit(); $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl); Header("Location: ".$redirection); exit; } else { @@ -482,17 +492,18 @@ print '
'; print '
'; -// Event summary -print '
'; +// Sub banner +print '
'; +print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); +// Welcome message +print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").''; +print '
'; +// Title print ''.dol_escape_htmltag($project->title . ' '. $project->label).'
'; -print '

'."\n"; -print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage")."\n"; -print $project->note_public."\n"; -//print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx'; print '
'; // Help text -print '
'; +print '
'; if ($project->date_start_event || $project->date_end_event) { print '
'; @@ -522,14 +533,14 @@ if ($project->date_start_event || $project->date_end_event) { if ($project->location) { print ''.dol_escape_htmltag($project->location).'
'; } +if ($project->note_public) { + print '
'.dol_htmlentitiesbr($project->note_public).'
'; +} print '
'; print '
'; -print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); - - dol_htmloutput_errors($errmsg, $errors);