Working on adding the resend button to the actual ticket page
This commit is contained in:
parent
6b89174901
commit
e086322332
@ -1500,6 +1500,15 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)
|
|||||||
|
|
||||||
$options = $reply ? '' : '<div class="pull-right">';
|
$options = $reply ? '' : '<div class="pull-right">';
|
||||||
|
|
||||||
|
// Resend email notification
|
||||||
|
if ($reply) {
|
||||||
|
$options .= '
|
||||||
|
<button class="btn btn-default" data-action="resend-email-notification" data-reply-id="' . $reply['id'] . '" data-ticket-id="' . $ticket['id'] . '">
|
||||||
|
<i class="fa fa-envelope navy-blue"></i> Resend Email Notification[!]
|
||||||
|
</button>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
/* Edit post */
|
/* Edit post */
|
||||||
if ($can_edit) {
|
if ($can_edit) {
|
||||||
$tmp = $reply ? '&reply=' . $reply['id'] : '';
|
$tmp = $reply ? '&reply=' . $reply['id'] : '';
|
||||||
|
@ -5,6 +5,6 @@ namespace BusinessLogic\Exceptions;
|
|||||||
|
|
||||||
class InternalUseOnlyException extends ApiFriendlyException {
|
class InternalUseOnlyException extends ApiFriendlyException {
|
||||||
function __construct() {
|
function __construct() {
|
||||||
parent::__construct("This endpoint can only be used internally", "Internal Use Only", 400);
|
parent::__construct("This endpoint can only be used internally", "Internal Use Only", 401);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -61,44 +61,45 @@ class UserContext {
|
|||||||
* @return UserContext the built user context
|
* @return UserContext the built user context
|
||||||
*/
|
*/
|
||||||
static function fromDataRow($dataRow) {
|
static function fromDataRow($dataRow) {
|
||||||
|
var_dump($dataRow);
|
||||||
$userContext = new UserContext();
|
$userContext = new UserContext();
|
||||||
$userContext->id = $dataRow['id'];
|
$userContext->id = intval($dataRow['id']);
|
||||||
$userContext->username = $dataRow['user'];
|
$userContext->username = $dataRow['user'];
|
||||||
$userContext->admin = $dataRow['isadmin'] === '1';
|
$userContext->admin = boolval($dataRow['isadmin']);
|
||||||
$userContext->name = $dataRow['name'];
|
$userContext->name = $dataRow['name'];
|
||||||
$userContext->email = $dataRow['email'];
|
$userContext->email = $dataRow['email'];
|
||||||
$userContext->signature = $dataRow['signature'];
|
$userContext->signature = $dataRow['signature'];
|
||||||
$userContext->language = $dataRow['language'];
|
$userContext->language = $dataRow['language'];
|
||||||
$userContext->categories = explode(',', $dataRow['categories']);
|
$userContext->categories = explode(',', $dataRow['categories']);
|
||||||
$userContext->permissions = explode(',', $dataRow['heskprivileges']);
|
$userContext->permissions = explode(',', $dataRow['heskprivileges']);
|
||||||
$userContext->autoAssign = $dataRow['autoassign'];
|
$userContext->autoAssign = boolval($dataRow['autoassign']);
|
||||||
$userContext->ratingNegative = $dataRow['ratingneg'];
|
$userContext->ratingNegative = intval($dataRow['ratingneg']);
|
||||||
$userContext->ratingPositive = $dataRow['ratingpos'];
|
$userContext->ratingPositive = intval($dataRow['ratingpos']);
|
||||||
$userContext->rating = $dataRow['rating'];
|
$userContext->rating = floatval($dataRow['rating']);
|
||||||
$userContext->totalNumberOfReplies = $dataRow['replies'];
|
$userContext->totalNumberOfReplies = intval($dataRow['replies']);
|
||||||
$userContext->active = $dataRow['active'];
|
$userContext->active = boolval($dataRow['active']);
|
||||||
|
|
||||||
$preferences = new UserContextPreferences();
|
$preferences = new UserContextPreferences();
|
||||||
$preferences->afterReply = $dataRow['afterreply'];
|
$preferences->afterReply = intval($dataRow['afterreply']);
|
||||||
$preferences->autoStartTimeWorked = $dataRow['autostart'];
|
$preferences->autoStartTimeWorked = boolval($dataRow['autostart']);
|
||||||
$preferences->autoreload = $dataRow['autoreload'];
|
$preferences->autoreload = intval($dataRow['autoreload']);
|
||||||
$preferences->defaultNotifyCustomerNewTicket = $dataRow['notify_customer_new'];
|
$preferences->defaultNotifyCustomerNewTicket = boolval($dataRow['notify_customer_new']);
|
||||||
$preferences->defaultNotifyCustomerReply = $dataRow['notify_customer_reply'];
|
$preferences->defaultNotifyCustomerReply = boolval($dataRow['notify_customer_reply']);
|
||||||
$preferences->showSuggestedKnowledgebaseArticles = $dataRow['show_suggested'];
|
$preferences->showSuggestedKnowledgebaseArticles = boolval($dataRow['show_suggested']);
|
||||||
$preferences->defaultCalendarView = $dataRow['default_calendar_view'];
|
$preferences->defaultCalendarView = intval($dataRow['default_calendar_view']);
|
||||||
$preferences->defaultTicketView = $dataRow['default_list'];
|
$preferences->defaultTicketView = $dataRow['default_list'];
|
||||||
$userContext->preferences = $preferences;
|
$userContext->preferences = $preferences;
|
||||||
|
|
||||||
$notifications = new UserContextNotifications();
|
$notifications = new UserContextNotifications();
|
||||||
$notifications->newUnassigned = $dataRow['notify_new_unassigned'];
|
$notifications->newUnassigned = boolval($dataRow['notify_new_unassigned']);
|
||||||
$notifications->newAssignedToMe = $dataRow['notify_new_my'];
|
$notifications->newAssignedToMe = boolval($dataRow['notify_new_my']);
|
||||||
$notifications->replyUnassigned = $dataRow['notify_reply_unassigned'];
|
$notifications->replyUnassigned = boolval($dataRow['notify_reply_unassigned']);
|
||||||
$notifications->replyToMe = $dataRow['notify_reply_my'];
|
$notifications->replyToMe = boolval($dataRow['notify_reply_my']);
|
||||||
$notifications->ticketAssignedToMe = $dataRow['notify_assigned'];
|
$notifications->ticketAssignedToMe = boolval($dataRow['notify_assigned']);
|
||||||
$notifications->privateMessage = $dataRow['notify_pm'];
|
$notifications->privateMessage = boolval($dataRow['notify_pm']);
|
||||||
$notifications->noteOnTicketAssignedToMe = $dataRow['notify_note'];
|
$notifications->noteOnTicketAssignedToMe = boolval($dataRow['notify_note']);
|
||||||
$notifications->noteOnTicketNotAssignedToMe = $dataRow['notify_note_unassigned'];
|
$notifications->noteOnTicketNotAssignedToMe = boolval($dataRow['notify_note_unassigned']);
|
||||||
$notifications->overdueTicketUnassigned = $dataRow['notify_overdue_unassigned'];
|
$notifications->overdueTicketUnassigned = boolval($dataRow['notify_overdue_unassigned']);
|
||||||
$userContext->notificationSettings = $notifications;
|
$userContext->notificationSettings = $notifications;
|
||||||
|
|
||||||
return $userContext;
|
return $userContext;
|
||||||
|
@ -9,7 +9,7 @@ use BusinessLogic\Helpers;
|
|||||||
abstract class InternalApiController {
|
abstract class InternalApiController {
|
||||||
function checkForInternalUseOnly() {
|
function checkForInternalUseOnly() {
|
||||||
$tokenHeader = Helpers::getHeader('X-AUTH-TOKEN');
|
$tokenHeader = Helpers::getHeader('X-AUTH-TOKEN');
|
||||||
if ($tokenHeader === null || trim($tokenHeader) === '') {
|
if ($tokenHeader !== null && trim($tokenHeader) !== '') {
|
||||||
throw new InternalUseOnlyException();
|
throw new InternalUseOnlyException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ require_once(__DIR__ . '/../inc/common.inc.php');
|
|||||||
require_once(__DIR__ . '/Core/output.php');
|
require_once(__DIR__ . '/Core/output.php');
|
||||||
require_once(__DIR__ . '/../hesk_settings.inc.php');
|
require_once(__DIR__ . '/../hesk_settings.inc.php');
|
||||||
require_once(__DIR__ . '/http_response_code.php');
|
require_once(__DIR__ . '/http_response_code.php');
|
||||||
|
require_once(__DIR__ . '/../inc/admin_functions.inc.php');
|
||||||
|
|
||||||
hesk_load_api_database_functions();
|
hesk_load_api_database_functions();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ function buildUserContextFromSession() {
|
|||||||
|
|
||||||
hesk_session_start();
|
hesk_session_start();
|
||||||
|
|
||||||
if (!hesk_isLoggedIn(false)) {
|
if (empty($_SESSION['id'])) {
|
||||||
throw new \BusinessLogic\Exceptions\SessionNotActiveException();
|
throw new \BusinessLogic\Exceptions\SessionNotActiveException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navy-blue {
|
||||||
|
color: #3c8dbc;
|
||||||
|
}
|
||||||
|
|
||||||
.med-low-priority {
|
.med-low-priority {
|
||||||
background-color: #8BB467;
|
background-color: #8BB467;
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,7 @@ if (defined('MFH_PAGE_LAYOUT') && MFH_PAGE_LAYOUT == 'TOP_ONLY') {
|
|||||||
?>
|
?>
|
||||||
<body onload="<?php echo $onload;
|
<body onload="<?php echo $onload;
|
||||||
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js <?php echo $modsForHesk_settings['admin_color_scheme']; ?>">
|
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js <?php echo $modsForHesk_settings['admin_color_scheme']; ?>">
|
||||||
|
<span style="display: none" id="heskUrl"><?php echo $hesk_settings['hesk_url']; ?></span>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include(HESK_PATH . 'header.txt');
|
include(HESK_PATH . 'header.txt');
|
||||||
|
@ -43,6 +43,27 @@ $(document).ready(function() {
|
|||||||
$('.related-ticket').show();
|
$('.related-ticket').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('button[data-action="resend-email-notification"]').click(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
var ticketId = $this.data('ticket-id');
|
||||||
|
var replyId = $this.data('reply-id');
|
||||||
|
var heskUrl = $('span#heskUrl').text();
|
||||||
|
var apiUrl = heskUrl + '/api/v1-internal/staff/tickets/' + ticketId + '/resend-email?replyId=' + replyId;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'GET',
|
||||||
|
url: apiUrl,
|
||||||
|
headers: { 'X-Internal-Call': true },
|
||||||
|
success: function() {
|
||||||
|
$.jGrowl("Email notification sent!", { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl("Error occurred when trying to send notification email", { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
window.onbeforeunload = function (e) {
|
window.onbeforeunload = function (e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user