You are not logged in.
Bonjour,
voici un petit code qui permet à la personne qui se connecte de voir tout de suite les tickets assignés au groupe auquel il appartient dans la page d'accueil, par contre il faut absolument que chaque persone ne soit que dans un seul groupe ....
Ce n'est pas grand chose mais cela peut aider certain comme cela m'a aidé ! donc voici ma très modeste contribution
Voici la fonction showCentralJobList modifé (ligne 168) du fichier inc/tracking_function.php
function showCentralJobList($target,$start,$status="process") {
// Lists all Jobs, needs $show which can have keywords
// (individual, unassigned) and $contains with search terms.
// If $item is given, only jobs for a particular machine
// are listed.
global $db,$cfg_glpi, $lang, $HTMLRel;
// début de modif pour voir les tickets de son groupe
if (!haveRight("show_ticket","1")) return false;
$query = "SELECT * FROM glpi_users_groups where FK_users=".$_SESSION["glpiID"]."";
$result = $db->query($query);
while($line = $db->fetch_array($result)) {
$group_id=$line["FK_groups"];
}
if($status=="waiting"){ // on affiche les tickets en attente
$query = "SELECT ID FROM glpi_tracking WHERE (assign = '".$_SESSION["glpiID"]."') AND (status ='waiting' )";
if (isset($group_id)){
$query2 = "SELECT * FROM glpi_users_groups where FK_groups=".$group_id."";
$result2 = $db->query($query2);
$group_u=array();
$t=0;
while($line2 = $db->fetch_array($result2)) {
$group_users=$line2["FK_users"];
#print $group_users."\n";
array_push ($group_u , $group_users);
$t++;
}
#print_r ($group_u);
foreach ($group_u as $gpu){
if ($t>0) $query= $query." OR ";
$query =$query." assign = '$gpu' AND (status ='waiting' )";
}
}
$query = $query."ORDER BY date ".getTrackingOrderPrefs($_SESSION["glpiID"]);
#print $query;
$title=$lang["central"][11];
}else{ // on affiche les tickets planifiés ou assignés à glpiID
$query = "SELECT ID FROM glpi_tracking WHERE (assign = '".$_SESSION["glpiID"]."') AND (status ='plan' OR status = 'assign' OR status = 'new')";
if (isset($group_id)){
$query2 = "SELECT * FROM glpi_users_groups where FK_groups=".$group_id."";
$result2 = $db->query($query2);
$group_u=array();
$t=0;
while($line2 = $db->fetch_array($result2)) {
$group_users=$line2["FK_users"];
#print $group_users."\n";
array_push ($group_u , $group_users);
$t++;
}
#print_r ($group_u);
foreach ($group_u as $gpu){
if ($t>0) $query = $query." OR ";
$query = $query." assign = '$gpu' AND (status ='plan' OR status = 'assign' OR status = 'new')";
}
}
$query = $query."ORDER BY date ".getTrackingOrderPrefs($_SESSION["glpiID"]);
print $query;
$title=$lang["central"][9];
}
// fin de modif pour voir les tickets de son groupe
$lim_query = " LIMIT ".$start.",".$cfg_glpi["list_limit"]."";
$result = $db->query($query);
$numrows = $db->numrows($result);
$query .= $lim_query;
$result = $db->query($query);
$i = 0;
$number = $db->numrows($result);
if ($number > 0) {
echo "<div align='center'>";
echo "<table class='tab_cadrehov'>";
echo "<tr><th colspan='5'><b><a href=\"".$cfg_glpi["root_doc"]."/front/tracking.php?assign=".$_SESSION["glpiID"]."&status=$status&reset=reset_before\">".$title."</a></b></th></tr>";
echo "<tr><th></th>";
echo "<th>".$lang["common"][37]."</th>";
echo "<th>".$lang["common"][1]."</th>";
echo "<th colspan='2'>".$lang["joblist"][6]."</th></tr>";
while ($i < $number) {
$ID = $db->result($result, $i, "ID");
showJobVeryShort($ID);
$i++;
}
echo "</table>";
echo "<br><div align='center'>";
}
else
{
echo "<br><div align='center'>";
echo "<table class='tab_cadrehov'>";
echo "<tr><th>".$title."</th></tr>";
echo "</table>";
echo "</div><br>";
}
}
Voila ... et merci à GLPI
Last edited by aldebaran00 (2007-03-30 17:59:27)
Offline