<?
	$z="insert into ecmdocuments_".$_GET['relation']."(id,ecmdocument_id,".$_GET['parent_col'].",deleted) values('".create_guid()."','".$_GET['record']."','".$_GET['parent_id']."','0')";
	print $z;
	mysql_query($z);
	if($_GET['relation']=="correspondences" ||
	   $_GET['relation']=="correspondenceouts" ||
	   $_GET['relation']=="contracts" ||
	   $_GET['relation']=="ecminvoices")
	{
		$z="update ".$_GET['relation']." set relation='1' where id='".$_GET['parent_id']."'";
		mysql_query($z);
	}
	
	header("Location: index.php?module=EcmDocuments&action=DetailView&record=".$_GET['record']);
?>
