moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

MDL 2.8 f.id dml error #43

Closed aspark21 closed 9 years ago

aspark21 commented 9 years ago

Moodle version: 2.8.3+ ForumNG - Latest Master Branch as of today Database: MySQL 5.5

Should this be f_id instead or is this another MySQL error?

Debug info: Unknown column 'f.id' in 'where clause'

SELECT f.id as f_id,f.course as f_course,f.name as f_name,f.type as f_type,f.intro as f_intro,f.ratingscale as f_ratingscale,f.ratingfrom as f_ratingfrom,f.ratinguntil as f_ratinguntil,f.grading as f_grading,f.attachmentmaxbytes as f_attachmentmaxbytes,f.reportingemail as f_reportingemail,f.subscription as f_subscription,f.feedtype as f_feedtype,f.feeditems as f_feeditems,f.maxpostsperiod as f_maxpostsperiod,f.maxpostsblock as f_maxpostsblock,f.postingfrom as f_postingfrom,f.postinguntil as f_postinguntil,f.typedata as f_typedata,f.magicnumber as f_magicnumber,f.originalcmid as f_originalcmid,f.shared as f_shared,f.canpostanon as f_canpostanon,f.tags as f_tags,f.enableratings as f_enableratings, cm.id as cm_id,cm.course as cm_course,cm.module as cm_module,cm.instance as cm_instance,cm.section as cm_section,cm.added as cm_added,cm.score as cm_score,cm.indent as cm_indent,cm.visible as cm_visible,cm.visibleold as cm_visibleold,cm.groupmode as cm_groupmode,cm.groupingid as cm_groupingid,cm.idnumber as cm_idnumber,cm.completion as cm_completion,cm.completiongradeitemnumber as cm_completiongradeitemnumber,cm.completionview as cm_completionview,cm.completionexpected as cm_completionexpected, c.id as c_id,c.shortname as c_shortname,c.fullname as c_fullname,c.format as c_format, (SELECT COUNT(1) FROM mdl_forumng_discussions cfd WHERE cfd.forumngid = f.id AND cfd.deleted = 0 AND ( ((cfd.timestart = 0 OR cfd.timestart <= ?) AND (cfd.timeend = 0 OR cfd.timeend > ?)) OR (cfd.forumngid = ?) ) ) AS f_numdiscussions, (EXISTS (SELECT 1 FROM (SELECT fd.id, fr.time FROM mdl_forumng_discussions fd INNER JOIN mdl_forumng_posts fplast ON fd.lastpostid = fplast.id INNER JOIN mdl_forumng_posts fpfirst ON fd.postid = fpfirst.id LEFT JOIN mdl_forumng_read fr ON fd.id = fr.discussionid AND fr.userid = ? WHERE fd.forumngid = f.id AND fplast.modified > ? AND ( (fd.groupid IS NULL) OR ((1=0)) OR cm.groupmode = 2 OR (fd.forumngid = ?) ) AND fd.deleted = 0 AND ( ((fd.timestart = 0 OR fd.timestart <= ?) AND (fd.timeend = 0 OR fd.timeend > ?)) OR (fd.forumngid = ?) ) AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid <> ?) OR fplast.userid <> ?) AND (fr.time IS NULL OR fplast.modified > fr.time)

) discussions ))AS f_hasunreaddiscussions FROM mdl_forumng f INNER JOIN mdl_course_modules cm ON cm.instance = f.id AND cm.module = (SELECT id from mdl_modules WHERE name = 'forumng') INNER JOIN mdl_course c ON c.id = f.course WHERE f.course = ? AND cm.id = ? ORDER BY LOWER(f.name) [array ( 0 => 1425646852, 1 => 1425646852, 2 => '1', 3 => '2', 4 => 1420462852, 5 => '1', 6 => 1425646852, 7 => 1425646852, 8 => '1', 9 => '2', 10 => '2', 11 => '2', 12 => '2', )] Error code: dmlreadexception Stack trace: line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 3362 of /mod/forumng/mod_forumng.php: call to mysqli_native_moodle_database->get_records_sql() line 3071 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 435 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 2020 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2052 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1353 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1165 of /lib/modinfolib.php: call to cm_info->get_after_link() line 993 of /course/renderer.php: call to cm_info->__get() line 916 of /course/renderer.php: call to core_course_renderer->course_section_cm() line 1085 of /course/renderer.php: call to core_course_renderer->course_section_cm_list_item() line 767 of /course/format/renderer.php: call to core_course_renderer->course_section_cm_list() line 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page() line 281 of /course/view.php: call to require()

jason-platts commented 9 years ago

This will be in 2.7 latest version also...

I'll try and check on mysql - though I don't fancy changing this query as it was a nightmare to get right so hopefully there can be something simple changed to make it work OK.

gbowman85 commented 9 years ago

Just to confirm, I have the same issue with Moodle 2.8.3 and MySQL 5.5.38

gbowman85 commented 9 years ago

Is it related to this?: https://tracker.moodle.org/plugins/servlet/mobile#issue/CONTRIB-3480

jason-platts commented 9 years ago

This should be OK now in the master branch.

https://github.com/moodleou/moodle-mod_forumng/commit/9b3cb967177ab337eb0a5bf04ae4a2c0fd0655dd

gbowman85 commented 9 years ago

Confirmed working! Thanks

Graham

On Mon, Mar 9, 2015 at 12:50 PM, Jason Platts notifications@github.com wrote:

Closed #43.

Reply to this email directly or view it on GitHub: https://github.com/moodleou/moodle-mod_forumng/issues/43#event-248491951