commit f113d68ce011f3913fc304e1d44c2de89a9ffe9c
Author: Eric Seigne <eric.seigne@ryxeo.com>
Date:   Sun Dec 5 13:22:56 2010 +0100

    recollement automatique des contrats

diff --git a/plugins/anet_epacks/front/plugin_anet_epacks.view_array_recap.php b/plugins/anet_epacks/front/plugin_anet_epacks.view_array_recap.php
index 8bddc5e..e5c6ce6 100644
--- a/plugins/anet_epacks/front/plugin_anet_epacks.view_array_recap.php
+++ b/plugins/anet_epacks/front/plugin_anet_epacks.view_array_recap.php
@@ -87,12 +87,13 @@ include_once (GLPI_ROOT . "/inc/includes.php");
 //
 function local_make_query($data, $entityid, $maintenance) {
   $query = "SELECT e.*, e.FK_enduser as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*,
-(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc
+(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc, g6.name as contract
 FROM glpi_plugin_anet_epacks AS e
 LEFT JOIN glpi_plugin_anet_epacks_ssh_max AS ssh ON e.FK_serveur=ssh.FK_serveur
 LEFT JOIN glpi_entities AS g3 ON (e.FK_client=g3.ID OR e.FK_enduser=g3.ID)
 LEFT JOIN glpi_computers AS g4 ON e.FK_serveur=g4.ID
-LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur\n";
+LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur
+LEFT JOIN glpi_contracts AS g6 ON e.FK_contract=g6.ID\n";
 
   //WHERE e.Fk_Serveur > '0'\n";
   if($data['name'] == "revendeur" || $data['name'] == "dsi") {
@@ -132,12 +133,13 @@ LIMIT 500;";
 //special pour trouver les serveurs existants mais les enduser=0 (abonnement zen pas fait ou autre ?)
 function local_make_query_zarb() {
   $query = "SELECT e.*, e.FK_enduser as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*,
-(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc
+(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc, g6.name as contract
 FROM glpi_plugin_anet_epacks AS e
 LEFT JOIN glpi_plugin_anet_epacks_ssh_max AS ssh ON e.FK_serveur=ssh.FK_serveur
 LEFT JOIN glpi_entities AS g3 ON (e.FK_client=g3.ID OR e.FK_enduser=g3.ID)
 LEFT JOIN glpi_computers AS g4 ON e.FK_serveur=g4.ID
-LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur\n";
+LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur
+LEFT JOIN glpi_contracts AS g6 ON e.FK_contract=g6.ID\n";
   $query .= "WHERE e.FK_enduser='0' AND e.FK_client!='0'\n";
   $query .= "GROUP BY e.FK_serveur
 ORDER BY client ASC
@@ -150,12 +152,13 @@ LIMIT 500;";
 //Special pour les "dsi" quand on convertis a la vollee les comptes post-only en dsi pour les animtice
 function local_make_query_dsi($data, $entityid, $maintenance) {
   $query = "SELECT e.*, e.FK_enduser as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*,
-(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc
+(g5.nbeleves+g5.nbprofs) as nbusers, g5.nbpc as nbpc, g6.name as contract
 FROM glpi_plugin_anet_epacks AS e
 LEFT JOIN glpi_plugin_anet_epacks_ssh_max AS ssh ON e.FK_serveur=ssh.FK_serveur
 LEFT JOIN glpi_entities AS g3 ON (e.FK_client=g3.ID OR e.FK_enduser=g3.ID)
 LEFT JOIN glpi_computers AS g4 ON e.FK_serveur=g4.ID
-LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur\n";
+LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur
+LEFT JOIN glpi_contracts AS g6 ON e.FK_contract=g6.ID\n";
 
   //WHERE e.Fk_Serveur > '0'\n";
   if($data['name'] == "dsi") {
@@ -248,8 +251,7 @@ function local_make_array($q,$maintenance,$enduser=1) {
   <td align=\"left\">" . $data['os_license_id'] . " " . $data['otherserial'] . "<br />" . $data['os_license_number'] . " " . $data['otherserial'] ."</td>
   <td>" . $data['nbpc'] . "</td>
   <td>" . $data['nbusers'] . "</td>
-  <td>
-  </td>
+  <td>" . $data['contract'] . "</td>
 </tr>\n";
       /*
        <a href=\"../../../front/contract.php?contains[0]=" . $data['client'] . "\"><img src=\"img/stock_hand-signed.png\" title=\"Contrat\"></a>
@@ -278,12 +280,13 @@ function local_make_array($q,$maintenance,$enduser=1) {
 
   if($enduser == 1) {
     $query = "SELECT e.*, e.FK_enduser as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*,
-(sum(g5.nbeleves)+sum(g5.nbprofs)) as nbusers, g5.nbpc as nbpc
+(sum(g5.nbeleves)+sum(g5.nbprofs)) as nbusers, g5.nbpc as nbpc, g6.name as contract
 FROM glpi_plugin_anet_epacks AS e
 LEFT JOIN glpi_plugin_anet_epacks_ssh_max AS ssh ON e.FK_serveur=ssh.FK_serveur
 LEFT JOIN glpi_entities AS g3 ON (e.FK_client=g3.ID OR e.FK_enduser=g3.ID)
 LEFT JOIN glpi_computers AS g4 ON e.FK_serveur=g4.ID
-LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur\n";
+LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur
+LEFT JOIN glpi_contracts AS g6 ON e.FK_contract=g6.ID\n";
     //WHERE e.Fk_Serveur > '0'\n";
 
     if($maintenance == 0 || $maintenance ==  1) {
@@ -306,12 +309,13 @@ LIMIT 500;";
   }
   else {
     //LEFT JOIN glpi_entities AS g3 ON e.FK_client=g3.ID OR e.FK_enduser=g3.ID
-    $query = "SELECT e.*, e.FK_client as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*
+    $query = "SELECT e.*, e.FK_client as entityid, g3.name as client, g4.name as serveur, g4.os_license_number, g4.os_license_id, g4.otherserial, ssh.*, g6.name as contract
 FROM glpi_plugin_anet_epacks AS e
 LEFT JOIN glpi_plugin_anet_epacks_ssh_max AS ssh ON e.FK_serveur=ssh.FK_serveur
 LEFT JOIN glpi_entities AS g3 ON (e.FK_client=g3.ID OR e.FK_enduser=g3.ID)
 LEFT JOIN glpi_computers AS g4 ON e.FK_serveur=g4.ID
 LEFT JOIN glpi_plugin_anet_epacks_recencement_max AS g5 ON e.FK_serveur=g5.FK_serveur
+LEFT JOIN glpi_contracts AS g6 ON e.FK_contract=g6.ID
 WHERE e.FK_enduser='0' AND e.FK_client!='0'
 ORDER BY client\n";
     //print $query;
@@ -365,8 +369,7 @@ ORDER BY client\n";
   <td align=\"left\">" . $data['os_license_id'] . " " . $data['otherserial'] . "<br />" . $data['os_license_number'] . " " . $data['otherserial'] . "</td>
   <td>" . $data['nbpc'] . "</td>
   <td>" . $data['nbusers'] . "</td>
-  <td>
-  </td>
+  <td>" . $data['contract'] . "</td>
 </tr>\n";
       /*
 	  <a href=\"../../../front/contract.php?contains[0]=" . $data['client'] . "\"><img src=\"img/stock_hand-signed.png\" title=\"Contrat\"></a>
