Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32827 calendar: Fixining calender entries with no eventtype

  • Loading branch information...
commit 3713514b086017a87859539dad4064138afc4bb7 1 parent 55a568f
Ankit Agarwal ankitagarwal authored
Showing with 22 additions and 2 deletions.
  1. +21 −1 lib/db/upgrade.php
  2. +1 −1  version.php
22 lib/db/upgrade.php
View
@@ -85,7 +85,7 @@
* @return bool always true
*/
function xmldb_main_upgrade($oldversion) {
- global $CFG, $USER, $DB, $OUTPUT;
+ global $CFG, $USER, $DB, $OUTPUT, $SITE;
require_once($CFG->libdir.'/db/upgradelib.php'); // Core Upgrade-related functions
@@ -1069,5 +1069,25 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012072401.00);
}
+ if ($oldversion < 2012072600.01) {
+ $rs = $DB->get_recordset('event', array( 'eventtype' => ''), '', 'id, courseid, groupid, userid, modulename');
+ foreach ($rs as $event) {
+ if ($event->courseid == $SITE->id) { // Site event
+ $DB->set_field('event', 'eventtype', 'site', array('id' => $event->id));
+ } else if ($event->courseid != 0 && $event->groupid == 0 && ($event->modulename == 'assignment' || $event->modulename == 'assign')) {
+ // Course assingment event
+ $DB->set_field('event', 'eventtype', 'due', array('id' => $event->id));
+ } else if ($event->courseid != 0 && $event->groupid == 0) { // Course event
+ $DB->set_field('event', 'eventtype', 'course', array('id' => $event->id));
+ } else if ($event->groupid) { // Group event
+ $DB->set_field('event', 'eventtype', 'group', array('id' => $event->id));
+ } else if ($event->userid) { // User event
+ $DB->set_field('event', 'eventtype', 'user', array('id' => $event->id));
+ }
+ }
+ $rs->close();
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2012072600.01);
+ }
return true;
}
2  version.php
View
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012072600.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2012072600.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes
Please sign in to comment.
Something went wrong with that request. Please try again.