<?php

	require("§lib_inc.php");

	set_time_limit(0);
	
	flush();
	
	$sql_query= "	update oxg_flashlist set date_max= ";
	$sql_query.="	(select max_date from ";
	$sql_query.="	(select evt_lieu.id_family, evt_lieu.id_country, evt_lieu.id_zone, evt_lieu.id_city, oxg_patronyms.libelle, max(evt_lieu.devnt) max_date ";
	$sql_query.="	from oxg_events2 evt_lieu ";
	$sql_query.="			, oxg_individuals ";
	$sql_query.="			, oxg_patronyms ";
	$sql_query.="	where evt_lieu.id_family=oxg_individuals.id_family ";
	$sql_query.="	and oxg_individuals.id_individual=evt_lieu.id_individu ";
	$sql_query.="	and oxg_individuals.id_patronym=oxg_patronyms.id_patronym ";
	$sql_query.="	and evt_lieu.id_city<>-1 ";
	$sql_query.="	group by evt_lieu.id_family, evt_lieu.id_country, evt_lieu.id_zone, evt_lieu.id_city, oxg_patronyms.libelle) evt_max_date ";
	$sql_query.="	where evt_max_date.id_country=oxg_flashlist.country ";
	$sql_query.="	and evt_max_date.id_zone=oxg_flashlist.zone ";
	$sql_query.="	and evt_max_date.id_city=oxg_flashlist.city ";
	$sql_query.="	and evt_max_date.libelle=oxg_flashlist.name ";
	$sql_query.="	and max_date is not null ";
	$sql_query.="	and evt_max_date.id_family=oxg_flashlist.id_family) ";
	mysql_query($sql_query) or mysql_die();

	drop_index_if_exists("IDX_EVT2_FLASH_PLACE", "oxg_events2");
	drop_index_if_exists("IDX_INDI_FLASH", "oxg_individuals");
	drop_index_if_exists("IDX_PATRO_FLASH", "oxg_patronyms");

	echo "dates maximums chargées";
?>

<P>Table oxg_flashlist effectué
<?php
$CREAT=isset($_REQUEST["CREAT"])?$_REQUEST["CREAT"] : "";
if($CREAT=="AUTO")
{
	echo ("<p>");
	display_lng_text("ADM_DATA");
?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
		setTimeout("top.location.href = '§auto_create.php?CREAT=AUTO'",1);
	//-->
	</SCRIPT>
<?php
}
else
{
affiche_pied_page_admin(true);
}
?>
</body></html>