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

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
****************************************************************************************/

include ("../inc/config.inc.php");
?>
<?php require ("../inc/func.inc.php") ?>
<?php require ("../inc/func_date.inc.php") ?>
<?php require ("../inc/func_log.inc.php") ?>
<?php require ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$ci = strip_tags(trim($_GET['ci'])); // Récupération code Intervention
	$page = strip_tags(trim($_GET['page'])); // Récupération du numéro de page actuel
	$last = strip_tags(trim($_GET['last'])); // Récupération du dernier numéro de page
	
	if ($page == 0) // Page non définie
	{
		$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
		mysql_select_db(DBNAME);
		$rech = "SELECT * FROM `" .TBRPBM. "` WHERE `rpbm_codeint`= '".$ci."'";
		$rs = mysql_query($rech);
		$last = mysql_num_rows($rs); // Nombre de résultats à la requête
		mysql_free_result($rs);
		mysql_close($conn);
		$page=1;
	}

?>

<!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 : Traitement Probl&egrave;mes</title>

<!-- Feuille de style pour les affichages courants -->
<link href="../inc/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 validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

<!-- Scripts Javascript pour affichages -->
<script language="JavaScript" src="../inc/aff.js"></script>

<!-- Script Javascript pour moulinage des tableaux-->
<script language="JavaScript" src="../inc/phparray2js.js"></script>

</head>

<body>

<p align="center"><span class="titrepage">LISTE DES PROBLEMES AFFECTES</span></p>
<p align="center">Merci de d&eacute;tailler les solutions apport&eacute;es aux les probl&egrave;mes affect&eacute;s &agrave; l'intervention <span class="annot_std_gras"><?PHP echo $ci;?></span> </p>
<p align="center" class="annot_gras_it">ATTENTION : apr&egrave;s validation d&eacute;finitive, la zone &quot;travail effectu&eacute;&quot; sera r&eacute;initialis&eacute;e avec les nouvelles valeurs.</p>
<?PHP
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);
	$rech = "SELECT * FROM `" .TBRPBM. "` WHERE `rpbm_codeint`= '".$ci."' ORDER BY `rpbm_datecrea` LIMIT ".($page-1).",1";
	$rs = mysql_query($rech)or die(mysql_error());
	if ($row = mysql_fetch_array($rs))
	{
		extract ($row);
	}
	mysql_free_result($rs);
	mysql_close($conn);

	$daterpbmf = formatedate($rpbm_datecrea);
