Clean choices when changing format of poll during the creation

This commit is contained in:
Olivier PEREZ 2015-04-22 00:19:12 +02:00
parent 11b2018bd0
commit 7ed21ce9fa
2 changed files with 13 additions and 7 deletions

View File

@ -56,6 +56,12 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
$min_time = time() + 86400;
$max_time = time() + (86400 * $config['default_poll_duration']);
// The poll format is AUTRE (other)
if ($_SESSION['form']->format !== 'A') {
$_SESSION['form']->format = 'A';
$_SESSION['form']->clearChoices();
}
// Step 4 : Data prepare before insert in DB
if (isset($_POST['confirmecreation'])) {
@ -85,9 +91,6 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
$_SESSION['form']->end_date = $max_time;
}
// format du sondage AUTRE
$_SESSION['form']->format = 'A';
// Insert poll in database
$ids = $pollService->createPoll($_SESSION['form']);
$poll_id = $ids[0];
@ -98,7 +101,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || (
if ($config['use_smtp'] === true) {
$message = __('Mail', "This is the message you have to send to the people you want to poll. \nNow, you have to send this message to everyone you want to poll.");
$message .= '<br/><br/>';
$message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title, ENT_QUOTES) . '".<br/>';
$message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title) . '".<br/>';
$message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/>%s';
$message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above");

View File

@ -50,6 +50,12 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
} else {
$min_time = time() + 86400;
// The poll format is DATE
if ($_SESSION['form']->format !== 'D') {
$_SESSION['form']->format = 'D';
$_SESSION['form']->clearChoices();
}
// Step 4 : Data prepare before insert in DB
if (!empty($_POST['confirmation'])) {
@ -144,9 +150,6 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
}
}
//le format du sondage est DATE
$_SESSION['form']->format = 'D';
// Step 3/4 : Confirm poll creation
if (!empty($_POST['choixheures']) && !isset($_SESSION['form']->totalchoixjour)) {