Skip to content

Commit

Permalink
Filter Canned Responses Page
Browse files Browse the repository at this point in the history
This commit filters Canned Responses so that Agents can only see Canned Responses for Departments they can access (Primary or Extended Access) or Canned Responses assigned to all Departments.
  • Loading branch information
aydreeihn committed Oct 20, 2020
1 parent a2a09d2 commit 5fbd762
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/staff/cannedresponses.inc.php
@@ -1,13 +1,14 @@
<?php
if(!defined('OSTSCPINC') || !$thisstaff) die('Access Denied');

$departments = implode(',', $thisstaff->getDepartments());
$qs = array();
$sql='SELECT canned.*, count(attach.file_id) as files, dept.name as department '.
' FROM '.CANNED_TABLE.' canned '.
' LEFT JOIN '.DEPT_TABLE.' dept ON (dept.id=canned.dept_id) '.
' LEFT JOIN '.ATTACHMENT_TABLE.' attach
ON (attach.object_id=canned.canned_id AND attach.`type`=\'C\' AND NOT attach.inline)';
$sql.=' WHERE 1';
$sql.= sprintf(' WHERE canned.dept_id = 0 OR dept.id IN (%s)', $departments);

$sortOptions=array('title'=>'canned.title','status'=>'canned.isenabled','dept'=>'department','updated'=>'canned.updated');
$orderWays=array('DESC'=>'DESC','ASC'=>'ASC');
Expand Down

0 comments on commit 5fbd762

Please sign in to comment.