<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.7

Copyright (C) 2006-2007  Sylvain FATOME
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/

session_start(); 
include_once("../inc/config.inc.php");
include_once("../inc/func_log.inc.php");
if (CheckURLLog(FALSE)==FALSE) header("Location: ../index.php");
if (CheckNivLog("5-9")==FALSE) header("Location: ../index.php");
include_once("../inc/fic_age.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.php");
Archivelog(@$_SESSION["code_log"]);

$td = strip_tags(trim($_GET['td']));
$coderech = strip_tags(trim($_GET['code']));

$pbm_acat=FALSE;
	
if ($coderech <> "")
{
	$row = lit_enr_acat($coderech);
	if (is_array($row))
		extract ($row);
	else
		$pbm_acat=TRUE;
}
else
{
	if ($td<>"add")	$pbm_acat=TRUE;
}

if ($pbm_acat==FALSE)
{
	switch ($td)
	{
		case "add" :
			$titre = "CREATION CATEGORIE AGENCE";
			break;
		case "edit" :
			$titre = "MODIFICATION CATEGORIE AGENCE";
			break;
		case "del" :
			$titre = "SUPPRESSION CATEGORIE AGENCE";
			break;
		default :
			$pbm_acat=TRUE;
			break;
	}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-type=" content="text/html; charset=iso-8859-1">
<title>SMI - ESPACE PRIVE : Fiche Cat&eacute;gorie Agence</title>

<!-- Feuille de style pour les affichages courants -->
<link href="../css/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style & Script pour le menu -->
<script language="JavaScript" src="../jscript/coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Scripts Javascript pour contrôle de formulaire -->
<script	type="text/javascript" src="../jscript/vform/vform.js"></script>

<script language="javascript">
var tab_champ=new Array(
	"nom:code ; format:alphanum ; req:Y ; txt:Code ; lmn:1 ; lmx:5; stok:frmok ; stbad:frmbad",
	"nom:desc ; format:txt ; req:Y ; txt:Descriptif; lmn:1 ; lmx:50; stok:frmok ; stbad:frmbad");
</script>

<!-- Scripts Javascript pour alertes -->
<script language="JavaScript" src="../jscript/alertes.js"></script>

<!-- Scripts Javascript divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

</head>

<?PHP if ($td == "del") { ?>
<body onLoad="warndel();metReadonly();">
<?PHP } else { ?>
<body onLoad="metFocus();">
<?PHP }
include_once("../inc/entete.inc.php"); 
if ($pbm_acat==FALSE)
{
?>
<p align="center"> <span class="titrepage"><?PHP echo $titre ?></span></p>
<table width="100%"  border="0">
  <tr>
	<td width="33%"><strong><em><a href="acat_lst.php">Retour &agrave; la liste</a></em></strong></td>
	<td width="33%">
	<div id="oblig" align="center" class="annot_gras_it">(<img src="../img/oblig.gif" width="10" height="11" alt="Champ obligatoire"> : Saisie obligatoire)</div>
	</td>
	<td width="33%"><div align="right"><strong><em></em> </strong></div></td>
  </tr>
</table>
<form name="acat_maj" method="post" action="acat_enr.php" onSubmit="javascript:; return (VForm(this,tab_champ,'',''));">
<input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
<input name="td" type="hidden" id="td" value="<?PHP echo $td ?>">
<table width="100%"  border="0">
<tr>
	<td width="10%" class="rubfrm" id="f_code">Code</td>
	<td width="47%">
	<?PHP if ($td == "add") { ?>
	<input name="code" type="text" id="code" value="<?PHP echo $acat_code ?>" size="5">
	<img src="../img/oblig.gif" width="10" height="11" alt="Champ obligatoire">
	<?PHP } else { ?>
	<input name="code" type="text" id="code" value="<?PHP echo $acat_code ?>" size="5" readonly="1">
	</td>
	<?PHP } ?>
</tr>
<tr>
	<td class="rubfrm" id="f_desc">Descriptif</td>
	<td><input name="desc" type="text" id="desc" value="<?PHP echo htmlspecialchars($acat_desc); ?>" size="50">
	<img src="../img/oblig.gif" width="10" height="11" alt="Champ obligatoire"></td>
</tr>
</table>
<p align="center">
<?PHP if (($td == "add") OR ($td == "edit")) { ?>
<input name="RAZ" type="reset" class="bton_fmarr_std" id="RAZ" value="R&eacute;initialiser">
<input name="submit" type="submit" class="bton_fmarr_std" id="submit" value="Enregistrer">
<?PHP } ?>
<?PHP if ($td == "del") { ?>
<input name="del" type="submit" class="bton_fmarr_std" id="del" value="Supprimer">
<?PHP } ?>
</p>
</form>
<?PHP
}
else
{
?>
	<script type="text/javascript">
	setTimeout("self.location.href=('acat_lst.php');",2000)
	</script>
	<p align="center" class="annot_std_it">Probl&ecirc;me sur les param&egrave;tres...</p>
<?PHP
}
include_once("pied.php");
?>