?>
<form name="rpbmtt_maj" method="post" action="rpbmtt_enr.php" onsubmit="return v.exec()">
	<input name="ci" type="hidden" id="ci" value="<?PHP echo $ci; ?>">
	<input name="page" type="hidden" id="page" value="<?PHP echo $page; ?>">
	<input name="last" type="hidden" id="last" value="<?PHP echo $last; ?>">
	<input name="urlcour" type="hidden" id="urlcour" value="<?PHP echo $racine_web.$_SERVER['REQUEST_URI']; ?>">
	<input name="nrpbm" type="hidden" id="nrpbm" value="<?PHP echo $rpbm_id; ?>">
  <table width="890"  border="0" align="center">
	<tr>
	  <td width="33%">
	  <?PHP
			echo ($page)." / ".$last;
	  ?>
	  </td>
	  <?PHP
			$url_deb = $_SERVER["PHP_SELF"]."?ci=".@$_GET["ci"]."&page=1&last=".$last;
			if (($page-1) <=0)
				$npp = $last;
			else
				$npp = $page-1;
			$url_prec = $_SERVER["PHP_SELF"]."?ci=".@$_GET["ci"]."&page=".$npp."&last=".$last;
			if (($page+1) > $last)
				$nps = 1;
			else
				$nps = $page+1;
			$url_suiv = $_SERVER["PHP_SELF"]."?ci=".@$_GET["ci"]."&page=".$nps."&last=".$last;
			$url_fin = $_SERVER["PHP_SELF"]."?ci=".@$_GET["ci"]."&page=".$last."&last=".$last;;
	  ?>
	  <td width="33%"><div align="center"><span class="annot_std_it">(<img src="../img/oblig.gif" width="10" height="11"> : Saisie obligatoire) </span></div></td>
	  <td width="33%">
		<div align="right">
		  <a href="<?PHP echo $url_deb; ?>"><img src="../img/deb.gif" width="22" height="22" border="0"></a> 
		  <a href="<?PHP echo $url_prec; ?>"><img src="../img/prec.png" width="22" height="22" border="0"></a>
		  <a href="<?PHP echo $url_suiv; ?>"><img src="../img/suiv.png" width="22" height="22" border="0"></a>
		  <a href="<?PHP echo $url_fin; ?>"><img src="../img/fin.gif" width="22" height="22" border="0"></a>
		</div>
	  </td>
	</tr>
  </table>
  <table width="890"  border="0">
	<tr>
	  <td width="20%" class="tfvNormal" id="f_numpbm"><div align="right">Probl&egrave;me N&deg; </div></td>
	  <td>
		<input name="numpbm" type="text" id="numpbm" value="<?PHP echo sprintf("%'010s",$rpbm_id) ?>" size="15" maxlength="10" readonly="1">
	  </td>
	</tr>
	<tr>
	  <td width="20%" class="tfvNormal" id="f_signale"><div align="right">Ajout&eacute; le  </div></td>
	  <td>
		<input name="date" type="text" id="date" value="<?PHP echo $daterpbmf ?>" size="10" maxlength="10" readonly="1">
	  </td>
	</tr>
	<tr>
	  <td width="20%" class="tfvNormal" id="f_signale"><div align="right">Signal&eacute; par </div></td>
	  <td>
		<input name="signale" type="text" id="signale" value="<?PHP echo $rpbm_signale ?>" size="50" maxlength="50" readonly="1">
	  </td>
	</tr>
	<tr>
	  <td width="20%" class="tfvNormal" id="f_func"><div align="right">Code Relev&eacute; </div></td>
	  <td>
		<input name="coderel" type="text" id="coderel" value="<?PHP echo $rpbm_coderlp ?>" size="20" maxlength="20" readonly="1">
		<?PHP
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			if ($rpbm_typrel == 1) // C'est une licence
				$rech = "SELECT * FROM `" .TBRLIC. "` WHERE `rlic_code`= '".$rpbm_coderlp."'";
			else // C'est du matériel
				$rech = "SELECT * FROM `" .TBRPDT. "` WHERE `rpdt_code`= '".$rpbm_coderlp."'";
			$rs = mysql_query($rech);
			if ($row = mysql_fetch_array($rs))
			{
				extract ($row);
			}
			mysql_free_result($rs);
			mysql_close($conn);
		?>
		<br>
		<span class="annot_petit_it">
		<?PHP
			$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
			mysql_select_db(DBNAME);
			if ($rpbm_typrel == 1) // C'est une licence
			{
				$rech2 = "SELECT * FROM ".TBRLPMA." WHERE `rlpma_code` = '".$rlic_codema."'";
				$rs2 = mysql_query($rech2);
				if ($row2 = mysql_fetch_array($rs2))
				{
					extract ($row2);
				}
				$txtreleve = $rlpma_desc." ".$rlic_modele." ".$rlic_version;
			}
			else // C'est du matériel
			{
				$rech2 = "SELECT * FROM ".TBRPCAT." WHERE `rpcat_code` = '".$rpdt_codecat."'";
				$rs2 = mysql_query($rech2);
				if ($row2 = mysql_fetch_array($rs2))
				{
					extract ($row2);
				}
				$rech2 = "SELECT * FROM ".TBRLPMA." WHERE `rlpma_code` = '".$rpdt_codema."'";
				$rs2 = mysql_query($rech2);
				if ($row2 = mysql_fetch_array($rs2))
				{
					extract ($row2);
				}
				$txtreleve = $rpcat_desc." / ".$rlpma_desc." ".$rpdt_modele." (".$rpdt_codep.")";
			}
			mysql_free_result($rs2);
			mysql_close($conn);
			echo $txtreleve;
		?>
		</span>
	  </td>
	</tr>
	<tr>
	  <td width="20%" class="tfvNormal" id="f_pbm"><div align="right">Probl&egrave;me not&eacute; </div></td>
	  <td><textarea name="pbm" cols="100" rows="5" id="pbm" readonly><?PHP echo $rpbm_pbm ?></textarea></td>
	</tr>
	<tr>
	  <td width="20%" class="tfvNormal" id="f_fait"><div align="right">Travail effectu&eacute; </div></td>
	  <td>
		<textarea name="fait" cols="100" rows="5" id="fait"><?PHP echo $rpbm_fait ?></textarea>
		<img src="../img/oblig.gif" width="10" height="11">
	  </td>
	</tr>
  </table>
  <p align="center">
	<input name="RAZ" type="reset" id="RAZ" value="R&eacute;initialiser">
	<input name="enr" type="submit" id="enr" value="Valider">
	<input name="fin" type="submit" id="fin" value="Termin&eacute;">
  </p>
</form>

<script>
// form fields description structure
var a_fields = {
	'fait':{'l':'Travail effectué','r':false,'t':'f_fait'}
},

o_config = {
	'to_disable' : ['submit', 'RAZ'],
	'alert' : 1
}

// validator constructor call
var v = new validator('rpbmtt_maj', a_fields, o_config);

</script>

</body>
</html>
