lovd_errorClean(); // Mandatory fields. if (empty($_POST['password'])) { lovd_errorAdd('password', 'Please fill in the \'Enter your password for authorization\' field.'); } // 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()) { // Get genes which are modified before we delete the entry. // Only when phenotype, individual and variant are marked or public. if ($zData['statusid'] >= STATUS_MARKED) { $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) ' . 'INNER JOIN ' . TABLE_PHENOTYPES . ' AS p ON (p.individualid = i.id) ' . 'WHERE vog.statusid >= ? AND i.statusid >= ? AND p.id = ?', array(STATUS_MARKED, STATUS_MARKED, $nID))->fetchAllColumn(); } $_DATA->deleteEntry($nID); if ($zData['statusid'] >= STATUS_MARKED && $aGenes) { // Change updated date for genes. lovd_setUpdatedDate($aGenes); } // Write to log... lovd_writeLog('Event', LOG_EVENT, 'Deleted phenotype information entry ' . $nID . ' (Owner: ' . $zData['owner'] . ')'); // Thank the user... header('Refresh: 3; url=' . lovd_getInstallURL() . 'individuals/' . $zData['individualid']); $_T->printHeader(); $_T->printTitle(); lovd_showInfoTable('Successfully deleted the phenotype information entry!', 'success'); $_T->printFooter(); exit; } else { // Because we're sending the data back to the form, I need to unset the password fields!