Non-core contributed modules

Unable to view the "My Certificates: Certificates Report". The report crashes with a Ambiguous column name 'classname' error.

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.9.1
  • Fix Version/s: None
  • Component/s: Module: Certificate
  • Labels:
    None
  • Environment:
  • 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

Hide
Chardelle Busch added a comment -

Thanks for the report Luis, I will look into it.

Show
Chardelle Busch added a comment - Thanks for the report Luis, I will look into it.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: