Dataform (plugin)

Errors on Moodle 3.5

 
My Hero
Errors on Moodle 3.5
Plugin developers

I am trying to update a site to moodle 3.5 and the dataform activity is used to a very large degree.  I tried installing it on a test site running M3.5 and php 7.0 and had issues with restoring a backed up dataform.

When trying to restore a dataform, I keep getting the error 

Backup is missing XML file: [tempdir]/backup//282deaebb9cfb4f1d105244d700863e9/activities/dataform_5/grades.xml

More information about this error
Debug info:
Error code: missing_moodle_backup_xml_file
Stack trace:

    line 80 of /backup/util/plan/restore_structure_step.class.php: restore_step_exception thrown
    line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
    line 210 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
    line 178 of /backup/util/plan/base_plan.class.php: call to restore_activity_task->execute()
    line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
    line 339 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
    line 224 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
    line 135 of /backup/restore.php: call to restore_ui->execute()

So I created a few dummy xml files for grades.xml, grade_histories.xml, grading.xml, and assign.xml, rezipped it, and I was able to restore it.

However, once I restored it, I am not able to view it:

Error reading from database

More information about this error
Debug info: Unknown column 'e.type' in 'field list'
SELECT e.id, e.dataid, e.state, e.timecreated, e.timemodified, e.userid, e.groupid, e.type , u.id AS uid ,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email,u.idnumber,u.username FROM webfored_dataform_entries e JOIN webfored_user u ON u.id = e.userid LEFT JOIN webfored_dataform_contents c34 ON c34.fieldid = 34 AND c34.entryid = e.id JOIN webfored_dataform_contents c31 ON c31.entryid = e.id AND c31.fieldid = 31 WHERE e.dataid = ? AND c31.content = ? ORDER BY CAST(c34.content AS DECIMAL(65,7)) ASC
[array (
0 => '8',
1 => '#1#',
)]
Error code: dmlreadexception
Stack trace:

    line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 1245 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
    line 234 of /mod/dataform/classes/entry_manager.php: call to mysqli_native_moodle_database->get_records_sql()
    line 142 of /mod/dataform/classes/entry_manager.php: call to mod_dataform_entry_manager->fetch_entries()
    line 332 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform_entry_manager->set_content()
    line 315 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform\pluginbase\dataformview->set_entries_content()
    line 466 of /mod/dataform/classes/dataform.php: call to mod_dataform\pluginbase\dataformview->display()
    line 71 of /mod/dataform/view.php: call to mod_dataform_dataform->display()

Any suggestions?

 
Average of ratings: -
Picture of Hartmut Scherer
Re: Errors on Moodle 3.5
 

Hi Paul,

I am glad you are testing Dataform with Moodle 3.5. We are still on Moodle 3.3 and I do not have a test site with Moodle 3.5. 

Julian Rubisch also faced the problem with the "Unknown column 'e.type' in 'field list.'" HERE is his solution for Moodle 3.3.4. His solution may also work in Moodle 3.5.

With kind regards,

Hartmut

 
Average of ratings: -
My Hero
Re: Errors on Moodle 3.5
Plugin developers

I found that after trying to apply the fix that you mentioned above, it turns out there are quite a few references to 'e.type' and removing all of them seemed problematic.

Instead, I remember reading somewhere (can't remember where) about someone adding in the 'type' field in the mdl_dataform_entries table.  I tried it and it (so far) seems to work.

Here is the SQL for those interested:

ALTER TABLE `mdl_dataform_entries` ADD `type` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `state`;

 
Average of ratings: -
Picture of Van Romine
Re: Errors on Moodle 3.5
 

I have been successfully using dataforms in Moodle 3.4.4 for several weeks.... I just upgraded to 3.5.1. No errors. My configuration is:

  • Moodle 3.5.1
  • PHP 7.2.9 (with mcrypt added through PECL) 

https://lukasmestan.com/install-mcrypt-extension-in-php7-2/


HTH


 
Average of ratings: -