diff --git a/include/class.config.php b/include/class.config.php index 41ee9a88779583742ecb9e977143a068b09a6ab6..66a3232b2518fd13954b7ef924d8daa19461344d 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -198,6 +198,7 @@ class OsticketConfig extends Config { 'client_name_format' => 'original', # As entered 'auto_claim_tickets'=> true, 'collaborator_ticket_visibility' => true, + 'require_topic_to_close' => false, 'system_language' => 'en_US', 'default_storage_bk' => 'D', 'message_autoresponder_collabs' => true, @@ -924,6 +925,10 @@ class OsticketConfig extends Config { return $this->get('collaborator_ticket_visibility'); } + function requireTopicToClose() { + return $this->get('require_topic_to_close'); + } + function getDefaultTicketQueueId() { return $this->get('default_ticket_queue'); } @@ -1277,6 +1282,7 @@ class OsticketConfig extends Config { 'enable_captcha'=>isset($vars['enable_captcha'])?1:0, 'auto_claim_tickets'=>isset($vars['auto_claim_tickets'])?1:0, 'collaborator_ticket_visibility'=>isset($vars['collaborator_ticket_visibility'])?1:0, + 'require_topic_to_close'=>isset($vars['require_topic_to_close'])?1:0, 'show_related_tickets'=>isset($vars['show_related_tickets'])?1:0, 'allow_client_updates'=>isset($vars['allow_client_updates'])?1:0, 'ticket_lock' => $vars['ticket_lock'], diff --git a/include/class.ticket.php b/include/class.ticket.php index 4a84e7757131b0456f47c44ca20c2603a3b877d6..75c818b405e287edaa6c68c4a4cb7836686c9b9f 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -229,6 +229,7 @@ implements RestrictedAccess, Threadable, Searchable { } function isCloseable() { + global $cfg; if ($this->isClosed()) return true; @@ -242,6 +243,10 @@ implements RestrictedAccess, Threadable, Searchable { } elseif (($num=$this->getNumOpenTasks())) { $warning = sprintf(__('%1$s has %2$d open tasks and cannot be closed'), __('This ticket'), $num); + } elseif ($cfg->requireTopicToClose() && !$this->getTopicId()) { + $warning = sprintf( + __( '%1$s is missing a %2$s and cannot be closed'), + __('This ticket'), __('Help Topic'), ''); } return $warning ?: true; diff --git a/include/i18n/en_US/config.yaml b/include/i18n/en_US/config.yaml index 4d1f67f410f8f2561a68d39affc5d88e93a91559..731e51eb297b2e37469d40562c7cf23d4b28300e 100644 --- a/include/i18n/en_US/config.yaml +++ b/include/i18n/en_US/config.yaml @@ -68,6 +68,7 @@ core: assigned_alert_team_members: 0 auto_claim_tickets: 1 collaborator_ticket_visibility: 1 + require_topic_to_close: 0 show_related_tickets: 1 show_assigned_tickets: 1 show_answered_tickets: 0 diff --git a/include/i18n/en_US/help/tips/settings.ticket.yaml b/include/i18n/en_US/help/tips/settings.ticket.yaml index 7d4a72fd2981ca81347d052670c93e470adac79e..3b0c1cea9005b7fea87da7a97a7d9702fda6a8af 100644 --- a/include/i18n/en_US/help/tips/settings.ticket.yaml +++ b/include/i18n/en_US/help/tips/settings.ticket.yaml @@ -103,6 +103,11 @@ collaborator_ticket_visibility: If Disabled, Users will only be able to see their own Tickets when signing into the Web Portal. +require_topic_to_close: + title: Require Help Topic to Close + content: > + If Enabled, a Ticket must have a Help Topic in order to be Closed by an Agent + assigned_tickets: title: Assigned Tickets content: > diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php index 210b6d3f319dd33f9bb6bc20e3b8dca22348b2c5..76db039c0ce14a36de83b1b9240e21e38f42f266 100644 --- a/include/staff/settings-tickets.inc.php +++ b/include/staff/settings-tickets.inc.php @@ -213,6 +213,13 @@ if(!($maxfileuploads=ini_get('max_file_uploads'))) <?php echo __('Enable'); ?> <i class="help-tip icon-question-sign" href="#collaborator_ticket_visibility"></i> </td> </tr> + <tr> + <td><?php echo __('Require Help Topic to Close'); ?>:</td> + <td> + <input type="checkbox" name="require_topic_to_close" <?php echo $config['require_topic_to_close']?'checked="checked"':''; ?>> + <?php echo __('Enable'); ?> <i class="help-tip icon-question-sign" href="#require_topic_to_close"></i> + </td> + </tr> <tr> <th colspan="2"> <em><b><?php echo __('Attachments');?></b>: <?php echo __('Size and maximum uploads setting mainly apply to web tickets.');?></em> diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php index 71d8871e65af1f9ff1b73959b0c0bb043a464c0b..b60812bea046f400a812bbaaed64943903556a16 100644 --- a/include/staff/ticket-edit.inc.php +++ b/include/staff/ticket-edit.inc.php @@ -105,7 +105,14 @@ if ($_POST) } ?> </select> + <?php + if (!$info['topicId'] && $cfg->requireTopicToClose()) { + ?><i class="icon-warning-sign help-tip warning" + data-title="<?php echo __('Required to close ticket'); ?>" + data-content="<?php echo __('Data is required in this field in order to close the related ticket'); ?>" + ></i><?php + } if($warn) { ?> <font class="error"><b>*</b> <?php echo $warn; ?></font> <?php } ?>