Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.9.1
-
Fix Version/s: None
-
Component/s: Module: Certificate
-
Labels:None
-
Environment:HideMoodle 1.9.2+ (Build: 20080903)
Windows Server 2003 SP2 Std Edition
IIS 6 (6.0.3790.3959)
PHP 5.2.6
FastCGI
ODBTP 1.1.4
MS SQL Server 2005 SP2 Std Edition (9.00.1399.00)
Certificate Module
Certificate - Site Wide Report (080513)ShowMoodle 1.9.2+ (Build: 20080903) Windows Server 2003 SP2 Std Edition IIS 6 (6.0.3790.3959) PHP 5.2.6 FastCGI ODBTP 1.1.4 MS SQL Server 2005 SP2 Std Edition (9.00.1399.00) Certificate Module Certificate - Site Wide Report (080513)
-
Database:Microsoft SQL
-
Affected Branches:MOODLE_19_STABLE
Description
I've added the My Certificates block to my Moodle front page. When I click the View Certificates link in that block the My Certificates: Certificates Report is displayed with the following error:
[42000][209][SQL Server][Level 16, State 1, Server MyMoodleServer, Line 1]Ambiguous column name 'classname'.
SELECT s.*,a.reportcert, a.name, s.classname, s.code, s.certdate, s.reportgrade, u.firstname, u.lastname FROM mdl_certificate_issues s, mdl_certificate a, mdl_user u WHERE s.certificateid = a.id AND u.id = s.userid AND a.reportcert = 1 AND s.certdate > 0 ORDER BY classname ASC
line 686 of lib\dmllib.php: call to debugging()
line 966 of lib\dmllib.php: call to get_recordset_sql()
line 98 of certificates\lib.php: call to get_records_sql()
line 188 of certificates\report.php: call to certificate_report_table()
The cause of this error seems to be a missing table identifier in the ORDER BY clause. If I add the table identifier to the SELECT statement the error does not occur. In other words, if I change the ORDER BY statement from this:
ORDER BY classname ASC
to this:
ORDER BY s.classname ASC
the error does not trigger and the issued certificates are displayed correctly.
The problem is in line 90 of the \certificates\lib.php file:
$sort = ' ORDER BY '.$sort;
should be:
$sort = ' ORDER BY s.'.$sort;
My server setup:
Moodle 1.9.2+ (Build: 20080903)
Windows Server 2003 SP2 Std Edition
IIS 6 (6.0.3790.3959)
PHP 5.2.6
FastCGI
ODBTP 1.1.4
MS SQL Server 2005 SP2 Std Edition (9.00.1399.00)
Certificate Module
Certificate - Site Wide Report (080513)
Activity
- All
- Comments
- History
- Activity
- Source
- Test Sessions
Thanks for the report Luis, I will look into it.