Skip to content
Snippets Groups Projects
Commit 2d8827a8 authored by falcon's avatar falcon
Browse files

#867920 reported by underoathosx: Fixed problem with open and close dates...

#867920 reported by underoathosx: Fixed problem with open and close dates reverting back when questions are saved
parent eebe06dc
No related branches found
No related tags found
No related merge requests found
......@@ -637,6 +637,7 @@ function quiz_title_callback($quiz_node) {
function _quiz_common_presave_actions(&$node) {
quiz_translate_form_date($node, 'quiz_open');
quiz_translate_form_date($node, 'quiz_close');
if (empty($node->pass_rate)) $node->pass_rate = 0;
if ($node->randomization != 2) $node->number_of_random_questions = 0;
}
......
......@@ -20,12 +20,14 @@
function quiz_translate_form_date(&$node, $date) {
$prefix = $node->$date;
// If we have all the parameters, re-calculate $node->event_$date .
if (isset($prefix['year']) && isset($prefix['month']) && isset($prefix['day'])) {
if (is_array($prefix) && isset($prefix['year']) && isset($prefix['month']) && isset($prefix['day'])) {
// Build a timestamp based on the date supplied and the configured timezone.
$node->$date = _quiz_mktime(0, 0, 0, $prefix['month'], $prefix['day'], $prefix['year'], 0);
}
else {
form_set_error('quiz_open', t('Please supply a valid date.'));
if (!_quiz_is_int($prefix, 1, 21500000000)) {
form_set_error('quiz_open', t('Please supply a valid date.'));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment