Fix issues with version mis-match and studentscanmark field.
authorDan Marsden <dan@danmarsden.com>
Wed, 19 Nov 2014 21:38:11 +0000 (10:38 +1300)
committerDan Marsden <dan@danmarsden.com>
Wed, 19 Nov 2014 21:38:11 +0000 (10:38 +1300)
db/upgrade.php
version.php

index 579f80f..0d51682 100644 (file)
@@ -34,18 +34,6 @@ function xmldb_attendance_upgrade($oldversion=0) {
 
     $result = true;
 
-    if ($oldversion < 2013082901) {
-        $table = new xmldb_table('attendance_sessions');
-
-        $field = new xmldb_field('studentscanmark');
-        $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-        
-        upgrade_mod_savepoint($result, 2013082901, 'attendance');
-    }
-
     if ($oldversion < 2013082902) {
         // Replace values that reference old module "attforblock" to "attendance".
         $sql = "UPDATE {grade_items}
@@ -85,5 +73,17 @@ function xmldb_attendance_upgrade($oldversion=0) {
         upgrade_plugin_savepoint($result, 2013082902, 'mod', 'attendance');
     }
 
+    if ($oldversion < 2014022803) {
+        $table = new xmldb_table('attendance_sessions');
+
+        $field = new xmldb_field('studentscanmark');
+        $field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0');
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        upgrade_mod_savepoint($result, 2014022803, 'attendance');
+    }
+
     return $result;
 }
index 2c090d2..4922942 100644 (file)
@@ -22,7 +22,7 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-$plugin->version  = 2014022802;
+$plugin->version  = 2014022803;
 $plugin->requires = 2013111800;
 $plugin->release = '2.6.2';
 $plugin->maturity  = MATURITY_STABLE;