You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2007-02-05 12:33:58

patounet
Member
Registered: 2007-01-30
Posts: 6

Rapport

Bonjour

Apres avoir réglé mon problème sur l'affichage des Softs désinstallé dans l'historique, j'aurai de nouveau une nouvelle requête:
Comment effectuer un rapport sur l'historique de tous les PC, le but étant d'avoir une idée globale sur tous ce qui ce passe sur chaque PC.
J'ai commencé à regarder dans les rapports, mais je n'y comprends absolument rien a ces requêtes SQL!..

Trop balaise pour moi....

Quelqu'un pourrait il m'aider ou existe t'il déjà un rapport tout fait??

Merci d'avance

Patrick

Offline

#2 2007-02-07 21:51:43

patounet
Member
Registered: 2007-01-30
Posts: 6

Re: Rapport

Personne pour m'aider???

Ya pas moyen j'y arrivepas!

Merci quand meme!

Offline

#3 2007-02-10 11:36:16

patounet
Member
Registered: 2007-01-30
Posts: 6

Re: Rapport

Bonjour

Ca y est enfin, j'ai reussi!..
Un rapport reprenant l'historique de tous les PC suivant une date.
Pour ceux que cela interesse
Voici la procedure

1) Modifier le fichier /front/report.php pour ajouter un lien:

    $report_list["Historique"]["name"]="Historique Global";
    $report_list["Historique"]["file"]="myhistory.php";

2) il ne reste plus qu'a creer le fichier /front/myhistory.php avec le code source suivant:



<?    global $db,$SEARCH_OPTION, $LINK_ID_TABLE,$phproot,$lang;   
   
    include ("_relpos.php");
    $NEEDED_ITEMS=array("search","computer","state","infocom");
    include ($phproot . "/inc/includes.php");

    include_once ($phproot . "/inc/search.class.php");
    include_once ($phproot . "/inc/device.function.php");

    //$SEARCH_OPTION=getSearchOptions();

    checkRight("reports","r");

    commonHeader($lang["title"][3],$_SERVER['PHP_SELF']);
   

echo "<div align='center'><form method=\"post\" name=\"form\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<table class='tab_cadre'><tr class='tab_bg_2'><td align='right'>";
echo "Date de Depart :</td><td>";
showCalendarForm("form","date1",$_POST["date1"]);
echo "</td><td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" Value=\"". $lang["buttons"][7] ."\" /></td></tr>";
echo "</table></form></div>";

define("crlf", "<BR>");

