<?php 
require_once '../../../../lib/configuration.inc';

// Vérification si l'accès est valide
if(!isset($_SESSION['SessionADMIN_compte_id'])){
	header('Location: ../../../auth.php');
	exit;
}

// Vérification si l'utilisateur a les droits d'accès
if($_SESSION['SessionADMIN_compte_type']=='utilisateur' AND (in_array(6, $_SESSION['SessionADMIN_compte_acces_modules'])==false OR in_array(5, $_SESSION['SessionADMIN_compte_acces_rubriques'])==false)){
	header('Location: ../../../');
	exit;
}


if(isset($action) AND $action=='modifier'){

	/******************************/
	/**  Traitement des erreurs  **/
	/******************************/
	//if(strlen(trim($input1))==0){
	//	$erreur_message .= "- l'objet FR est manquant<br>";
	//}
	

	/******************************/
	/**  Traitement des données  **/
	/******************************/
	$input1 = htmlentities($input1, ENT_QUOTES);
	$texte_facture_message_EN = htmlentities($texte_facture_message_EN, ENT_QUOTES);

	/****************************************/
	/**  Enregistrement des modifications  **/
	/****************************************/
	if($erreur_message==''){


		if (isset($_POST['input1_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input1="'.$input1_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input2_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input2="'.$input2_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input3_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input3="'.$input3_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input4_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input4="'.$input4_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input5_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input5="'.$input5_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input6_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input6="'.$input6_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input7_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input7="'.$input7_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input8_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input8="'.$input8_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input9_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input9="'.$input9_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input10_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input10="'.$input10_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input11_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input11="'.$input11_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input12_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input12="'.$input12_FR.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input13_FR'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_FR SET input13="'.$input13_FR.'" WHERE ID = 1');$contenu_modifie = 1;}

		if (isset($_POST['input1_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input1="'.$input1_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input2_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input2="'.$input2_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input3_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input3="'.$input3_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input4_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input4="'.$input4_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input5_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input5="'.$input5_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input6_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input6="'.$input6_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input7_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input7="'.$input7_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input8_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input8="'.$input8_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input9_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input9="'.$input9_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input10_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input10="'.$input10_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input11_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input11="'.$input11_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input12_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input12="'.$input12_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
		if (isset($_POST['input13_EN'])) { $requete_maj = mysqli_query($connexion_mysql, 'UPDATE admin_modif_facture_EN SET input13="'.$input13_EN.'" WHERE ID = 1');$contenu_modifie = 1;}
	}
}


if((isset($erreur_message) AND $erreur_message=='') OR (isset($contenu_modifie) AND $contenu_modifie==1)){

	// Sélection de la facture
	$inputs = mysqli_query($connexion_mysql, 'SELECT input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, input13 FROM admin_modif_facture_FR');
	$resultat_texte = mysqli_fetch_array($inputs);
	$input1_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[0])));
	$input2_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[1])));
	$input3_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[2])));
	$input4_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[3])));
	$input5_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[4])));
	$input6_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[5])));
	$input7_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[6])));
	$input8_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[7])));
	$input9_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[8])));
	$input10_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[9])));
	$input11_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[10])));
	$input12_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[11])));
	$input13_FR = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[12])));

	$inputs = mysqli_query($connexion_mysql, 'SELECT input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, input13 FROM admin_modif_facture_EN');
	$resultat_texte = mysqli_fetch_array($inputs);
	$input1_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[0])));
	$input2_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[1])));
	$input3_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[2])));
	$input4_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[3])));
	$input5_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[4])));
	$input6_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[5])));
	$input7_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[6])));
	$input8_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[7])));
	$input9_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[8])));
	$input10_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[9])));
	$input11_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[10])));
	$input12_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[11])));
	$input13_EN = decodage_apostrophe(html_entity_decode(stripslashes($resultat_texte[12])));
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><?=$admin_titre?></title>
	<link rel="shortcut icon" type="image/png" href="<?=$admin_domaine?>favicon.png">
	<link rel="stylesheet" type="text/css" href="<?=$admin_css_page?>">
	<script type="text/javascript" src="<?=$admin_js?>scriptaculous/prototype.js"></script>
	<script type="text/javascript" src="<?=$admin_js?>scriptaculous/scriptaculous.js"></script>
	<script type="text/javascript" src="<?=$admin_js?>scriptaculous/prototip.js"></script>
	<script type="text/javascript" src="<?=$admin_js?>jquery/jquery.js"></script>
	<script type="text/javascript" src="<?=$admin_js?>jquery/jquery-ui-personalized-1.6rc6.js"></script>
	<script type="text/javascript" src="<?=$admin_js?>commun.js"></script>
