<?php
	//connection
	include("connection.php");
?>

<html>
<body bgcolor="#999966" text="#FFFFFF" link="#000000" vlink="#000000" alink="#000000">
<title>ANISEED CURATOR - Delete Insitu</title>


 <br>

<?php
    if ( (!isset($_SESSION["login"]))or(!isset($_SESSION["pass"])) ) {
	    print "<center><strong>you need to <a href=\"login.php\">login</a> as an authorised curator to proceed.</strong>";
	    print '</center></body></html>';
	   		return;
	}
?>
 

<?php

        $id=$_POST["id"];
/*
		include("update-interactions.php");
		delete_evidence($c, $id);
		$khoueiry="INSERT INTO \"UPDATE_INTERACTION\" (\"ID\", \"ISH_ID\" ) values 
				( nextval('\"S_UPDATE_INTERACTION\"'),".$id.")";	  	
		pg_query($c,$khoueiry) or print ('<Strong>Error inserting UPDATE_INTERACTION: </Strong>'.pg_last_error($c));
*/
	$stmt = pg_query($c,"BEGIN");
	$khoueiry = "DELETE FROM \"REG_EVIDENCE\" WHERE \"EVIDENCE\"=".$id.";";
	$stmt = pg_query($c,$khoueiry);
	$khoueiry = "DELETE FROM \"REG_EVIDENCE\" WHERE \"CONTROL\"=".$id.";";
	$stmt = pg_query($c,$khoueiry);
	$kmp = "DELETE FROM \"UPDATE_INTERACTIONS\" WHERE \"ISH_ID\"=".$id.";";
	$stmp = pg_query($c,$kmp);
	$stmt = pg_query($c,"END");		
		
pg_query($c,"begin");	

	$requete = "delete from \"IN_SITU_CLUSTER\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"IN_SITU_CLUSTER\" where \"IN_SITU_ID_2\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"EMBRYO_MANIP\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"MUTANT\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"TARGET\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"PICTURE\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"IN_SITU\" where \"IN_SITU_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"REFERENCE\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"ENTRY_ORIGIN\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
	
	$requete = "delete from \"BIO_ENTITY\" where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));


/*
	$requete = "update \"ENTRY_ORIGIN\" set \"CURATOR_ID\"=".$_SESSION['curationauthor'].", \"CURATION_DATE\"=current_date() where \"BIO_ID\"=$id";
	$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));
*/

    // Validation de la transaction
  pg_query($c,"commit");

    print '<table width="100%" border="0">';
	
    // Verification de la validation : si une erreur est survenue, afficher le message d'erreur
  
	    print '<tr><td align="center"><H1>Validation done</H1></td></tr>';
	    print '<tr><td align="center"><center><input name="Exit" type="button" value="-= Close window =-" onClick="javascript:self.close();"></center></td></tr>';
  
	//ocilogoff($connection);
?>

 </table>


</body>
</html>
 
 
 
 