Ces modifications sont basé sur la version 3.1.7
1°) passer le script en BDD : il ajoute un droit "voir les tickets du services"
Code : Tout sélectionner
alter table `trights`add column `side_service` int(1) NOT NULL COMMENT 'Affiche la section service'
2°) Modifier login.php
ajouter le code ci-dessous au début du fichier (ligne 30)
Code : Tout sélectionner
// MODIF AMR pour la gestion des group d'utilisateurs
if(!isset($u_group)) $u_group = '';
if(!isset($_GET['u_group'])) $_GET['u_group'] = '';
// fin modif AMR
Code : Tout sélectionner
// MODIF AMR pour la gestion des group d'utilisateurs
$query = $db->query("SELECT * FROM `tgroups_assoc` where user ='$user_id' ");
while ($row = $query->fetch())
{
$u_group=$row['group'];
$_SESSION['u_group'] = "$u_group";
}
// fin modif AMR
3°) Modifier le fichier Menu.php
modifier le paragraphe
Code : Tout sélectionner
<ul class=\"submenu\" >";
//display all states link
if ($_GET['page']=='dashboard' && $_GET['userid']!='%' && $_GET['state']=='%') {echo '<li class="active">';} else {echo "<li>";} echo "
<a href=\"./index.php?page=dashboard&userid=$_SESSION[user_id]&state=%&ticket=%&\">
<i class=\"icon-double-angle-right\"></i>
Tous les états ($cntall[0])
</a>
</li>";
//display meta states link
if ($rparameters['meta_state']==1 && $rright['side_your_meta']!=0)
{
$query=$db->query("SELECT count(*) FROM `tincidents` WHERE $profile='$uid' and disable='0' and (state=1 OR state=2 OR state=6)");
$cntmeta=$query->fetch();
$query->closeCursor();
if ($_GET['page']=='dashboard' && $_GET['userid']!='%' && $_GET['state']=='meta') {echo '<li class="active">';} else {echo "<li>";} echo "
<a title=\"Meta-état regroupant les états: Attente de PEC, En cours, et Attente de retour.\" href=\"./index.php?page=dashboard&userid=$_SESSION[user_id]&state=meta\">
<i class=\"icon-double-angle-right\"></i>
A traiter ($cntmeta[0])
</a>
</li>";
}
//display unread ticket
if ($cnt3[0]>0 && $rright['side_your_not_read']!=0)
{
if ($_GET['techread']!='' && $_GET['page']!='searchengine') echo '<li class="active">'; else echo '<li>'; echo '
<a href="./index.php?page=dashboard&userid='.$_SESSION['user_id'].'&techread=0">
<i class="icon-double-angle-right"></i>
Non lus ('.$cnt3[0].') <i title="Des tickets non lus sont en attente" class="icon-warning-sign light-orange bigger-130"></i>
</a>
</li>';
}
//foreach state display in sub-menu
$query = $db->query("SELECT * FROM `tstates` WHERE id not like 5 ORDER BY number");
while ($row = $query->fetch())
{
$query2=$db->query("SELECT count(*) FROM `tincidents` WHERE $profile='$uid' and state LIKE '$row[id]' and disable='0'");
$cnt=$query2->fetch();
$query2->closeCursor();
echo '
<li';
if ($_GET['page']=='dashboard' && $_GET['userid']!='%' && $_GET['state']==$row['id']) echo ' class="active"';
echo '>
<a title="'.$row['description'].'" href="./index.php?page=dashboard&userid='.$_SESSION['user_id'].'&state='.$row['id'].'">
<i class="icon-double-angle-right"></i>
'.$row['name'].' ('.$cnt[0].')
</a>
</li>';
}
$query->closeCursor();
echo "
</ul>
par
Code : Tout sélectionner
<ul class=\"submenu\" >";
//display all states link
if ($_GET['page']=='dashboard' && $_GET['user']!='S' && $_GET['userid']!='%' && $_GET['state']=='%') {echo '<li class="active">';} else {echo "<li>";} echo "
<a href=\"./index.php?page=dashboard&userid=$_SESSION[user_id]&state=%&ticket=%&\">
<i class=\"icon-double-angle-right\"></i>
Tous les états ($cntall[0])
</a>
</li>";
//display meta states link
if ($rparameters['meta_state']==1 && $rright['side_your_meta']!=0)
{
$query=$db->query("SELECT count(*) FROM `tincidents` WHERE $profile='$uid' and disable='0' and (state=1 OR state=2 OR state=6)");
$cntmeta=$query->fetch();
$query->closeCursor();
if ($_GET['page']=='dashboard' && $_GET['user']!='S' && $_GET['userid']!='%' && $_GET['state']=='meta') {echo '<li class="active">';} else {echo "<li>";} echo "
<a title=\"Meta-état regroupant les états: Attente de PEC, En cours, et Attente de retour.\" href=\"./index.php?page=dashboard&userid=$_SESSION[user_id]&state=meta\">
<i class=\"icon-double-angle-right\"></i>
A traiter ($cntmeta[0])
</a>
</li>";
}
//display unread ticket
if ($cnt3[0]>0 && $rright['side_your_not_read']!=0)
{
if ($_GET['techread']!='' && $_GET['page']!='searchengine') echo '<li class="active">'; else echo '<li>'; echo '
<a href="./index.php?page=dashboard&userid='.$_SESSION['user_id'].'&techread=0">
<i class="icon-double-angle-right"></i>
Non lus ('.$cnt3[0].') <i title="Des tickets non lus sont en attente" class="icon-warning-sign light-orange bigger-130"></i>
</a>
</li>';
}
//foreach state display in sub-menu
$query = $db->query("SELECT * FROM `tstates` WHERE id not like 5 ORDER BY number");
while ($row = $query->fetch())
{
$query2=$db->query("SELECT count(*) FROM `tincidents` WHERE $profile='$uid' and state LIKE '$row[id]' and disable='0'");
$cnt=$query2->fetch();
$query2->closeCursor();
echo '
<li';
if ($_GET['page']=='dashboard' && $_GET['user']!='S' && $_GET['userid']!='%' && $_GET['state']==$row['id']) echo ' class="active"';
echo '>
<a title="'.$row['description'].'" href="./index.php?page=dashboard&userid='.$_SESSION['user_id'].'&state='.$row['id'].'">
<i class="icon-double-angle-right"></i>
'.$row['name'].' ('.$cnt[0].')
</a>
</li>';
}
$query->closeCursor();
echo "
</ul>
ajouter avant la ligne if ($rright['side_all']!=0)
Code : Tout sélectionner
// MODIF AMR pour la gestion des group d'utilisateurs
if ($rright['side_service']!=0)
{
echo "
<li class='active'>
<a href=\"./index.php?page=dashboard&userid=%&state=%\" class=\"dropdown-toggle\" >
<i class=\"icon-ticket\"></i>
<span class=\"menu-text\">
Les tickets du service
</span>
<b class=\"arrow icon-angle-down\"></b>
</a>
<ul class=\"submenu\" >";
$query2=$db->query("SELECT count(*) FROM `tincidents` WHERE (tincidents.u_group LIKE '$_GET[u_group]' or tincidents.user in (select user FROM `tgroups_assoc` where `group` = '$_GET[u_group]')) and state LIKE '$row[id]' and disable='0'");
$cnt=$query2->fetch();
$query2->closeCursor();
if ($_GET['page']=='dashboard' && $_GET['user']='S' && $_GET['state']=='%') {echo '<li class="active">';} else {echo "<li>";} echo "
<a href=\"./index.php?page=dashboard&u_group=$_SESSION[u_group]&userid=$_SESSION[user_id]&state=%&ticket=%&user=S\">
<i class=\"icon-double-angle-right\"></i>
Tous les états (".$cnt[0].")
</a>
</li>";
$query->closeCursor();
//foreach state display in sub-menu
$query = $db->query("SELECT * FROM `tstates` WHERE id not like 5 ORDER BY number");
while ($row = $query->fetch())
{
$query2=$db->query("SELECT count(*) FROM `tincidents` WHERE (tincidents.u_group LIKE '$_GET[u_group]' or tincidents.user in (select user FROM `tgroups_assoc` where `group` = '$_GET[u_group]')) and state LIKE '$row[id]' and disable='0'");
$cnt=$query2->fetch();
$query2->closeCursor();
echo '
<li';
if ($_GET['page']=='dashboard' && $_GET['user']='S' && $_GET['state']==$row['id']) echo ' class="active"';
echo '>
<a title="'.$row['description'].'" href="./index.php?page=dashboard&userid='.$_SESSION['user_id'].'&user=S&u_group='.$_SESSION['u_group'].'&state='.$row['id'].'">
<i class="icon-double-angle-right"></i>
'.$row['name'].' ('.$cnt[0].')
</a>
</li>';
}
$query->closeCursor();
echo "
</ul>
</li>";
}
// fin modif AMR
remplacer
Code : Tout sélectionner
//security check for page
if((($_SESSION['profile_id']!=4 && $_SESSION['profile_id']!=0 && $_SESSION['profile_id']!=3) && ($_SESSION['user_id']!=$_GET['userid'])) || (($_SESSION['profile_id']!=4 && $_SESSION['profile_id']!=0 && $_SESSION['profile_id']!=3) &&($rticket[0]!=$_SESSION['user_id'])))
{
if ($_GET['page']=='plugins/availability/index' && $rright['availability']!=0 && $rparameters['availability']==1)
{include("$_GET[page].php");}
elseif ($_GET['page']=='asset_list' && $rright['asset']!=0 && $rparameters['asset']==1) {include("$_GET[page].php");}
else
echo '<div class="alert alert-danger"><strong><i class="icon-remove"></i>Erreur:</strong> Vous n\'avez pas les droits d\'accès a cette page, contacter votre administrateur.<br></div>';
} else {
include("$_GET[page].php");
}
par
Code : Tout sélectionner
// Modif AMR pour la gestion des droits par service
if( $_GET['user']==S && ($_SESSION['u_group']==$_GET['u_group'])) {
include("$_GET[page].php");
} else {
if((($_SESSION['profile_id']!=4 && $_SESSION['profile_id']!=0 && $_SESSION['profile_id']!=3) && ($_SESSION['user_id']!=$_GET['userid']))
|| (($_SESSION['profile_id']!=4 && $_SESSION['profile_id']!=0 && $_SESSION['profile_id']!=3) &&($rticket[0]!=$_SESSION['user_id']))
)
{
if ($_GET['page']=='plugins/availability/index' && $rright['availability']!=0 && $rparameters['availability']==1)
{include("$_GET[page].php");}
elseif ($_GET['page']=='asset_list' && $rright['asset']!=0 && $rparameters['asset']==1) {include("$_GET[page].php");}
else
echo '<div class="alert alert-danger"><strong><i class="icon-remove"></i>Erreur:</strong> Vous n\'avez pas les droits d\'accès a cette page, contacter votre administrateur.<br></div>';
} else {
include("$_GET[page].php");
}
}
//fin modif AMR
5°) Modifier dashboard.php
remplacer
Code : Tout sélectionner
$from.="
AND tincidents.user LIKE '$_POST[user]'
AND tincidents.u_group LIKE '$_GET[u_group]'
AND tincidents.technician LIKE '$_POST[technician]'
AND tincidents.t_group LIKE '$_GET[t_group]'
AND tincidents.techread LIKE '$_GET[techread]'
AND tincidents.disable='0'
AND (tincidents.category LIKE '$_POST[category]')
AND tincidents.subcat LIKE '$_POST[subcat]'
AND tincidents.id LIKE '$_POST[ticket]'
AND tincidents.user LIKE '$_POST[userid]'
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
$state
AND tincidents.priority LIKE '$_POST[priority]'
AND tincidents.criticality LIKE '$_POST[criticality]'
AND tincidents.title LIKE '%$_POST[title]%'
";
Code : Tout sélectionner
// MODIF AMR pour la gestion des group d'utilisateurs
$from.="
AND ( tincidents.u_group LIKE '$_GET[u_group]' or tincidents.user in (select user FROM `tgroups_assoc` where `group` = '$_GET[u_group]'))
AND tincidents.technician LIKE '$_POST[technician]'
AND tincidents.t_group LIKE '$_GET[t_group]'
AND tincidents.techread LIKE '$_GET[techread]'
AND tincidents.disable='0'
AND (tincidents.category LIKE '$_POST[category]')
AND tincidents.subcat LIKE '$_POST[subcat]'
AND tincidents.id LIKE '$_POST[ticket]'";
if (substr($_GET['u_group'], 0, 1) =='' || substr($_GET['u_group'], 0, 1) =='%')
$from.="AND tincidents.user LIKE '$_POST[userid]' AND tincidents.user LIKE '$_POST[user]'";
else $from.="AND tincidents.user LIKE '%'";
$from.="
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
$state
AND tincidents.priority LIKE '$_POST[priority]'
AND tincidents.criticality LIKE '$_POST[criticality]'
AND tincidents.title LIKE '%$_POST[title]%'
";
// fin MODIF AMR pour la gestion des group d'utilisateurs
et
if($_GET['userid']=='%')
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> Tous les tickets';} else {echo '<i class="icon-ticket"></i> Tous les '.$rstate['description'].'';}
}
else if ($_GET['userid']!='0')
par
if($_GET['userid']=='%')
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> Tous les tickets';} else {echo '<i class="icon-ticket"></i> Tous les '.$rstate['description'].'';}
}
//modif AMR pour la gestion du service
else if (substr($_GET['u_group'], 0, 1) !='' && substr($_GET['u_group'], 0, 1) !='%')
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> Tous les tickets du Service';} else {echo '<i class="icon-ticket"></i> Tous les '.$rstate['description'].' du service';}
}
// fin modif AMR
else if ($_GET['userid']!='0')
Code : Tout sélectionner
//generate open ticket link
$open_ticket_link="./index.php?page=ticket&id=$row[id]&state=$_GET[state]&userid=$_GET[userid]&technician=$_GET[technician]&category=$_GET[category]&subcat=$_GET[subcat]&title=$_GET[title]&date_create=$_GET[date_create]&priority=$_GET[priority]&criticality=$_GET[criticality]&viewid=$_GET[viewid]";
par
//generate open ticket link
// modif AMR pour la gestion du service
if (substr($_GET['u_group'], 0, 1) !='' && substr($_GET['u_group'], 0, 1) !='%') $open_ticket_link="./index.php?page=ticket&id=$row[id]&state=$_GET[state]&u_group=$_SESSION[u_group]&user=S&technician=$_GET[technician]&category=$_GET[category]&subcat=$_GET[subcat]&title=$_GET[title]&date_create=$_GET[date_create]&priority=$_GET[priority]&criticality=$_GET[criticality]&viewid=$_GET[viewid]";
else $open_ticket_link="./index.php?page=ticket&id=$row[id]&state=$_GET[state]&userid=$_GET[userid]&technician=$_GET[technician]&category=$_GET[category]&subcat=$_GET[subcat]&title=$_GET[title]&date_create=$_GET[date_create]&priority=$_GET[priority]&criticality=$_GET[criticality]&viewid=$_GET[viewid]";
// fin modif AMR
6°) modifier core/ticket.php
remplacer
Code : Tout sélectionner
window.location='./index.php?page=ticket&id=$_GET[id]&userid=$_GET[userid]&state=$_GET[state]&category=$_GET[category]&subcat=$_GET[subcat]&viewid=$_GET[viewid]&action=$_POST[action]&edituser=$_POST[edituser]&cat=$_POST[category]&editcat=$_POST[subcat]$down'
par
Code : Tout sélectionner
window.location='./index.php?page=ticket&id=$_GET[id]&userid=$_GET[userid]&state=$_GET[state]&u_group=$_GET[u_group]&user=$_GET[user]&category=$_GET[category]&subcat=$_GET[subcat]&viewid=$_GET[viewid]&action=$_POST[action]&edituser=$_POST[edituser]&cat=$_POST[category]&editcat=$_POST[subcat]$down'