commit 57ea0d388f7b39a9df0c693dff4035a64c407f1a
Author: Eric Seigne <eric.seigne@ryxeo.com>
Date:   Mon Feb 7 23:32:57 2011 +0100

    ajout d'une nouvelle possibilite dans anet: prochaine commande lancee lors de la mise a jour de ce serveur ...

diff --git a/plugins/manageentity/inc/plugin_manageentity.functions_db.php b/plugins/manageentity/inc/plugin_manageentity.functions_db.php
index d47a98f..2242d43 100644
--- a/plugins/manageentity/inc/plugin_manageentity.functions_db.php
+++ b/plugins/manageentity/inc/plugin_manageentity.functions_db.php
@@ -137,4 +137,16 @@ function plugin_manageentity_createaccess($ID){
 
 }
 
+//ryxeo
+function plugin_manageentity_anetinsertnextupgrade($eID,$text){
+  $DB = new DB;
+  $query="SELECT ID FROM glpi_plugin_anet_epacks_upgrade WHERE FK_serveur='$eID';";
+  $result = $DB->query($query);
+  if($DB->numrows($result)>0)
+    $query="UPDATE glpi_plugin_anet_epacks_upgrade SET upgradecmd='$text' WHERE FK_serveur='$eID';";
+  else
+    $query="INSERT INTO glpi_plugin_anet_epacks_upgrade (FK_serveur,upgradecmd) VALUES ('$eID','$text');";
+  $result = $DB->query($query);
+}
+
 ?>
\ No newline at end of file
diff --git a/plugins/manageentity/inc/plugin_manageentity.functions_display.php b/plugins/manageentity/inc/plugin_manageentity.functions_display.php
index ad5f100..de287ee 100644
--- a/plugins/manageentity/inc/plugin_manageentity.functions_display.php
+++ b/plugins/manageentity/inc/plugin_manageentity.functions_display.php
@@ -486,6 +486,47 @@ WHERE FK_enduser=".$instID;
 	echo "<br />";
 }
 
+//ryxeo
+function plugin_manageentity_showanetnextupgrade($instID) {
+
+	global $DB,$CFG_GLPI, $LANG,$LANGMANAGEENTITY;
+
+	if (!haveRight("computer","r")) return false;
+
+	$query = "SELECT upgradecmd FROM glpi_plugin_anet_epacks_upgrade as u
+LEFT JOIN glpi_plugin_anet_epacks AS g ON g.FK_serveur=u.FK_serveur
+WHERE FK_enduser=".$instID;
+	//print $query;
+	$title=$LANG["central"][9];
+
+	$result = $DB->query($query);
+	$number = $DB->numrows($result);
+	$upgradecmd = $DB->result($result, 0, "upgradecmd");
+
+	$query = "SELECT FK_serveur as srvID FROM glpi_plugin_anet_epacks WHERE FK_enduser=".$instID;
+	//	print $query;
+	$result = $DB->query($query);
+	$srvID = $DB->result($result, 0, "srvID");
+
+	echo "<form method='post' action=\"./index.php\">";
+	echo "<input type='hidden' name='srvID' value='$srvID'>";
+	echo "<br><div align='center'><table class='tab_cadre' align='center' width='95%'>";
+	echo "<tr>";
+	echo "<th colspan='4'>Commande à lancer lors de la prochaine mise à jour de ce serveur </th>";
+	echo "</tr>";
+	
+	echo "<tr class='tab_bg_2'>";
+	echo "<td width=\"100%\"><u>Note:</u> Cette commande doit-être gpg signée par une clé GPG acceptée par ce serveur !<br /><textarea name=\"upgradecmd\" cols=\"100\" rows=\"10\">".$upgradecmd."</textarea></td>";
+	echo "</tr>";
+	echo "<tr class='tab_bg_2'>";
+	echo "<td width=\"100%\"><input type=\"submit\" name=\"anetinsertnextupgrade\" value=\"Enregistrer\" class=\"submit\"></td>";
+	echo "</tr>";
+	
+	echo "</table></div>";
+	echo"</form>";
+	echo "<br />";
+}
+
 
 /**/
 ?>
diff --git a/plugins/manageentity/index.php b/plugins/manageentity/index.php
index 65c5938..53a1b39 100644
--- a/plugins/manageentity/index.php
+++ b/plugins/manageentity/index.php
@@ -52,8 +52,12 @@ if(plugin_manageentity_haveRight("manageentity","r") || haveRight("config","w"))
 	if(plugin_manageentity_HaveRight("manageentity","w"))
 		plugin_manageentity_addcontracts($_POST["entID"],$_POST["conID"]);
 	glpi_header($_SERVER['HTTP_REFERER']);
-}
-else if (isset($_GET["deletecontracts"])){
+} elseif (isset($_POST["anetinsertnextupgrade"])){
+	  //ryxeo
+	  if(plugin_manageentity_HaveRight("manageentity","w"))
+	    plugin_manageentity_anetinsertnextupgrade($_POST["srvID"],$_POST["upgradecmd"]);
+	  glpi_header($_SERVER['HTTP_REFERER']);
+}else if (isset($_GET["deletecontracts"])){
 
 	if(plugin_manageentity_HaveRight("manageentity","w"))
 		plugin_manageentity_deletecontracts($_GET["ID"]);
@@ -210,6 +214,7 @@ else if (isset($_GET["deleteticket"])){
 		else echo "<br>";
 		plugin_manageentity_showdocuments($_SESSION["glpiactive_entity"]);
 		plugin_manageentity_showcontacts($_SESSION["glpiactive_entity"]);
+		plugin_manageentity_showanetnextupgrade($_SESSION["glpiactive_entity"]);
 		echo "</td></tr>";
 		echo "</table></div>";
 
