Debug v17

This commit is contained in:
Laurent Destailleur 2023-05-10 04:49:02 +02:00
parent 3880871be7
commit c09b6783a7
3 changed files with 73 additions and 51 deletions

View File

@ -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, '');
}

View File

@ -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"))."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
}
if (!GETPOST("country_id") && !empty(floatval($project->price_booth))) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\n";
}
if (!GETPOST("societe")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
}
if (!GETPOST("label")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
@ -215,44 +227,37 @@ if (empty($reshook) && $action == 'add') {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
}
if (!GETPOST("lastname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."<br>\n";
}
if (!GETPOST("societe")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
}
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
}
if (!GETPOST("country_id") && !empty(floatval($project->price_booth))) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\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)
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 '<div id="divsubscribe">';
print '<br>';
// Event summary
print '<div class="center">';
// Sub banner
print '<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center');
// Welcome message
print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'</span>';
print '<br>';
// Title
print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $project->label).'</span><br>';
print '<br><br>'."\n";
print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage")."</span>\n";
print $project->note_public."\n";
//print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx';
print '</div>';
// Help text
print '<div class="center subscriptionformhelptext">';
print '<div class="justify subscriptionformhelptext">';
if ($project->date_start_event || $project->date_end_event) {
print '<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
@ -590,15 +597,16 @@ if ($project->date_start_event || $project->date_end_event) {
if ($project->location) {
print '<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).'<br>';
}
if ($project->note_public) {
print '<br><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).'</span><br>';
}
print '</div>';
print '<br>';
print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center');
dol_htmloutput_errors($errmsg);
dol_htmloutput_errors($errmsg, $errors);
// Print form
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";

View File

@ -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)
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 '<div id="divsubscribe">';
print '<br>';
// Event summary
print '<div class="center">';
// Sub banner
print '<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center');
// Welcome message
print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'</span>';
print '<br>';
// Title
print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $project->label).'</span><br>';
print '<br><br>'."\n";
print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage")."</span>\n";
print $project->note_public."\n";
//print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx';
print '</div>';
// Help text
print '<div class="center subscriptionformhelptext">';
print '<div class="justify subscriptionformhelptext">';
if ($project->date_start_event || $project->date_end_event) {
print '<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
@ -522,14 +533,14 @@ if ($project->date_start_event || $project->date_end_event) {
if ($project->location) {
print '<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).'<br>';
}
if ($project->note_public) {
print '<br><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).'</span><br>';
}
print '</div>';
print '<br>';
print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center');
dol_htmloutput_errors($errmsg, $errors);