Commit 948c4706 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1558883: Conflict check for access and overriding dates

Added a control in view/share screen to see
if there is a conflict between the access permission dates
and the overriding dates.
There is no conflict only when overriding dates contain
any other access dates.


Change-Id: Id6082f314d1e30b3e8bf1cc7d5532afa0ff87c42
parent b3582257
......@@ -29,6 +29,7 @@ $string['userviewurltaken'] = 'This URL is already taken. Please choose an
$string['description'] = 'Page description';
$string['startdate'] = 'Access start date/time';
$string['stopdate'] = 'Access end date/time';
$string['overrideconflict'] = 'One or more access permissions are in conflict with the overriding dates. These access permissions will not be valid outside the overriding dates.';
$string['stopdatecannotbeinpast1'] = '"To" date cannot be in the past';
$string['startdatemustbebeforestopdate'] = 'Start date must be before stop date';
$string['newstopdatecannotbeinpast'] = 'The end date for \'%s\' access cannot be in the past.';
......@@ -427,6 +427,19 @@ function editaccess_validate(Pieform $form, $values) {
$form->set_error('accesslist', '');
// $values['startdate'] and $values['stopdate'] from override
// check if there is a conflict
if (($item['startdate'] && $values['startdate'] && $item['startdate'] < $values['startdate'])
($item['stopdate'] && $values['stopdate'] && $values['stopdate'] < $item['stopdate'])
($item['stopdate'] && $values['startdate'] && $item['stopdate'] < $values['startdate'])
($item['startdate'] && $values['stopdate'] && $values['stopdate'] < $item['startdate'])
) {
$SESSION->add_error_msg(get_string('overrideconflict', 'view', $accesstypestrings[$item['type']]));
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