Commit 0b263866 authored by Robert Lyon's avatar Robert Lyon

Bug 1625389: Proper checking of view access start/stop date values

As profile page can have the fields disabled and so don't get passed
to the saving part causing errors before

behatnotneeded

Change-Id: I1a48c5cdf93a20abb69630e6d1e52aaef701eee5
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit c277d5d4)
parent 497bbc83
......@@ -431,13 +431,13 @@ function editaccess_validate(Pieform $form, $values) {
}
// $values['startdate'] and $values['stopdate'] from override
// check if there is a conflict
if (($item['startdate'] && $values['startdate'] && $item['startdate'] < $values['startdate'])
if ((!empty($item['startdate']) && !empty($values['startdate']) && $item['startdate'] < $values['startdate'])
||
($item['stopdate'] && $values['stopdate'] && $values['stopdate'] < $item['stopdate'])
(!empty($item['stopdate']) && !empty($values['stopdate']) && $values['stopdate'] < $item['stopdate'])
||
($item['stopdate'] && $values['startdate'] && $item['stopdate'] < $values['startdate'])
(!empty($item['stopdate']) && !empty($values['startdate']) && $item['stopdate'] < $values['startdate'])
||
($item['startdate'] && $values['stopdate'] && $values['stopdate'] < $item['startdate'])
(!empty($item['startdate']) && !empty($values['stopdate']) && $values['stopdate'] < $item['startdate'])
) {
$SESSION->add_error_msg(get_string('overrideconflict', 'view', $accesstypestrings[$item['type']]));
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