Best practice forum (Archived)

Creating Site Events

 
??
Creating Site Events
?? 发表于 2012年04月3日 Tuesday 00:45
 

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.

CogginsSimon
Re: Creating Site Events
CogginsSimon 发表于 2012年04月19日 Thursday 19:03
小组 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
?? 发表于 2012年05月4日 Friday 23:02
 
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