Ticket.php

- Change wording of ticket 'Respond' button to 'Add note' if reply is internal
- Fix TinyMCE not loading under certain circumstances
- Correct varname 'prefix' to 'ticket_prefix' in reply alert message
This commit is contained in:
Marcus Hill 2023-05-14 20:16:04 +01:00
parent eb4c5cbf34
commit 1057481039
4 changed files with 25 additions and 5 deletions

View File

@ -18,7 +18,7 @@
<script src='plugins/daterangepicker/daterangepicker.js'></script>
<script src='plugins/select2/js/select2.min.js'></script>
<script src='plugins/inputmask/jquery.inputmask.min.js'></script>
<script src="/plugins/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script src="plugins/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script src="plugins/Show-Hide-Passwords-Bootstrap-4/bootstrap-show-password.min.js"></script>
<script src="plugins/clipboardjs/clipboard.min.js"></script>

View File

@ -0,0 +1,19 @@
// Ticket.php - Changes the wording of the "Respond" button to "Add note" if reply is not a public update (based on checkbox)
// Get Internal/Public Checkbox
checkbox = document.getElementById('ticket_reply_type_checkbox');
// Get Respond button
respond = document.getElementById('ticket_add_reply');
// When checkbox is checked/unchecked, update button wording
checkbox.addEventListener('change', e => {
if (e.target.checked) {
// Public reply
respond.innerHTML = "<i class=\"fas fa-check mr-2\"></i>Respond";
} else {
// Internal note
respond.innerHTML = "<i class=\"fas fa-sticky-note mr-2\"></i>Add note";
}
});

View File

@ -6658,7 +6658,7 @@ if(isset($_POST['add_ticket_reply'])){
// Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket Reply', log_action = 'Create', log_description = '$session_name replied to ticket $ticket_prefix$ticket_number - $ticket_subject and was a $ticket_reply_type reply', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $ticket_reply_id");
$_SESSION['alert_message'] = "Ticket <strong>$prefix$ticket_number</strong> has been updated with your reply and was <strong>$ticket_reply_type</strong>";
$_SESSION['alert_message'] = "Ticket <strong>$ticket_prefix$ticket_number</strong> has been updated with your reply and was <strong>$ticket_reply_type</strong>";
header("Location: " . $_SERVER["HTTP_REFERER"]);

View File

@ -309,14 +309,14 @@ if (isset($_GET['ticket_id'])) {
<div class="col-md-2">
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="public_reply_type" value="1" checked>
<label class="custom-control-label" for="customControlAutosizing">Email contact<br><small class="text-secondary">(Public Update)</small></label>
<input type="checkbox" class="custom-control-input" id="ticket_reply_type_checkbox" name="public_reply_type" value="1" checked>
<label class="custom-control-label" for="ticket_reply_type_checkbox">Email contact<br><small class="text-secondary">(Public Update)</small></label>
</div>
</div>
</div>
<div class="col-md-2">
<button type="submit" name="add_ticket_reply" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Respond</button>
<button type="submit" id="ticket_add_reply" name="add_ticket_reply" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Respond</button>
</div>
</div>
@ -746,5 +746,6 @@ if ($ticket_status !== "Closed") { ?>
<!-- Ticket collision detect JS (jQuery is called in footer, so collision detection script MUST be below it) -->
<script src="js/ticket_collision_detection.js"></script>
<script src="js/ticket_button_respond_note.js"></script>
<?php } ?>