Best practice forum (Archived)

Creating Site Events

 
? ?
Creating Site Events
by ? ? - Tuesday, 3 April 2012, 12:45 AM
 

When I create a site event in Totara 1.1.11.1 I get an error saying that the event start date can't be before the course start date.

This is because $form->timestart isn't created by the time the validation function runs.  I have fixed this by creating $form->timestart in the validation function, but I don't see how this could have ever allowed site-wide events to be created.

Piece of related trivia - the non-existance of $form->timestart  meant that the comparison being done was (NULL < "0") which is true.  If instead it was (NULL < 0) then it would correctly come out as false.

A patch for this is attached, though it may make sense to add this field before the validation function is called rather than temporarily creating it in the validation function and then again once validation has passed.

Simon Coggins
Re: Creating Site Events
by Simon Coggins - Thursday, 19 April 2012, 7:03 PM
Group Totara

Hi Haroon,

It looks like this bug was introduced by a patch which fixed a security issue in calendar events. We fixed it in Totara, and have passed it upstream to Moodle. They caught the same issue you have found and have a patch that's about to get integrated into the next release. The bug is:

http://tracker.moodle.org/browse/MDL-31746

although you may need certain permissions to view it as it's a security issue.

Anyway, I've attached a patch which reverts our fix and applies the moodle one instead, which should resolve this issue and keep us more consistent with upstream.

We'll include this in the next release.

Thanks!

Simon

? ?
Re: Creating Site Events
by ? ? - Friday, 4 May 2012, 11:02 PM
 
I'm pleased to report that the Moodle fix for this issue was included in this week's release of Totara v1.1.15 and v1.0.36