From 7129e7531f107aeb7c8703a7fa22736a015f7115 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Mon, 10 Dec 2012 12:04:13 -0500
Subject: [PATCH] Add 2 new permission settings for groups. 1) Ability to limit
 who can post a reply 2) Expanded staff's stats view.

---
 include/class.group.php     |  2 ++
 include/class.staff.php     | 10 +++++++++-
 include/staff/group.inc.php | 18 +++++++++++++++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/include/class.group.php b/include/class.group.php
index b13082be9..10a5eadaf 100644
--- a/include/class.group.php
+++ b/include/class.group.php
@@ -209,6 +209,8 @@ class Group {
             .', can_ban_emails='.db_input($vars['can_ban_emails'])
             .', can_manage_premade='.db_input($vars['can_manage_premade'])
             .', can_manage_faq='.db_input($vars['can_manage_faq'])
+            .', can_post_ticket_reply='.db_input($vars['can_post_ticket_reply'])
+            .', can_view_staff_stats='.db_input($vars['can_view_staff_stats'])
             .', notes='.db_input($vars['notes']);
             
         if($id) {
diff --git a/include/class.staff.php b/include/class.staff.php
index 9c6078c7f..102e79ecd 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -302,7 +302,7 @@ class Staff {
     function canEditTickets() {
         return ($this->ht['can_edit_tickets']);
     }
-    
+
     function canDeleteTickets() {
         return ($this->ht['can_delete_tickets']);
     }
@@ -311,6 +311,14 @@ class Staff {
         return ($this->ht['can_close_tickets']);
     }
 
+    function canPostReply() {
+        return ($this->ht['can_post_ticket_reply']);
+    }
+
+    function canViewStaffStats() {
+        return ($this->ht['can_view_staff_stats']);
+    }
+
     function canAssignTickets() {
         return ($this->ht['can_assign_tickets']);
     }
diff --git a/include/staff/group.inc.php b/include/staff/group.inc.php
index f2935d72e..bfcc2a596 100644
--- a/include/staff/group.inc.php
+++ b/include/staff/group.inc.php
@@ -76,6 +76,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 &nbsp;&nbsp;<i>Ability to edit tickets.</i>
             </td>
         </tr>
+        <tr><td>Can <b>Post Reply</b></td>
+            <td>
+                <input type="radio" name="can_post_ticket_reply"  value="1"   <?php echo $info['can_post_ticket_reply']?'checked="checked"':''; ?> />Yes
+                &nbsp;&nbsp;
+                <input type="radio" name="can_post_ticket_reply"  value="0"   <?php echo !$info['can_post_ticket_reply']?'checked="checked"':''; ?> />No
+                &nbsp;&nbsp;<i>Ability to post a ticket reply.</i>
+            </td>
+        </tr>
         <tr><td>Can <b>Close</b> Tickets</td>
             <td>
                 <input type="radio" name="can_close_tickets"  value="1" <?php echo $info['can_close_tickets']?'checked="checked"':''; ?> />Yes
@@ -105,7 +113,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 <input type="radio" name="can_delete_tickets"  value="1"   <?php echo $info['can_delete_tickets']?'checked="checked"':''; ?> />Yes
                 &nbsp;&nbsp;
                 <input type="radio" name="can_delete_tickets"  value="0"   <?php echo !$info['can_delete_tickets']?'checked="checked"':''; ?> />No
-                &nbsp;&nbsp;<i>Deleted tickets can't be recovered!</i>
+                &nbsp;&nbsp;<i>Ability to delete tickets (Deleted tickets can't be recovered!)</i>
             </td>
         </tr>
         <tr><td>Can Ban Emails</td>
@@ -132,6 +140,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
                 &nbsp;&nbsp;<i>Ability to add/update/disable/delete knowledgebase categories and FAQs.</i>
             </td>
         </tr>
+        <tr><td>Can View Staff Stats.</td>
+            <td>
+                <input type="radio" name="can_view_staff_stats"  value="1" <?php echo $info['can_view_staff_stats']?'checked="checked"':''; ?> />Yes
+                &nbsp;&nbsp;
+                <input type="radio" name="can_view_staff_stats"  value="0" <?php echo !$info['can_view_staff_stats']?'checked="checked"':''; ?> />No
+                &nbsp;&nbsp;<i>Ability to view stats of other staff members in allowed departments.</i>
+            </td>
+        </tr>
         <tr>
             <th colspan="2">
                 <em><strong>Department Access</strong>: Check all departments the group members are allowed to access.&nbsp;&nbsp;&nbsp;<a id="selectAll" href="#deptckb">Select All</a>&nbsp;&nbsp;<a id="selectNone" href="#deptckb">Select None</a>&nbsp;&nbsp;</em>
-- 
GitLab