*/
include("session.php");
require("class_functions.php");
require("class_db.php");
if(file_exists($_SESSION['config']['lang'].'.php'))
{
include($_SESSION['config']['lang'].'.php');
}
else
{
$_SESSION['error'] = "Language file missing...
";
}
$_SESSION['error'] = "";
$db = new dbquery();
$db->connect();
if($_POST['valid'])
{
if(isset($_POST['service']) && !empty($_POST['service']))
{
$db->query("update res_x set DESTINATION = '".$_POST['service']."' where DESTINATION = '".$_POST['id']."' and status <> 'DEL'");
}
if($_POST['nb'] > 0 && empty($_POST['service']))
{
$_SESSION['error'] = _CANT_DEL_DEPARTMENT;
}
else
{
$db->query("delete from ".$_SESSION['tablename']['services']." where ID = '".$_POST['id']."'");
if($_SESSION['config']['collectivities'] == "true")
{
include_once($_SESSION['config']['includedir']."/addon_collectivities.php");
$db = new dbquery();
delete_collectivity($_POST['id'],$db);
}
?>
query("select RES_ID from res_x where DESTINATION = '".$id."' and STATUS <> 'DEL'");
if($db->nb_result() > 0)
{
$nb_docs = $db->nb_result();
}
else
{
$nb_docs = 0;
}
$db->query("select SERVICE, ID from ".$_SESSION['tablename']['services']." where ENABLED = 'Y' and ID <> '".$id."'");
$services = array();
while($res = $db->fetch_object())
{
array_push($services, array('ID' => $res->ID, 'LABEL' => $res->SERVICE));
}
?>