From d5e8ac091252c2e0e547a1867ad1e162ed196911 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 16 Dec 2014 14:49:53 -0600 Subject: [PATCH] ui: Implement "enable canned responses" config option This patch removes the selection of canned responses as well as the canned responses navigation page from the ui when the canned responses feature is disabled. --- include/class.config.php | 4 ++++ include/class.nav.php | 3 ++- include/staff/ticket-view.inc.php | 3 ++- scp/canned.php | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/class.config.php b/include/class.config.php index 04a7cea45..3683399be 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -214,6 +214,10 @@ class OsticketConfig extends Config { return ($this->get('enable_kb') && FAQ::countPublishedFAQs()); } + function isCannedResponseEnabled() { + return $this->get('enable_premade'); + } + function getVersion() { return THIS_VERSION; } diff --git a/include/class.nav.php b/include/class.nav.php index bc4956f08..1c721b854 100644 --- a/include/class.nav.php +++ b/include/class.nav.php @@ -125,6 +125,7 @@ class StaffNav { } function getSubMenus(){ //Private. + global $cfg; $staff = $this->staff; $submenus=array(); @@ -163,7 +164,7 @@ class StaffNav { if($staff) { if($staff->canManageFAQ()) $subnav[]=array('desc'=>__('Categories'),'href'=>'categories.php','iconclass'=>'faq-categories'); - if($staff->canManageCannedResponses()) + if ($cfg->isCannedResponseEnabled() && $staff->canManageCannedResponses()) $subnav[]=array('desc'=>__('Canned Responses'),'href'=>'canned.php','iconclass'=>'canned'); } break; diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 078af3a0a..3ff35ec2b 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -534,6 +534,7 @@ $tcount+= $ticket->getNumNotes(); <label><strong><?php echo __('Response');?>:</strong></label> </td> <td> +<?php if ($cfg->isCannedResponseEnabled()) { ?> <select id="cannedResp" name="cannedResp"> <option value="0" selected="selected"><?php echo __('Select a canned response');?></option> <option value='original'><?php echo __('Original Message'); ?></option> @@ -548,7 +549,7 @@ $tcount+= $ticket->getNumNotes(); ?> </select> <br> - <?php +<?php } # endif (canned-resonse-enabled) $signature = ''; switch ($thisstaff->getDefaultSignatureType()) { case 'dept': diff --git a/scp/canned.php b/scp/canned.php index 5de2f87b5..b44b4067f 100644 --- a/scp/canned.php +++ b/scp/canned.php @@ -17,7 +17,8 @@ require('staff.inc.php'); include_once(INCLUDE_DIR.'class.canned.php'); /* check permission */ -if(!$thisstaff || !$thisstaff->canManageCannedResponses()) { +if(!$thisstaff || !$thisstaff->canManageCannedResponses() + || !$cfg->isCannedResponseEnabled()) { header('Location: kb.php'); exit; } -- GitLab