Commit 9ec81780 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1728815: Not include the logoxs column in sql query until it exists"

parents cdc11013 35d46f1d
......@@ -1787,8 +1787,16 @@ function load_user_institutions($userid) {
throw new InvalidArgumentException("couldn't load institutions, no user id specified");
}
$userid = (int) $userid;
require_once('ddl.php');
$table = new XMLDBTable('institution');
$field = new XMLDBField('logoxs');
$logoxs = field_exists($table, $field) ? ',i.logoxs' : '';
if ($userid !== 0 && $institutions = get_records_sql_assoc('
SELECT u.institution,'.db_format_tsfield('ctime').','.db_format_tsfield('u.expiry', 'membership_expiry').',u.studentid,u.staff,u.admin,i.displayname,i.theme,i.registerallowed, i.showonlineusers,i.allowinstitutionpublicviews, i.logo, i.logoxs, i.style, i.licensemandatory, i.licensedefault, i.dropdownmenu, i.skins, i.suspended
SELECT u.institution, ' . db_format_tsfield('ctime') . ',' . db_format_tsfield('u.expiry', 'membership_expiry') . ',
u.studentid, u.staff, u.admin, i.displayname, i.theme, i.registerallowed, i.showonlineusers,
i.allowinstitutionpublicviews, i.logo' . $logoxs . ', i.style, i.licensemandatory, i.licensedefault,
i.dropdownmenu, i.skins, i.suspended
FROM {usr_institution} u INNER JOIN {institution} i ON u.institution = i.name
WHERE u.usr = ? ORDER BY i.priority DESC', array($userid))) {
return $institutions;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment