Commit b89da59d authored by Melissa Draper's avatar Melissa Draper
Browse files

Error message changes for invalid dates when setting access



Bug #661596 Based on a patch by Eugene Venter

Change-Id: If64a3436bb3ac1735ac952fe116133a3af74f952
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent 7a121df6
......@@ -41,8 +41,8 @@ $string['description'] = 'Page Description';
$string['startdate'] = 'Access Start Date/Time';
$string['stopdate'] = 'Access End Date/Time';
$string['accessdates'] = 'Access Date/Time';
$string['stopdatecannotbeinpast'] = 'The stop date cannot be in the past';
$string['startdatemustbebeforestopdate'] = 'The start date must be before the stop date';
$string['newstopdatecannotbeinpast'] = 'The end date for \'%s\' access cannot be in the past';
$string['newstartdatemustbebeforestopdate'] = 'The start date for \'%s\' access must be before the end date';
$string['unrecogniseddateformat'] = 'Unrecognised date format';
$string['allowcommentsonview'] = 'If checked, users will be allowed to leave comments.';
$string['ownerformat'] = 'Name display format';
......
......@@ -378,7 +378,7 @@ function editaccess_validate(Pieform $form, $values) {
}
}
if ($values['startdate'] && $values['stopdate'] && $values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('startdatemustbebeforestopdate', 'view'));
$form->set_error('startdate', get_string('newstartdatemustbebeforestopdate', 'view', 'Overriding'));
}
$loggedinaccess = false;
if ($values['accesslist']) {
......@@ -405,12 +405,12 @@ function editaccess_validate(Pieform $form, $values) {
}
$now = strptime(date('Y/m/d H:i'), $dateformat);
if ($item['stopdate'] && ptimetotime($now) > ptimetotime($item['stopdate'])) {
$SESSION->add_error_msg(get_string('stopdatecannotbeinpast', 'view'));
$SESSION->add_error_msg(get_string('newstopdatecannotbeinpast', 'view', get_string($item['type'], 'view')));
$form->set_error('accesslist', '');
break;
}
if ($item['startdate'] && $item['stopdate'] && ptimetotime($item['startdate']) > ptimetotime($item['stopdate'])) {
$SESSION->add_error_msg(get_string('startdatemustbebeforestopdate', 'view'));
$SESSION->add_error_msg(get_string('newstartdatemustbebeforestopdate', 'view', get_string($item['type'], 'view')));
$form->set_error('accesslist', '');
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment