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 d34a6717 authored by David Beniamine's avatar David Beniamine
Browse files

Fix incoherent field name in DB

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