Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Verified Commit a0f99732 authored by David Beniamine's avatar David Beniamine
Browse files

Fix incoherent field name in DB

parent 2fe18c3b
......@@ -15,7 +15,7 @@ namespace mod_labnbook\ar;
class labnbook
{
public $id;
public $courseid;
public $course;
public $name;
public $intro;
public $introformat;
......
......@@ -60,7 +60,7 @@ class helper
if (!fetch\user::isAuthenticated()) {
return;
}
$ids = $DB->get_fieldset_select("labnbook", "labnbook_teamconfigid", "courseid = " . (int) $courseId);
$ids = $DB->get_fieldset_select("labnbook", "labnbook_teamconfigid", "course = " . (int) $courseId);
if ($ids) {
$userFetcher = new fetch\user();
$userFetcher->grantMissionsAccess($ids);
......
......@@ -7,7 +7,7 @@
<TABLE NAME="labnbook" COMMENT="Activity instance (mandatory name of this table)">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="referenced from course_modules.instance"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
......@@ -18,7 +18,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id"/>
<KEY NAME="course" TYPE="foreign" FIELDS="course" REFTABLE="course" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
......
......@@ -17,14 +17,20 @@
*/
function xmldb_labnbook_upgrade($oldversion)
{
/*
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2021010500) {
// Rename field course on table labnbook to NEWNAMEGOESHERE.
$table = new xmldb_table('labnbook');
$field = new xmldb_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'id');
// Launch rename field course.
$dbman->rename_field($table, $field, 'course');
}
// For further information please read the Upgrade API documentation:
// https://docs.moodle.org/dev/Upgrade_API
*/
return true;
}
......@@ -82,8 +82,6 @@ function labnbook_add_instance($moduleinstance, $mform = null)
}
$moduleinstance->timecreated = \time();
// On database field name is courseid not course
$moduleinstance->courseid = (int)$moduleinstance->course;
$id = $DB->insert_record(LABNBOOK_TABLE, $moduleinstance);
return $id;
......
......@@ -9,8 +9,8 @@
\defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_labnbook';
$plugin->release = '0.1.4';
$plugin->version = 2019020102;
$plugin->release = '0.1.4.1';
$plugin->version = 2021010500;
$plugin->requires = 2016120500;
$plugin->maturity = MATURITY_RC;
$plugin->supported = [36];
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