Commit 84bc0401 authored by Ivo Fokkema's avatar Ivo Fokkema

Reverted changes made for supporting full_group_by in columns.php.

- Don't pull out extra fields out of the database, just because we're sorting on it.
- Don't sort on a field alias if you can sort on the actual fields.
parent f32aa33f
......@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-03-04
* Modified : 2018-01-26
* For LOVD : 3.0-21
* Modified : 2019-08-07
* For LOVD : 3.0-22
*
* Copyright : 2004-2018 Leiden University Medical Center; http://www.LUMC.nl/
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
* Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl>
......@@ -1408,7 +1408,7 @@ if (PATH_COUNT > 2 && ACTION == 'add') {
$nPossibleTargets = count($aPossibleTargets);
} elseif ($sCategory == 'Phenotype') {
// Retrieve list of diseases which do NOT have this column yet.
$sSQL = 'SELECT DISTINCT d.id, IF(CASE d.symbol WHEN "-" THEN "" ELSE d.symbol END = "", d.name, CONCAT(d.symbol, " (", d.name, ")")), d.symbol, d.name FROM ' . TABLE_DISEASES . ' AS d LEFT JOIN ' . TABLE_GEN2DIS . ' AS g2d ON (d.id = g2d.diseaseid) LEFT JOIN ' . TABLE_SHARED_COLS . ' AS c ON (d.id = c.diseaseid AND c.colid = ?) WHERE c.colid IS NULL';
$sSQL = 'SELECT DISTINCT d.id, IF(CASE d.symbol WHEN "-" THEN "" ELSE d.symbol END = "", d.name, CONCAT(d.symbol, " (", d.name, ")")) FROM ' . TABLE_DISEASES . ' AS d LEFT JOIN ' . TABLE_GEN2DIS . ' AS g2d ON (d.id = g2d.diseaseid) LEFT JOIN ' . TABLE_SHARED_COLS . ' AS c ON (d.id = c.diseaseid AND c.colid = ?) WHERE c.colid IS NULL';
$aSQL = array($zData['id']);
if ($_AUTH['level'] < LEVEL_MANAGER) {
// Maybe a JOIN would be simpler?
......@@ -1747,7 +1747,7 @@ if (PATH_COUNT > 2 && ACTION == 'remove') {
} elseif ($sCategory == 'Phenotype') {
// Retrieve list of diseases that DO HAVE this column and you are authorized to remove columns from.
$sSQL = 'SELECT DISTINCT d.id, CONCAT(d.symbol, " (", d.name, ")") AS symbol_name FROM ' . TABLE_DISEASES . ' AS d INNER JOIN ' . TABLE_SHARED_COLS . ' AS sc ON (d.id = sc.diseaseid AND sc.colid = ?)';
$sSQL = 'SELECT DISTINCT d.id, CONCAT(d.symbol, " (", d.name, ")") FROM ' . TABLE_DISEASES . ' AS d INNER JOIN ' . TABLE_SHARED_COLS . ' AS sc ON (d.id = sc.diseaseid AND sc.colid = ?)';
$aSQL = array($zData['id']);
if ($_AUTH['level'] < LEVEL_MANAGER) {
// FIXME: Before today (2013-06-24), this code contained a check if the column had values or not. Removal was then disallowed. Perhaps we should be checking here if there are values in
......@@ -1755,7 +1755,7 @@ if (PATH_COUNT > 2 && ACTION == 'remove') {
$sSQL .= ' LEFT OUTER JOIN ' . TABLE_GEN2DIS . ' AS g2d ON (d.id = g2d.diseaseid) WHERE g2d.geneid IN (?' . str_repeat(', ?', count($_AUTH['curates']) - 1) . ') OR d.id = 0 GROUP BY d.id';
$aSQL = array_merge($aSQL, $_AUTH['curates']);
}
$sSQL .= ' ORDER BY symbol_name';
$sSQL .= ' ORDER BY d.symbol, d.name';
$aPossibleTargets = array_map(
function ($sInput) {
return lovd_shortenString($sInput, 75);
......
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