Commit b45ea0ad authored by Ivo Fokkema's avatar Ivo Fokkema

Included final updates from LOVD+.

parent 02172daf
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2010-12-20
* Modified : 2019-08-29
* Modified : 2019-09-05
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -74,12 +74,6 @@ class LOVD_GenomeVariant extends LOVD_Custom {
'uo.name AS owned_by_, ' .
'uc.name AS created_by_, ' .
'ue.name AS edited_by_';
if (LOVD_plus) {
// Add curation status and confirmation status.
$this->aSQLViewEntry['SELECT'] .= ', ' .
'curs.name AS curation_status_, ' .
'cons.name AS confirmation_status_';
}
$this->aSQLViewEntry['FROM'] = TABLE_VARIANTS . ' AS vog ' .
'LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (vog.id = s2v.variantid) ' .
'LEFT OUTER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' .
......@@ -88,12 +82,6 @@ class LOVD_GenomeVariant extends LOVD_Custom {
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS uo ON (vog.owned_by = uo.id) ' .
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS uc ON (vog.created_by = uc.id) ' .
'LEFT OUTER JOIN ' . TABLE_USERS . ' AS ue ON (vog.edited_by = ue.id)';
if (LOVD_plus) {
// Add curation status and confirmation status.
$this->aSQLViewEntry['FROM'] .= ' ' .
'LEFT OUTER JOIN ' . TABLE_CURATION_STATUS . ' AS curs ON (vog.curation_statusid = curs.id)' .
'LEFT OUTER JOIN ' . TABLE_CONFIRMATION_STATUS . ' AS cons ON (vog.confirmation_statusid = cons.id)';
}
$this->aSQLViewEntry['GROUP_BY'] = 'vog.id';
// SQL code for viewing the list of variants
......
......@@ -549,7 +549,7 @@ class LOVD_TranscriptVariant extends LOVD_Custom {
list($nID, $nTranscriptID) = explode(',', $nID);
$this->aSQLViewEntry['WHERE'] .= (empty($this->aSQLViewEntry['WHERE'])? '' : ' AND ') . 'vot.transcriptid = \'' . $nTranscriptID . '\'';
// Before passing this on to parent::viewEntry(), perform a standard getCount() check on the transcript ID,
// Before passing this on to parent::viewEntry(), perform a standard count() check on the transcript ID,
// to make sure that we won't get a query error when the combination of VariantID/TranscriptID does not yield
// any results. Easiest is then to fake a wrong $nID such that parent::viewEntry() will complain.
if (!$_DB->query('SELECT COUNT(*) FROM ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' WHERE id = ? AND transcriptid = ?', array($nID, $nTranscriptID))->fetchColumn()) {
......
......@@ -4,7 +4,7 @@
* LEIDEN OPEN VARIATION DATABASE (LOVD)
*
* Created : 2009-10-21
* Modified : 2019-08-28
* Modified : 2019-09-05
* For LOVD : 3.0-22
*
* Copyright : 2004-2019 Leiden University Medical Center; http://www.LUMC.nl/
......@@ -894,6 +894,8 @@ class LOVD_Object {
// ViewEntry() and ViewList() call this function to see if data exists at all, and actually don't require a precise number.
// $ID = Can be an integer/numeric string, or an array. If an integer/numeric string: ID to check for existance.
// If an associative array (for linking tables), use array('geneid' => 'IVD', 'userid' => 1).
// FIXME: This function's name is wrong, and it should be renamed to isNotEmpty() or entryExist() or so.
// FIXME: Also the $this->nCount should be renamed, and the custom VL's functions for filling nCount can be simplified.
global $_DB;
if ($ID) {
......@@ -910,12 +912,15 @@ class LOVD_Object {
$aIDs = array($sIDColumn => $ID);
}
$nCount = $_DB->query('SELECT COUNT(*) FROM ' . constant($this->sTable) . ' WHERE ' . implode(' = ? AND ', array_keys($aIDs)) . ' = ?', array_values($aIDs))->fetchColumn();
$nCount = (int) $_DB->query('SELECT 1 FROM ' . constant($this->sTable) . '
WHERE ' . implode(' = ? AND ', array_keys($aIDs)) . ' = ? LIMIT 1',
array_values($aIDs))->fetchColumn();
} else {
if ($this->nCount !== '') {
return $this->nCount;
}
$nCount = $_DB->query('SELECT COUNT(*) FROM ' . constant($this->sTable))->fetchColumn();
$nCount = (int) $_DB->query('SELECT 1 FROM ' . constant($this->sTable) . '
LIMIT 1')->fetchColumn();
$this->nCount = $nCount;
}
return $nCount;
......@@ -2896,10 +2901,15 @@ FROptions
$zData = $this->prepareData($zData, 'list', $sViewListID);
if (FORMAT == 'text/html') {
// If defined, run the functions that define a row's class name.
if (empty($zData['class_name'])) {
$zData['class_name'] = 'data';
}
// FIXME; rawurldecode() in the line below should have a better solution.
// IE (who else) refuses to respect the BASE href tag when using JS. So we have no other option than to include the full path here.
print("\n" .
' <TR class="' . (empty($zData['class_name'])? 'data' : $zData['class_name']) . '"' . (!$zData['row_id']? '' : ' id="' . $zData['row_id'] . '"') . ' valign="top"' . (!$zData['row_link']? '' : ' style="cursor : pointer;"') .
' <TR class="' . $zData['class_name'] . '"' . (!$zData['row_id']? '' : ' id="' . $zData['row_id'] . '"') . ' valign="top"' . (!$zData['row_link']? '' : ' style="cursor : pointer;"') .
(!$zData['row_link']? '' :
(substr($zData['row_link'], 0, 11) == 'javascript:'?
// Rowlink is javascript code, define it with an onClick attribute.
......
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