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 '