// User had to enter his/her password for authorization. if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) { lovd_errorAdd('password', 'Please enter your correct password for authorization.'); } if (!lovd_error()) { // Query text. $_DB->beginTransaction(); // Search for effected genes before the deletion on SCR2VAR, else we can't find the link. // Get genes which are modified only when linked variant is marked or public. $aGenes = $_DB->query('SELECT DISTINCT t.geneid FROM ' . TABLE_TRANSCRIPTS . ' AS t ' . 'INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vot.transcriptid = t.id) ' . 'INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (vog.id = vot.id) ' . 'INNER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s2v.variantid = vog.id) ' . 'INNER JOIN ' . TABLE_SCREENINGS . ' AS s ON (s.id = s2v.screeningid) ' . 'INNER JOIN ' . TABLE_INDIVIDUALS . ' AS i ON (i.id = s.individualid) ' . 'WHERE vog.statusid >= ? AND i.statusid >= ? AND s2v.screeningid = ?', array(STATUS_MARKED, STATUS_MARKED, $nID))->fetchAllColumn(); if (isset($_POST['remove_variants']) && $_POST['remove_variants'] == 'remove') { // This also deletes the entries in TABLE_SCR2VAR. $_DB->query('DELETE FROM ' . TABLE_VARIANTS . ' WHERE id IN (?' . str_repeat(', ?', count($aVariantsRemovable) - 1) . ')', $aVariantsRemovable); } // This also deletes the entries in TABLE_SCR2GENES and TABLE_SCR2VAR. $_DATA->deleteEntry($nID); if ($aGenes) { // Change updated date for genes lovd_setUpdatedDate($aGenes); } $_DB->commit(); // Write to log... lovd_writeLog('Event', LOG_EVENT, 'Deleted screening information entry ' . $nID); // Thank the user... header('Refresh: 3; url=' . lovd_getInstallURL() . 'individuals/' . $zData['individualid']); $_T->printHeader(); $_T->printTitle(); lovd_showInfoTable('Successfully deleted the screening information entry!', 'success'); $_T->printFooter(); exit; } else {