Commit 84bc0401 authored by Fokkema's avatar 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 @@ ...@@ -4,10 +4,10 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD) * LEIDEN OPEN VARIATION DATABASE (LOVD)
* *
* Created : 2010-03-04 * Created : 2010-03-04
* Modified : 2018-01-26 * Modified : 2019-08-07
* For LOVD : 3.0-21 * 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> * Programmers : Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@LUMC.nl>
* Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl> * Ivar C. Lugtenburg <I.C.Lugtenburg@LUMC.nl>
* M. Kroon <m.kroon@lumc.nl> * M. Kroon <m.kroon@lumc.nl>
...@@ -1408,7 +1408,7 @@ if (PATH_COUNT > 2 && ACTION == 'add') { ...@@ -1408,7 +1408,7 @@ if (PATH_COUNT > 2 && ACTION == 'add') {
$nPossibleTargets = count($aPossibleTargets); $nPossibleTargets = count($aPossibleTargets);
} elseif ($sCategory == 'Phenotype') { } elseif ($sCategory == 'Phenotype') {
// Retrieve list of diseases which do NOT have this column yet. // 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']); $aSQL = array($zData['id']);
if ($_AUTH['level'] < LEVEL_MANAGER) { if ($_AUTH['level'] < LEVEL_MANAGER) {
// Maybe a JOIN would be simpler? // Maybe a JOIN would be simpler?
...@@ -1747,7 +1747,7 @@ if (PATH_COUNT > 2 && ACTION == 'remove') { ...@@ -1747,7 +1747,7 @@ if (PATH_COUNT > 2 && ACTION == 'remove') {
} elseif ($sCategory == 'Phenotype') { } elseif ($sCategory == 'Phenotype') {
// Retrieve list of diseases that DO HAVE this column and you are authorized to remove columns from. // 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']); $aSQL = array($zData['id']);
if ($_AUTH['level'] < LEVEL_MANAGER) { 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 // 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') { ...@@ -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'; $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']); $aSQL = array_merge($aSQL, $_AUTH['curates']);
} }
$sSQL .= ' ORDER BY symbol_name'; $sSQL .= ' ORDER BY d.symbol, d.name';
$aPossibleTargets = array_map( $aPossibleTargets = array_map(
function ($sInput) { function ($sInput) {
return lovd_shortenString($sInput, 75); 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