! Remove the ability to notify on updated ticket, causes too many problems. Incidentally solves others. Any existing log entries from this will be broken because the log code will no longer be present. [Bug 764,766]
gruffen

gruffen commited on 2011-06-17 09:26:31
Showing 5 changed files, with 6 additions and 16 deletions.

... ...
@@ -226,7 +226,7 @@ $txt['shd_notify_nobody'] = 'nobody';
226 226
 $txt['shd_notify_email'] = 'Email address to use in the notifications, leave blank to use the forum default (%1$s)';
227 227
 $txt['shd_notify_log'] = 'Log notifications being sent (what notification, when sent, user(s) involved)';
228 228
 $txt['shd_notify_with_body'] = 'When sending notifications, send the new ticket or new reply content in the email';
229
-$txt['shd_notify_new_ticket'] = 'Allow staff to receive notifications on new and updated tickets';
229
+$txt['shd_notify_new_ticket'] = 'Allow staff to receive notifications on new tickets';
230 230
 $txt['shd_notify_new_reply_own'] = 'Allow users to receive notifications when their tickets are replied to';
231 231
 $txt['shd_notify_new_reply_assigned'] = 'Allow staff to receive notifications when tickets assigned to them are replied to';
232 232
 $txt['shd_notify_new_reply_previous'] = 'Allow staff to receive notifications when tickets they have replied to, are replied to again';
... ...
@@ -35,11 +35,6 @@ $txt['template_body_notify_new_ticket'] = 'A new helpdesk ticket, "[{ticket_id}]
35 35
 $txt['template_bodyfull_notify_new_ticket'] = 'A new helpdesk ticket, "[{ticket_id}] {subject}", has been created, by {poster_name}.' . "\n\n" . '====Begin Comment====' . "\n" . '{body}' . "\n" . '====End Comment====' . "\n\n" . 'You can access it here:' . "\n" . '{ticketlink}';
36 36
 $txt['template_log_notify_new_ticket'] = 'New ticket';
37 37
 
38
-$txt['template_subject_notify_update_ticket'] = 'Helpdesk [{ticket_id}] Ticket updated by [{poster_name}] -RE- [{subject}]';
39
-$txt['template_body_notify_update_ticket'] = 'A helpdesk ticket, "[{ticket_id}] {subject}", has been updated, by {poster_name}.' . "\n\n" . 'You can access it here:' . "\n" . '{ticketlink}';
40
-$txt['template_bodyfull_notify_update_ticket'] = 'A helpdesk ticket, "[{ticket_id}] {subject}", has been updated, by {poster_name}.' . "\n\n" . 'You can access it here:' . "\n" . '{ticketlink}';
41
-$txt['template_log_notify_update_ticket'] = 'Ticket updated';
42
-
43 38
 $txt['template_subject_notify_new_reply_own'] = 'Helpdesk [{ticket_id}] New reply from [{poster_name}] -RE- [{subject}]';
44 39
 $txt['template_body_notify_new_reply_own'] = 'Your ticket, "[{ticket_id}] {subject}", has been replied to, by {poster_name}.' . "\n\n" . 'You can read the reply here:' . "\n" . '{ticketlink}';
45 40
 $txt['template_bodyfull_notify_new_reply_own'] = 'Your ticket, "[{ticket_id}] {subject}", has been replied to, by {poster_name}.' . "\n\n" . '====Begin Comment====' . "\n" . '{body}' . "\n" . '====End Comment====' . "\n\n" . 'You can read the reply here:' . "\n" . '{ticketlink}';
... ...
@@ -138,7 +138,7 @@ $txt['shd_pref_block_order_lastreply_desc'] = 'Last reply - latest first';
138 138
 
139 139
 // Preferences: email notifications
140 140
 $txt['shd_pref_group_notify'] = 'Notifications By Email';
141
-$txt['shd_pref_notify_new_ticket'] = 'Email me when a new ticket is posted, or one is updated';
141
+$txt['shd_pref_notify_new_ticket'] = 'Email me when a new ticket is posted';
142 142
 $txt['shd_pref_notify_new_reply_own'] = 'Email me when one of my tickets is replied to';
143 143
 $txt['shd_pref_notify_new_reply_assigned'] = 'Email me when a ticket assigned to me is replied to';
144 144
 $txt['shd_pref_notify_new_reply_previous'] = 'Email me when a ticket I\'ve replied to before is replied to again';
... ...
@@ -26,7 +26,7 @@
26 26
 if (!defined('SMF'))
27 27
 	die('Hacking attempt...');
28 28
 
29
-function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$posterOptions, $new_ticket = true)
29
+function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$posterOptions)
30 30
 {
31 31
 	global $smcFunc, $context, $modSettings, $scripturl;
32 32
 
... ...
@@ -34,7 +34,7 @@ function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$pos
34 34
 	if (empty($modSettings['shd_notify_new_ticket']))
35 35
 		return;
36 36
 
37
-	// We don't always have this. But it should be available in context because if we're coming from updated ticket, we will have the other...
37
+	// We don't always have this. But it should be available elsewhere.
38 38
 	if (!isset($ticketOptions['private']))
39 39
 		$ticketOptions['private'] = $context['ticket_form']['private']['setting'];
40 40
 	if (empty($posterOptions['name']))
... ...
@@ -74,11 +74,10 @@ function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$pos
74 74
 	$smcFunc['db_free_result']($query);
75 75
 
76 76
 	// OK, now figure out who we're sending to, and discard any member id's we're not sending to
77
-	$template = $new_ticket ? 'new_ticket' : 'update_ticket';
78 77
 	foreach ($members as $member => $value)
79 78
 	{
80 79
 		if (!empty($value))
81
-			$members[$member] = $template;
80
+			$members[$member] = 'new_ticket';
82 81
 		else
83 82
 			unset($members[$member]);
84 83
 	}
... ...
@@ -584,7 +584,7 @@ function shd_save_ticket()
584 584
 
585 585
 			// Handle notifications
586 586
 			require_once($sourcedir . '/sd_source/SimpleDesk-Notifications.php');
587
-			shd_notifications_notify_newticket($msgOptions, $ticketOptions, $posterOptions, true);
587
+			shd_notifications_notify_newticket($msgOptions, $ticketOptions, $posterOptions);
588 588
 		}
589 589
 		else
590 590
 		{
... ...
@@ -672,10 +672,6 @@ function shd_save_ticket()
672 672
 					shd_log_action($action, $field);
673 673
 				}
674 674
 			}
675
-
676
-			// Handle notifications
677
-			require_once($sourcedir . '/sd_source/SimpleDesk-Notifications.php');
678
-			shd_notifications_notify_newticket($msgOptions, $ticketOptions, $posterOptions, false);
679 675
 		}
680 676
 		shd_done_posting();
681 677
 	}
682 678