if($_POST["date1"]) {

    $mydate=$_POST["date1"];
   
    echo "<div align='center'><br><table border='1' width='100%' class='tab_cadre_fixe'>";
    echo "<tr><th colspan='2'>".$lang["title"][38]."</th></tr>";
    echo "<tr><th>Name</th><th width='85%'>".$lang["event"][19]."</th></tr>";


    $query2="SELECT distinct FK_glpi_device FROM glpi_history,glpi_computers WHERE glpi_history.FK_glpi_device =  glpi_computers.id and glpi_history.date_mod  > '$mydate' order by glpi_computers.name";
    $result2 = mysql_query($query2);
    while ($val3 = mysql_fetch_array($result2)){
        $change="";
        $myid=$val3["FK_glpi_device"];
        $query="SELECT glpi_computers.name ,glpi_history.* FROM glpi_history, glpi_computers WHERE glpi_history.FK_glpi_device =  glpi_computers.id and glpi_history.date_mod  > '$mydate' and glpi_history.FK_glpi_device = '$myid' order by glpi_history.date_mod DESC";

        // Get results
        $result = mysql_query($query);

            while ($val = mysql_fetch_array($result)){
                $ID = $val["ID"];
                $date_mod = $val["date_mod"];
               
                $date = substr($date_mod,8,2)."-";        // jour
                $date = $date.substr($date_mod,5,2)."-";  // mois
                $date_mod = $date.substr($date_mod,0,4). " "; // année

                $user_name = $val["user_name"];

                // This is an internal device ?
                    if($val["linked_action"]){
                        // Yes it is an internal device

                        switch ($val["linked_action"]){

                            case HISTORY_ADD_DEVICE :
                                $field=getDeviceTypeLabel($val["device_internal_type"]);
                                $change = $change.$date_mod."   |".$field.": ".$lang["devices"][25]."&nbsp;<strong>:</strong>&nbsp;\"".$val[ "new_value"]."\"".crlf;   
                                break;

                            case HISTORY_UPDATE_DEVICE :
                                $field=getDeviceTypeLabel($val["device_internal_type"]);
                                $change = $change.$date_mod."   |".$field.": ".getDeviceSpecifityLabel($val["device_internal_type"])."&nbsp;:&nbsp;\"".$val[ "old_value"]."\"&nbsp;<strong>--></strong>&nbsp;\"".$val[ "new_value"]."\"".crlf;   
                                break;

                            case HISTORY_DELETE_DEVICE :
                                $field=getDeviceTypeLabel($val["device_internal_type"]);
                                $change = $change.$date_mod."   |".$field.": ".$lang["devices"][26]."&nbsp;<strong>:</strong>&nbsp;"."\"".$val["old_value"]."\"".crlf;   
                                break;
                            case HISTORY_INSTALL_SOFTWARE :
                                $field=$lang["software"][10];
                                $change = $change.$date_mod."   |".$lang["software"][44]."&nbsp;<strong>:</strong>&nbsp;"."\"".$val["new_value"]."\"".crlf;   
                                break;               
                            case HISTORY_UNINSTALL_SOFTWARE :
                                $field=$lang["software"][10];
                                $change = $change.$date_mod."   |".$lang["software"][45]."&nbsp;<strong>:</strong>&nbsp;"."\"".$val["old_value"]."\"".crlf;   
                                break;               
                        }

                    }else{
                        // It's not an internal device
                       
                        foreach($SEARCH_OPTION[COMPUTER_TYPE] as $key2 => $val2){

                            if($key2==$val["id_search_option"]){
                                $field= $val2["name"];
                            }
                        }

                    $change = $change.$date_mod."   |".$field.": "."\"".$val[ "old_value"]."\"&nbsp;<strong>--></strong>&nbsp;\"".$val[ "new_value"]."\"".crlf;
                    }// fin du else
               

                $nompc=$val[ "name"];
                // show line

            }//end while ($val = mysql_fetch_array($result)){

        echo "<tr class='tab_bg_2'>";
        echo "<td>$nompc</td><td width='60%'>$change<BR></td>";
        echo "</tr>";


       

    }//end while ($val2 = mysql_fetch_array($result2)){
echo "</table></div>";
}//end if

?>



Je ne suis pas un expert du codage, donc si quelqu'un veut le remettre en etat.....le principal pour moi etant qu'il fonctionne...

@ bientot

Patrick

Offline

#4 2010-02-11 10:40:29

nakaora
Member
From: Luxemburg
Registered: 2010-02-08
Posts: 47

Re: Rapport

Chouette initiative mais cela ne marche pas chez moi....
53350246.jpg

Je n'y connais absolument rien mais je pense qu'il y a des erreurs dans le code car j'ai trouvé des anomalies par rapport aux autres rapports:
"<? ...."  à remplacer par "<?php ....", ...

Last edited by nakaora (2010-02-11 11:02:27)


___________________________
Glpi 0.72.3 / Wampserver 2.0
Windows Server 2008 / IE Explorer 7 & 8

Offline

#5 2010-02-12 12:15:15

Moe
Member
Registered: 2010-02-08
Posts: 11

Re: Rapport

Apparemment ce code nécessite des pages php de fonction qui pour toi ne sont pas placées là ou le code les cherches.
D'où le "Failed opening" (nom des pages) in (lieu où il les cherches).

Offline

#6 2010-02-12 13:23:49

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: Rapport

Pour pouvoir vous aider, il faudrait connaitre votre version de glpi.

Mais un truc saute tout de suite au yeux :
include ($phproot . "/inc/includes.php");  => include (GLPI_ROOT . "/inc/includes.php");

De plus, vous avez déjà un rapport : historique des dernières modifications de matériel
rapport limité, car requêter sur toute la table historique avec un parc très important, c'est impossible sans faire fumer la machine.


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

Board footer

Powered by FluxBB