mdjnelson / moodle-mod_customcert

Enables the creation of dynamically generated certificates with complete customisation via the web browser.
https://moodle.org/plugins/mod_customcert
GNU General Public License v3.0
90 stars 158 forks source link

SQL Error when editing the Custom Certificate Activity #520

Closed UncleRaymondo closed 1 year ago

UncleRaymondo commented 1 year ago

Hi @mdjnelson,

I'm not sure if this is because I haven't issued any certificates yet (still designing and testing), but when I edit the Custom Certificate activity, I get the following SQL Error

Error Reading From Database:

Debug info: Unknown column 'uf1d_1.data' in 'field list'
SELECT u.id, u.picture, u.firstname, u.lastname, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.imagealt, u.email, uf1d_1.data AS profile_field_studentid, ci.id as issueid, ci.code, ci.timecreated
FROM mdl_user u
INNER JOIN mdl_customcert_issues ci
ON u.id = ci.userid
WHERE u.deleted = 0
AND ci.customcertid = ?
AND NOT u.id IN (?,?)
ORDER BY CONCAT(firstname, ' ', lastname) LIMIT 0, 50
[array (
0 => '2',
1 => 35,
2 => 13,
)]
Error code: dmlreadexception 
Stack trace:

    line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
    line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
    line 291 of /mod/customcert/classes/certificate.php: call to mysqli_native_moodle_database->get_records_sql()
    line 204 of /mod/customcert/classes/report_table.php: call to mod_customcert\certificate::get_issues()
    line 2091 of /lib/tablelib.php: call to mod_customcert\report_table->query_db()
    line 158 of /mod/customcert/view.php: call to table_sql->out()

Any ideas why this might be the case?

It's visible on the page /mod/customcert/view.php?id=1965&group=0

This is Moodle 3.11.10+ on PHP 7.4

Appreciate the assist :)

Cheers, Ray

leonstr commented 1 year ago

Have you got mod_customcert downloaded from the Moodle plugins directory? Or is it the version from this repo which has additional fixes? Because of the line numbers in the stack trace I suspect it's the former so I suggest trying the version from GitHub.

This issue looks like #465 which is fixed for Moodle 3.11 (but not in the version in the plugins directory). A note of caution: it sounds like this issue has become broken again for Moodle 4.0, see #512.

mdjnelson commented 1 year ago

Closing as I believe @leonstr is correct.