I've had a few admins in my organization make extensive use of the Approval
feature in GLPI, and they requested a section in the central dashboard (when
you first login to GLPI) that shows tickets that have had their approval
request rejected.  I figured that is an important enough situation
it warrants being on the dashboard.  This patch just adds those items to the
dashboard.  I've also attached a screenshot of how it looks currently.  If
there are no rejected tickets then it shows as empty with the header as
plain text (no link).  You'll have to excuse the colors, I've made some
tweaks to the CSS to "brand" our install of GLPI.


Thanks
- Trey
From 80dd0fe096920cc155abb9c8d953b6e3cc0b5c0d Mon Sep 17 00:00:00 2001
From: Trey <treyd...@tamu.edu>
Date: Wed, 13 Jul 2011 15:46:38 -0500
Subject: [PATCH 1/2] - Initial changes to add "rejected" approval requests to the dashboard

---
 inc/central.class.php |    3 +++
 inc/ticket.class.php  |   27 +++++++++++++++++++++++++++
 locales/en_GB.php     |    3 ++-
 3 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/inc/central.class.php b/inc/central.class.php
index f11b4e4..9850bb4 100644
--- a/inc/central.class.php
+++ b/inc/central.class.php
@@ -118,6 +118,9 @@ class Central extends CommonGLPI {
       Ticket::showCentralList(0, "toapprove", false);
       echo "</td></tr>";
       echo "<tr><td class='top' width='450px'>";
+      Ticket::showCentralList(0, "rejected", false);
+      echo "</td></tr>";
+      echo "<tr><td class='top' width='450px'>";
       Ticket::showCentralList(0, "requestbyself", false);
       echo "</td></tr>";
       if ($showticket) {
diff --git a/inc/ticket.class.php b/inc/ticket.class.php
index 9e07544..2a6ea3b 100644
--- a/inc/ticket.class.php
+++ b/inc/ticket.class.php
@@ -4776,6 +4776,12 @@ class Ticket extends CommonDBTM {
                               getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
 
+         case "rejected" : // on affiche les tickets en attente
+            $query .= "WHERE ($search_assign)
+                             AND `global_validation` = 'rejected' ".
+                             getEntitiesRestrictRequest("AND", "glpi_tickets");
+            break;
+
          case "requestbyself" : // on affiche les tickets demandés le user qui sont planifiés ou assignés
                // à quelqu'un d'autre (exclut les self-tickets)
 
@@ -4923,6 +4929,23 @@ class Ticket extends CommonDBTM {
 
                   break;
 
+               case "rejected" :
+                  $options['field'][0]      = 52; // validation status
+                  $options['searchtype'][0] = 'equals';
+                  $options['contains'][0]   = 'rejected';
+                  $options['link'][0]        = 'AND';
+
+                  $options['field'][1]      = 5; // validation aprobator
+                  $options['searchtype'][1] = 'equals';
+                  $options['contains'][1]   = getLoginUserID();
+                  $options['link'][1]        = 'AND';
+
+                  echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/ticket.php?".
+                        append_params($options,'&amp;')."\">".$LANG['central'][20]."</a>";
+
+                  break;
+
+
                case "toapprove" :
                   $options['field'][0]      = 12; // status
                   $options['searchtype'][0] = 'equals';
@@ -4993,6 +5016,10 @@ class Ticket extends CommonDBTM {
                echo $LANG['central'][19];
                break;
 
+            case 'rejected' :
+               echo $LANG['central'][20];
+               break;
+
             case 'toapprove' :
                echo $LANG['central'][18];
                break;
diff --git a/locales/en_GB.php b/locales/en_GB.php
index b5850a5..71249f1 100644
--- a/locales/en_GB.php
+++ b/locales/en_GB.php
@@ -194,6 +194,7 @@ $LANG['central'][13]="Global View";
 $LANG['central'][14]="Group View"; 
 $LANG['central'][18]="Your tickets to close"; 
 $LANG['central'][19]="Your tickets to validate"; 
+$LANG['central'][20]="Your tickets with rejected approval";
 
 $LANG['choice'][0]="No"; 
 $LANG['choice'][1]="Yes"; 
@@ -2135,4 +2136,4 @@ $LANG['validation'][30]="Cancel the approval request to";
 $LANG['validation'][31]="Update the Approval request to"; 
 $LANG['validation'][32]="An answer to a Approval request was produced"; 
 $LANG['validation'][33]="Tickets awaiting approval"; 
-?>
\ No newline at end of file
+?>
-- 
1.7.4.1

<<attachment: glpi_rejected_tickets.png>>

_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev

Reply via email to