gruffen commited on 2011-06-12 06:54:07
Showing 6 changed files, with 49 additions and 1 deletions.
... | ... |
@@ -34,7 +34,7 @@ $txt['shd_open_ticket'] = 'open ticket'; |
34 | 34 |
$txt['shd_open_tickets'] = 'open tickets'; |
35 | 35 |
$txt['shd_none'] = 'None'; |
36 | 36 |
|
37 |
-$txt['shd_display_nojs'] = 'JavaScript is not enabled in your browser. Some functions may not work properly, or behave in an unexpected manner.'; |
|
37 |
+$txt['shd_display_nojs'] = 'JavaScript is not enabled in your browser. Some functions may not work properly (or at all), or behave in an unexpected manner.'; |
|
38 | 38 |
|
39 | 39 |
//! @name Admininstration panel strings |
40 | 40 |
//@{ |
... | ... |
@@ -326,6 +326,19 @@ function shd_list_hooks() |
326 | 326 |
'shd_hook_after_main', // functions to call after action=helpdesk has been evaluated but before template calls are made |
327 | 327 |
'shd_hook_boardindex_before', // functions to call before setting up the injected boardindex |
328 | 328 |
'shd_hook_boardindex_after', // functions to call after setting up the injected boardindex |
329 |
+ 'shd_hook_deleteticket', // functions to call just before actually deleting (softly) a ticket |
|
330 |
+ 'shd_hook_deletereply', // functions to call just before actually deleting (softly) a reply |
|
331 |
+ 'shd_hook_permadeleteticket', // functions to call just before truly deleting a ticket |
|
332 |
+ 'shd_hook_permadeletereply', // functions to call just before truly deleting a reply |
|
333 |
+ 'shd_hook_restoreticket', // functions to call just before restoring a previously deleted ticket |
|
334 |
+ 'shd_hook_restorereply', // functions to call just before restoring a previously deleted reply |
|
335 |
+ 'shd_hook_markunread', // functions to call just before marking a ticket unread |
|
336 |
+ 'shd_hook_markresolve', // functions to call just before marking a ticket resolved |
|
337 |
+ 'shd_hook_markunresolve', // functions to call just before marking a ticket unresolved |
|
338 |
+ 'shd_hook_relations', // functions to call just before setting/removing ticket relationships |
|
339 |
+ 'shd_hook_movedept', // functions to call just before moving a ticket between departments |
|
340 |
+ 'shd_hook_tickettotopic', // functions to call just before moving a ticket into a forum topic |
|
341 |
+ 'shd_hook_topictoticket', // functions to call just before moving a forum topic into a ticket |
|
329 | 342 |
|
330 | 343 |
// Menu hooks - called after the rest of menu configuration is done (meaning menu items may or may not exist depending on permissions) |
331 | 344 |
'shd_hook_mainmenu', // functions to call when looking at the main menu |
... | ... |
@@ -80,6 +80,9 @@ function shd_ticket_delete() |
80 | 80 |
|
81 | 81 |
$subject = $row['subject']; |
82 | 82 |
|
83 |
+ // The ticket ID is in $context['ticket_id']. Nothing else is needed, really. |
|
84 |
+ call_integration_hook('shd_hook_deleteticket'); |
|
85 |
+ |
|
83 | 86 |
// Move it to deleted status |
84 | 87 |
$query_ticket = shd_db_query('', ' |
85 | 88 |
UPDATE {db_prefix}helpdesk_tickets AS hdt |
... | ... |
@@ -148,6 +151,9 @@ function shd_reply_delete() |
148 | 151 |
|
149 | 152 |
$subject = $row['subject']; |
150 | 153 |
|
154 |
+ // The ticket's id is in $context['ticket_id'], the reply's message id is in $_REQUEST['reply']. |
|
155 |
+ call_integration_hook('shd_hook_deletereply'); |
|
156 |
+ |
|
151 | 157 |
// OK, let's clear this one, hasta la vista... ticket. |
152 | 158 |
shd_db_query('', ' |
153 | 159 |
UPDATE {db_prefix}helpdesk_ticket_replies |
... | ... |
@@ -231,6 +237,9 @@ function shd_perma_delete() |
231 | 237 |
// Expire the cache of count(active tickets) |
232 | 238 |
shd_clear_active_tickets($row['id_dept']); |
233 | 239 |
|
240 |
+ // The ticket ID is in $context['ticket_id']. Nothing else is needed, really. |
|
241 |
+ call_integration_hook('shd_hook_permadeleteticket'); |
|
242 |
+ |
|
234 | 243 |
// Start by getting all the messages in this ticket, we'll need those for custom fields values that need purging. |
235 | 244 |
$query = shd_db_query('', ' |
236 | 245 |
SELECT id_msg |
... | ... |
@@ -360,6 +369,9 @@ function shd_perma_delete() |
360 | 369 |
// Expire the cache of count(active tickets) |
361 | 370 |
shd_clear_active_tickets($row['id_dept']); |
362 | 371 |
|
372 |
+ // The message ID is in $_REQUEST['reply']. Nothing else is needed, really. |
|
373 |
+ call_integration_hook('shd_hook_permadeletereply'); |
|
374 |
+ |
|
363 | 375 |
// Just remove the reply. |
364 | 376 |
shd_db_query('', ' |
365 | 377 |
DELETE FROM {db_prefix}helpdesk_ticket_replies |
... | ... |
@@ -528,6 +540,9 @@ function shd_ticket_restore() |
528 | 540 |
fatal_lang_error('shd_no_ticket', false); |
529 | 541 |
} |
530 | 542 |
|
543 |
+ // The ticket's id is in $context['ticket_id']. |
|
544 |
+ call_integration_hook('shd_hook_restoreticket'); |
|
545 |
+ |
|
531 | 546 |
shd_db_query('', ' |
532 | 547 |
UPDATE {db_prefix}helpdesk_tickets AS hdt |
533 | 548 |
SET status = {int:status_new} |
... | ... |
@@ -600,6 +615,9 @@ function shd_reply_restore() |
600 | 615 |
fatal_lang_error('shd_no_ticket', false); |
601 | 616 |
} |
602 | 617 |
|
618 |
+ // The ticket's id is in $context['ticket_id'], the reply id in $_REQUEST['reply']. |
|
619 |
+ call_integration_hook('shd_hook_restorereply'); |
|
620 |
+ |
|
603 | 621 |
// OK, let's clear this one, hasta la vista... ticket. |
604 | 622 |
shd_db_query('', ' |
605 | 623 |
UPDATE {db_prefix}helpdesk_ticket_replies |
... | ... |
@@ -46,6 +46,8 @@ function shd_ticket_unread() |
46 | 46 |
checkSession('get'); |
47 | 47 |
|
48 | 48 |
if (!empty($context['ticket_id'])) |
49 |
+ { |
|
50 |
+ call_integration_hook('shd_hook_markunread'); |
|
49 | 51 |
$result = shd_db_query('', ' |
50 | 52 |
DELETE FROM {db_prefix}helpdesk_log_read |
51 | 53 |
WHERE id_ticket = {int:current_ticket} |
... | ... |
@@ -55,6 +57,7 @@ function shd_ticket_unread() |
55 | 57 |
'user' => $user_info['id'], |
56 | 58 |
) |
57 | 59 |
); |
60 |
+ } |
|
58 | 61 |
|
59 | 62 |
redirectexit($context['shd_home'] . $context['shd_dept_link']); |
60 | 63 |
} |
... | ... |
@@ -99,6 +102,8 @@ function shd_ticket_resolve() |
99 | 102 |
|
100 | 103 |
$action = ($row['status'] != TICKET_STATUS_CLOSED) ? 'resolve' : 'unresolve'; |
101 | 104 |
|
105 |
+ call_integration_hook('shd_hook_mark' . $action); |
|
106 |
+ |
|
102 | 107 |
if (!shd_allowed_to('shd_' . $action . '_ticket_any', $row['id_dept']) && (!shd_allowed_to('shd_' . $action . '_ticket_own', $row['id_dept']) || $row['id_member_started'] != $user_info['id'])) |
103 | 108 |
fatal_lang_error('shd_cannot_' . $action, false); |
104 | 109 |
|
... | ... |
@@ -375,6 +380,9 @@ function shd_ticket_relation() |
375 | 380 |
$logaction_ticket = $log_prefix . $rel_action; |
376 | 381 |
$logaction_otherticket = $log_prefix . $log_map[$rel_action]; |
377 | 382 |
|
383 |
+ // The "from" ticket is $context['ticket_id'], $otherticket is the ticket whose id the user gives, and $rel_action sets the relationship type. |
|
384 |
+ call_integration_hook('shd_hook_relations', array(&$rel_action, &$otherticket)); |
|
385 |
+ |
|
378 | 386 |
if ($rel_action == 'delete') |
379 | 387 |
{ |
380 | 388 |
// Delete the link |
... | ... |
@@ -254,6 +254,9 @@ function shd_movedept2() |
254 | 254 |
list($new_dept, $dept_name) = $smcFunc['db_fetch_row']($query); |
255 | 255 |
$smcFunc['db_free_result']($query); |
256 | 256 |
|
257 |
+ // Just before we move, call any interesting hooks. We do normally have a lot of fun staff in $context and $_POST, but the department ID and name aren't in either. |
|
258 |
+ call_integration_hook('shd_hook_movedept', array(&$new_dept, &$dept_name)); |
|
259 |
+ |
|
257 | 260 |
$log_params = array( |
258 | 261 |
'subject' => $subject, |
259 | 262 |
'ticket' => $context['ticket_id'], |
... | ... |
@@ -472,6 +472,9 @@ function shd_tickettotopic2() |
472 | 472 |
fatal_lang_error('shd_ticket_move_reqd_nonselected', false); |
473 | 473 |
} |
474 | 474 |
|
475 |
+ // Just before we do this, make sure we call any hooks. $context has lots of interesting things, as does $_POST. |
|
476 |
+ call_integration_hook('shd_hook_tickettotopic'); |
|
477 |
+ |
|
475 | 478 |
// OK, so we have some fields, and we're doing something with them. First we need to attach the fields from the ticket to the opening post. |
476 | 479 |
shd_append_custom_fields($body, $context['ticket_id'], CFIELD_TICKET); |
477 | 480 |
|
... | ... |
@@ -1051,6 +1054,9 @@ function shd_topictoticket2() |
1051 | 1054 |
$old_subject = $subject; |
1052 | 1055 |
$subject = !empty($_POST['change_subject']) && !empty($_POST['subject']) ? $_POST['subject'] : $subject; |
1053 | 1056 |
|
1057 |
+ // Just before we do this, make sure we call any hooks. $context and $_POST have lots of interesting things for us. |
|
1058 |
+ call_integration_hook('shd_hook_topictoticket'); |
|
1059 |
+ |
|
1054 | 1060 |
// All okay, it seems. Let's go create the ticket. |
1055 | 1061 |
$msg_assoc = array(); |
1056 | 1062 |
|
1057 | 1063 |