Commit 1ba309d9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix error messages for group access dates (bug #894592)



These were using undefined strings and gave messages like "The end
date for '[[group/view]]' access cannot be in the past".

Change-Id: If087014fc608747eee8c9533e36df1fd90856456
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent f402e251
......@@ -421,6 +421,16 @@ function editaccess_validate(Pieform $form, $values) {
if ($values['startdate'] && $values['stopdate'] && $values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('newstartdatemustbebeforestopdate', 'view', 'Overriding'));
}
$accesstypestrings = array(
'public' => get_string('public', 'view'),
'loggedin' => get_string('loggedin', 'view'),
'friends' => get_string('friends', 'view'),
'user' => get_string('user', 'group'),
'group' => get_string('group', 'group'),
'institution' => get_string('institution'),
);
$loggedinaccess = false;
if ($values['accesslist']) {
$dateformat = get_string('strftimedatetimeshort');
......@@ -446,12 +456,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('newstopdatecannotbeinpast', 'view', get_string($item['type'], 'view')));
$SESSION->add_error_msg(get_string('newstopdatecannotbeinpast', 'view', $accesstypestrings[$item['type']]));
$form->set_error('accesslist', '');
break;
}
if ($item['startdate'] && $item['stopdate'] && ptimetotime($item['startdate']) > ptimetotime($item['stopdate'])) {
$SESSION->add_error_msg(get_string('newstartdatemustbebeforestopdate', 'view', get_string($item['type'], 'view')));
$SESSION->add_error_msg(get_string('newstartdatemustbebeforestopdate', 'view', $accesstypestrings[$item['type']]));
$form->set_error('accesslist', '');
break;
}
......
Markdown is supported
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