nas commited on 2010-11-29 10:23:44
Showing 54 changed files, with 17 additions and 3 deletions.
... | ... |
@@ -146,6 +146,7 @@ $txt['shd_invalid_relation'] = 'You must provide a valid type of relationship fo |
146 | 146 |
$txt['shd_no_relation_delete'] = 'You cannot delete a relationship that does not exist.'; |
147 | 147 |
$txt['shd_cannot_relate_self'] = 'You cannot make a ticket relate to itself.'; |
148 | 148 |
$txt['shd_split_no_pm'] = 'You must enter a reason for splitting the ticket to send to the ticket owner, or uncheck the option to \'send a PM to the ticket owner\'.'; |
149 |
+$txt['shd_relationships_are_disabled'] = 'Ticket relationships are currently disabled.'; |
|
149 | 150 |
|
150 | 151 |
// The main Helpdesk. |
151 | 152 |
$txt['shd_home'] = 'Helpdesk'; // separate string in case someone wants to change it independently of the main menu |
... | ... |
@@ -161,6 +161,8 @@ $txt['shd_privacy_display_always'] = 'Always display the ticket\'s privacy setti |
161 | 161 |
$txt['shd_privacy_display_note'] = 'Normally tickets are limited to user seeing their own and staff seeing all users. There are times you might want staff to be able to create tickets only for senior staff to see - this is a "private" ticket. Since "non-private" might be confusing for regular users, this option allows you to hide the display of "non private" or "private" to only when it is appropriate on a ticket.'; |
162 | 162 |
$txt['shd_disable_tickettotopic'] = 'Disable "ticket to topic" options'; |
163 | 163 |
$txt['shd_disable_tickettotopic_note'] = 'Normally, it is possible to move tickets to topics and back again (except in Standalone mode), this option denies it for all users regardless of any permissions for it.'; |
164 |
+$txt['shd_disable_relationships'] = 'Disable relationships'; |
|
165 |
+$txt['shd_disable_relationships_note'] = 'Disable tickets from having "relationships" with each other, regardless of any permissions for it.'; |
|
164 | 166 |
//@} |
165 | 167 |
|
166 | 168 |
//! @name Configuration items on the Standalone Options page |
... | ... |
@@ -432,6 +432,7 @@ function shd_modify_posting_options($return_config) |
432 | 432 |
* </ul> |
433 | 433 |
* </li> |
434 | 434 |
* <li>'shd_disable_tickettotopic' (checkbox) - if checked, ticket to topic mode is entirely disabled.</li> |
435 |
+ * <li>'shd_disable_relationships' (checkbox) - if checked, relationships are entirely disabled.</li> |
|
435 | 436 |
* </ul> |
436 | 437 |
* |
437 | 438 |
* @param bool $return_config Whether to return configuration items or not; this is provided solely for SMF ACP compatibility (it expects to pass bool true in to get a list of options) |
... | ... |
@@ -450,6 +451,7 @@ function shd_modify_admin_options($return_config) |
450 | 451 |
array('check', 'shd_admins_not_assignable'), |
451 | 452 |
array('select', 'shd_privacy_display', array('smart' => $txt['shd_privacy_display_smart'], 'always' => $txt['shd_privacy_display_always']), 'subtext' => $txt['shd_privacy_display_note']), |
452 | 453 |
array('check' , 'shd_disable_tickettotopic', 'subtext' => $txt['shd_disable_tickettotopic_note'], 'disabled' => !empty($modSettings['shd_helpdesk_only'])), |
454 |
+ array('check' , 'shd_disable_relationships', 'subtext' => $txt['shd_disable_relationships_note']), |
|
453 | 455 |
); |
454 | 456 |
$context['settings_title'] = $txt['shd_admin_options_admin']; |
455 | 457 |
$context['settings_icon'] = 'admin.png'; |
... | ... |
@@ -542,7 +544,7 @@ function shd_modify_actionlog_options($return_config) |
542 | 544 |
array('check', 'shd_logopt_delete', 'disabled' => !empty($modSettings['shd_disable_action_log'])), |
543 | 545 |
array('check', 'shd_logopt_restore', 'disabled' => !empty($modSettings['shd_disable_action_log'])), |
544 | 546 |
array('check', 'shd_logopt_permadelete', 'disabled' => !empty($modSettings['shd_disable_action_log'])), |
545 |
- array('check', 'shd_logopt_relationships', 'disabled' => !empty($modSettings['shd_disable_action_log'])), |
|
547 |
+ array('check', 'shd_logopt_relationships', 'disabled' => (!empty($modSettings['shd_disable_action_log']) || !empty($modSettings['shd_disable_relationships']))), |
|
546 | 548 |
array('check', 'shd_logopt_split', 'disabled' => !empty($modSettings['shd_disable_action_log'])), |
547 | 549 |
); |
548 | 550 |
$context['settings_title'] = $txt['shd_admin_options_actionlog']; |
... | ... |
@@ -549,7 +549,7 @@ function shd_view_ticket() |
549 | 549 |
|
550 | 550 |
// Lastly, what about related tickets? |
551 | 551 |
$context['create_relationships'] = shd_allowed_to('shd_create_relationships'); |
552 |
- $context['display_relationships'] = shd_allowed_to('shd_view_relationships') || $context['create_relationships']; |
|
552 |
+ $context['display_relationships'] = ((shd_allowed_to('shd_view_relationships') || $context['create_relationships']) && empty($modSettings['shd_disable_relationships'])); |
|
553 | 553 |
$context['delete_relationships'] = shd_allowed_to('shd_delete_relationships'); |
554 | 554 |
if (!empty($context['display_relationships'])) |
555 | 555 |
{ |
... | ... |
@@ -101,6 +101,8 @@ function shd_ticket_resolve() |
101 | 101 |
fatal_lang_error('shd_cannot_resolve', false); |
102 | 102 |
|
103 | 103 |
// OK, so what about any children related tickets that are still open? Eeek, could be awkward. |
104 |
+ if(empty($modSettings['shd_disable_relationships'])) |
|
105 |
+ { |
|
104 | 106 |
$query = shd_db_query('', ' |
105 | 107 |
SELECT COUNT(hdt.id_ticket) |
106 | 108 |
FROM {db_prefix}helpdesk_relationships AS rel |
... | ... |
@@ -118,6 +120,7 @@ function shd_ticket_resolve() |
118 | 120 |
$smcFunc['db_free_result']($query); |
119 | 121 |
if (!empty($count_children)) |
120 | 122 |
fatal_lang_error('error_shd_cannot_resolve_children', false); |
123 |
+ } |
|
121 | 124 |
|
122 | 125 |
$action = ($row['status'] != TICKET_STATUS_CLOSED) ? 'resolve' : 'unresolve'; |
123 | 126 |
$new = shd_determine_status($action, $row['id_member_started'], $row['id_member_updated'], $row['num_replies']); |
... | ... |
@@ -298,10 +301,13 @@ function shd_urgency_change_noajax() |
298 | 301 |
*/ |
299 | 302 |
function shd_ticket_relation() |
300 | 303 |
{ |
301 |
- global $context, $smcFunc; |
|
304 |
+ global $context, $smcFunc, $modSettings; |
|
302 | 305 |
|
303 | 306 |
checkSession('request'); |
304 | 307 |
|
308 |
+ if(!empty($modSettings['shd_disable_relationships'])) |
|
309 |
+ fatal_lang_error('shd_relationships_are_disabled', false); |
|
310 |
+ |
|
305 | 311 |
$otherticket = isset($_REQUEST['otherticket']) ? (int) $_REQUEST['otherticket'] : 0; |
306 | 312 |
|
307 | 313 |
if (empty($context['ticket_id']) || empty($otherticket)) |
... | ... |
@@ -1880,6 +1880,9 @@ function shd_check_dependencies() |
1880 | 1880 |
{ |
1881 | 1881 |
global $context, $smcFunc; |
1882 | 1882 |
|
1883 |
+ if(!empty($modSettings['shd_disable_relationships'])) |
|
1884 |
+ return ''; |
|
1885 |
+ |
|
1883 | 1886 |
// OK, so what about any children related tickets that are still open? Eeek, could be awkward. |
1884 | 1887 |
$query = shd_db_query('', ' |
1885 | 1888 |
SELECT COUNT(hdt.id_ticket) |
1886 | 1889 |