<!-- 

	<script src="//cdn.ckeditor.com/4.14.1/standard/ckeditor.js"></script>
	<script type="text/javascript">CKEDITOR.replace( "input2" );</script> -->

	<meta name="robots" content="none">
</head>

<body>

<?php 
include $general_path_relatif.'sources/entete.inc';
include $general_path_relatif.'sources/menu.inc';
?>

<div id="contenu_1"<?=$correction_contenu_1?>><div id="contenu_2">


	<div id="contenu_3" align="left" style="width: 650px;">

		<div id="titres">
			<span class="titre_1"><a href="./">Facturation</a> <span class="separateur">/</span> <span class="titre_2">Modifier le label des champs de facturation</span></span>
		</div>
		<br clear="all">

		<div id="bloc_bis">

			<?php if(isset($erreur_message) AND $erreur_message!=''){ ?>
				<div align="center"><div id="message_erreur" align="left"><b><?=$erreur_message_introduction.'</b><br>'.$erreur_message?></div></div>
			<?php } ?>

			<?php if(isset($contenu_modifie) AND $contenu_modifie==1){ ?>
				<div align="center"><div id="message_confirmation" style="color: green;"><b>Les textes ont été mis à jour.</b><br></div></div>
				<div id="formulaire_boutons" style="text-align: center;"><a href="./" class="lien_annuler">retour à la liste</a></div>
			<?php } ?>

			<form name="modifier" action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">

				<input type="hidden" name="action" value="modifier">

				<div id="formulaire_ligne_intertitre">VERSION FRANCAISE</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 1</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input1_FR" value="<?=$input1_FR?>" class="input" style="width: 470px;"></div>
					<br clear="all">
				</div>
			

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 2</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" id="input2_FR" name="input2_FR" value="<?=$input2_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 3</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input3_FR" value="<?=$input3_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 4</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input4_FR" value="<?=$input4_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>


				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 5</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input5_FR" value="<?=$input5_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 6</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input6_FR" value="<?=$input6_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 7</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input7_FR" value="<?=$input7_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 8</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input8_FR" value="<?=$input8_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 9</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input9_FR" value="<?=$input9_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 10</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input10_FR" value="<?=$input10_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 11</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input11_FR" value="<?=$input11_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 12</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input12_FR" value="<?=$input12_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Champ 13</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input13_FR" value="<?=$input13_FR?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>



				<div id="formulaire_ligne_intertitre">ENGLISH VERSION</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 1</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input1_EN" value="<?=$input1_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>


				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 2</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input2_EN" value="<?=$input2_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 3</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input3_EN" value="<?=$input3_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 4</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input4_EN" value="<?=$input4_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 5</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input5_EN" value="<?=$input5_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 6</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input6_EN" value="<?=$input6_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 7</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input7_EN" value="<?=$input7_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 8</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input8_EN" value="<?=$input8_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 9</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input9_EN" value="<?=$input9_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 10</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input10_EN" value="<?=$input10_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 11</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input11_EN" value="<?=$input11_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 12</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input12_EN" value="<?=$input12_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_ligne">
					<div id="formulaire_libelle_obligatoire">Field 13</div> <!--  <?=$texte_facture_objet_FR?> -->
					<div id="formulaire_champ" style="width: 500px;"><input type="text" name="input13_EN" value="<?=$input13_EN?>" class="input" style="width: 470px;"></input>
					<br clear="all">
				</div>

				<div id="formulaire_boutons"><input type="image" src="<?=$admin_img?>btn_valider.png" width="123" height="40" align="absmiddle" style="margin: 15px 5px 20px 0px;"> ou&nbsp; <a href="./" class="lien_annuler">annuler</a></div>

			</form>

		</div>

	</div>
	<br clear="all">

</div></div>

<?php include $general_path_relatif.'sources/pied_page.inc'; ?>

<script language="Javascript">
	<!-- 
	//document.modifier.texte_facture_objet_FR.focus();
	//-->
</script>

</body>
</html>
