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

Version 0.9.6
Copyright (C) 2006  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
****************************************************************************************/

session_start(); 
?>
<?php if ((@$HTTP_SESSION_VARS["etat_log"] <> "connecte") or ((@$HTTP_SESSION_VARS["niv_log"] <> 9) AND (@$HTTP_SESSION_VARS["niv_log"] <> 5))) header("Location: ../index.php") ?>
<?php include ("../inc/config.inc.php") ?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/func_txt.inc.php") ?>
<?php include ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$td = strip_tags(trim($_GET['typ']));
	$coderech = strip_tags(trim($_GET['code']));
	
	$pbm_dded = FALSE;
	
	if ($coderech <> "")
	{
		if ($coderech <> "VA")
		{
			// Récupération des informations type de demande
			$row = lit_enr_dded($coderech);
			if (is_array($row))
			{
				extract ($row);
		
				if ($td == "edit")
					$titre = "MISE A JOUR DESTINATAIRE DE DEMANDE";
		
				if ($td == "del")
					$titre = "SUPPRESSION DESTINATAIRE DE DEMANDE";
			}
			else
			{
				$pbm_dded = TRUE;
			}
		}
		else
		{
			$pbm_dded = TRUE;
		}
	}
	else
	{
		if ($td == "add")
			$titre = "CREATION DESTINATAIRE DE DEMANDE";
	}
?>

<!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 d'un destinataire d'une demande</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 -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour affichages -->

<script language="JavaScript" src="../inc/aff.js"></script>

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

<script language="javascript">
var tab1_champ=new Array(
	"nom:code ; format:alphanum ; req:Y ; txt:Code ; lmx:10 ; stok:frmok ; stbad:frmbad",
	"nom:desc ; format:txt ; req:Y ; txt:Descriptif ; lmx:40 ; stok:frmok ; stbad:frmbad",
	"nom:email ; format:mail ; req:Y ; txt:Email ; lmx:50 ; stok:frmok ; stbad:frmbad");
</script>

</head>

<body>

<?php 
	include_once ("../inc/entete.php"); 

