moodle-mod_customcert icon indicating copy to clipboard operation
moodle-mod_customcert copied to clipboard

Error reading from DB Unknown column 'uf1d_1.data' in 'field list'

Open VictorBenet opened this issue 4 years ago • 8 comments

When reviewing the certificate for a given course is showing an error: image

With the debug mode we got the following:

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, u.department, u.country, uf1d_1.data AS profile_field_Organization, uf1d_2.data AS profile_field_Department, uf1d_3.data AS profile_field_Additional_Phone, uf1d_4.data AS profile_field_Additional_email, 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 => '1',
1 => 11,
2 => 9,
3 => 3,
4 => 13,
5 => 10,
6 => 15,
7 => 16,
8 => 4,
9 => 2,
10 => 4,
11 => 6,
)]
Error code: dmlreadexception

Seems it is not getting the custom fields added to the profile

VictorBenet avatar Jul 22 '21 08:07 VictorBenet

Can you please provide replication steps?

mdjnelson avatar Jul 23 '21 05:07 mdjnelson

What version of Moodle and the plugin are you using?

mdjnelson avatar Jul 23 '21 05:07 mdjnelson

Just noting this may be due to https://github.com/mdjnelson/moodle-mod_customcert/issues/423.

mdjnelson avatar Jul 23 '21 06:07 mdjnelson

We're using moodle 3.11, to be precise: version 3.11+ (Build: 20210617) (2021051700.07) Whenever custom profile fields are added to the show user identity, the issue appears: image

When the fields are removed, the issue is no longer present, when enabling the debug mode developer we can see the query posted on top and you can see it misses the uf1d_1 table in the FROM clause and the proper join

VictorBenet avatar Jul 23 '21 08:07 VictorBenet

Thanks @VictorBenet, will take a look when I get the chance. If you can provide a patch that would be great.

mdjnelson avatar Jul 27 '21 01:07 mdjnelson

I tried to replicate this and it all works fine in 3.11, 3.10 and 3.9 which are the currently supported versions. Please update to resolve this.

mdjnelson avatar Sep 28 '21 12:09 mdjnelson

Reopened due to https://moodle.org/mod/forum/discuss.php?d=428088.

mdjnelson avatar Oct 17 '21 09:10 mdjnelson

Closing again. See https://github.com/mdjnelson/moodle-mod_customcert/issues/465 which has a solution.

mdjnelson avatar Oct 17 '21 10:10 mdjnelson