if ($pbm_dded == 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="dded_lst.php">Retour &agrave; la liste</a></em></strong></td>
		<td width="33%" bgcolor="#FF0000"><div align="center"><span class="titrerubrique1">Descriptif</span></div></td>
		<td width="33%"><div align="right"><strong><em></em> </strong></div></td>
	  </tr>
	</table>
	<div align="center">
		<span class="annot_gras_it">(<img src="../img/oblig.gif" width="10" height="11"> : Saisie obligatoire)</span>
	</div>
	
	<form name="dded_maj" id="dded_maj" method="post" action="dded_enr.php" onSubmit="javascript:; return (VForm(this,tab1_champ,''));">
		  <input name="titre" type="hidden" id="titre" value="<?PHP echo $titre ?>">
		  <input name="typdde" type="hidden" id="typdde" value="<?PHP echo $td ?>">
	
	<table width="100%"  border="0">
		<tr>
		  <td width="25%" class="rubfrm" id="f_code"><div align="right">Code</div></td>
		  <td>
		  <?PHP if ($td == "add") { ?>
			  <input name="code" type="text" id="code" value="<?PHP echo $dded_code ?>" size="10" maxlength="10" onChange="javascript:this.value=this.value.toUpperCase();">
			  <img src="../img/oblig.gif" width="10" height="11">
		  <?PHP } else { ?>
			  <input name="code" type="text" id="code" value="<?PHP echo $dded_code ?>" size="10" maxlength="10" readonly="1">
		  <?PHP } ?>
		  </td>
		</tr>
		<tr>
			<td width="25%" class="rubfrm" id="f_desc"><div align="right">Libell&eacute;</div></td>
			<td>
				<input name="desc" type="text" id="desc" value="<?PHP echo $dded_desc ?>" size="40" maxlength="40" onChange="javascript:this.value=this.value.toUpperCase();"> <img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_pub"><div align="right">Accessible publiquement</div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"pub\" size=\"1\" id=\"pub\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_pub == 1)
				{
					echo "<select name=\"pub\" size=\"1\" id=\"pub\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"pub\" size=\"1\" id=\"pub\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_cli"><div align="right">Accessible par les clients* </div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"client\" size=\"1\" id=\"client\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_cli == 1)
				{
					echo "<select name=\"client\" size=\"1\" id=\"client\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"client\" size=\"1\" id=\"client\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
			</td>
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_age"><div align="right">Accessible par les agences* </div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"age\" size=\"1\" id=\"age\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_age == 1)
				{
					echo "<select name=\"age\" size=\"1\" id=\"age\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"age\" size=\"1\" id=\"age\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_tec"><div align="right">Accessible par les techniciens* </div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"tec\" size=\"1\" id=\"tec\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_tec == 1)
				{
					echo "<select name=\"tec\" size=\"1\" id=\"tec\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"tec\" size=\"1\" id=\"tec\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_ope"><div align="right">Accessible par les op&eacute;rateurs* </div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"ope\" size=\"1\" id=\"ope\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_ope == 1)
				{
					echo "<select name=\"ope\" size=\"1\" id=\"ope\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"ope\" size=\"1\" id=\"ope\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_cge"><div align="right">Accessible par le si&egrave;ge* </div></td>
		  <td>
			<?PHP 
			if ($td == "add")
			{ 
				echo "<select name=\"cge\" size=\"1\" id=\"cge\">";
				echo "<option value=\"Oui\">Oui</option>";
				echo "<option value=\"Non\" selected>Non</option>";
				echo "</select>";
			}
			
			if (($td == "edit") OR ($td == "del"))
			{ 
				if ($dded_cge == 1)
				{
					echo "<select name=\"cge\" size=\"1\" id=\"cge\">";
					echo "<option value=\"Oui\" selected>Oui</option>";
					echo "<option value=\"Non\">Non</option>";
					echo "</select>";
				}
				else
				{
					echo "<select name=\"cge\" size=\"1\" id=\"cge\">";
					echo "<option value=\"Oui\">Oui</option>";
					echo "<option value=\"Non\" selected>Non</option>";
					echo "</select>";
				}
			}
			?>
			<img src="../img/oblig.gif" width="10" height="11">
		</tr>
		<tr>
		  <td width="25%" class="rubfrm" id="f_email"><div align="right">Email**</div></td>
		  <td>
			  <input name="email" type="text" id="email" value="<?PHP echo $dded_email ?>" size="50" maxlength="50" onChange="javascript:this.value=this.value.toLowerCase();">
			  <img src="../img/oblig.gif" width="10" height="11">
		</tr>
	  </table>
	  <span class="annot_petit_it">* Par l'espace priv&eacute; / ** N'appara&icirc;tra pas sur les demandes.</span><br>
	  
	  <p align="center">
		<?PHP if (($td == "add") OR ($td == "edit")) { ?>
		<input name="RAZ" type="reset" id="RAZ" value="R&eacute;initialiser">
		<input name="submit" type="submit" id="submit" value="Enregistrer">
		<?PHP } ?>
		<?PHP if ($td == "del") { ?>
		<input name="del" type="submit" id="del" value="Supprimer">
		<input name="annul" type="button" id="annul" value="Annuler" onclick="javascript:; history.back();">
		<?PHP } ?>
	  </p>
	</form>
	<p>&nbsp;</p>
	<?PHP if ($td == "del") 
	{
	?>
		<script>
		warndelddet();
		</script>
	<?PHP
	}
	?>
		
	<?php 
		include_once ("pied.php");
}
else
{
?>
	<script type="text/javascript">
	setTimeout("self.location.href=('dded_lst.php');",2000)
	</script>
<?PHP
}
?>