mirror of https://github.com/itflow-org/itflow
Scheduled Tickets
This commit is contained in:
parent
9bd28b1c56
commit
13cf4df473
|
|
@ -25,6 +25,7 @@ require_once "calendar_event_add_modal.php";
|
|||
|
||||
require_once "calendar_add_modal.php";
|
||||
|
||||
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
|
|
@ -123,6 +124,16 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
|
||||
}
|
||||
|
||||
//Tickets Scheduled
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id WHERE ticket_schedule IS NOT NULL");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['ticket_id']);
|
||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject']);
|
||||
$event_start = json_encode($row['ticket_schedule']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'red', url: 'ticket.php?ticket_id=$event_id' },";
|
||||
}
|
||||
|
||||
//Vendors Added Created
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id WHERE vendor_template = 0");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
|
|
|
|||
|
|
@ -1143,4 +1143,82 @@ if(isset($_POST['set_billable_status'])) {
|
|||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_ticket_schedule'])) {
|
||||
|
||||
validateTechRole();
|
||||
|
||||
$ticket_id = intval($_POST['ticket_id']);
|
||||
$schedule = sanitizeInput($_POST['scheduled_date_time']);
|
||||
$ticket_link = "ticket.php?ticket_id=$ticket_id";
|
||||
$full_ticket_url = "https://$config_base_url/portal/ticket.php?ticket_id=$ticket_id";
|
||||
$ticket_link_html = "<a href=\"$full_ticket_url\">$ticket_link</a>";
|
||||
|
||||
mysqli_query($mysqli,
|
||||
"UPDATE tickets SET
|
||||
ticket_schedule = '$schedule',
|
||||
ticket_status = 'Scheduled'
|
||||
WHERE ticket_id = $ticket_id"
|
||||
);
|
||||
|
||||
|
||||
|
||||
//Send email to client and assigned user
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM tickets
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||
WHERE ticket_id = $ticket_id
|
||||
");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$client_name = sanitizeInput($row['client_name']);
|
||||
$contact_name = sanitizeInput($row['contact_name']);
|
||||
$contact_email = sanitizeInput($row['contact_email']);
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||
|
||||
$data = [
|
||||
[
|
||||
'from' => $config_ticket_from_email,
|
||||
'from_name' => $config_ticket_from_name,
|
||||
'recipient' => $contact_email,
|
||||
'recipient_name' => $contact_name,
|
||||
'subject' => "Ticket Scheduled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
||||
'body' => "Hello, $contact_name<br><br>Your ticket regarding $ticket_subject has been scheduled for $schedule.<br><br>--------------------------------<br><a href=\"$full_ticket_url\">$ticket_link</a><br>--------------------------------<br><br>We hope the issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email<br>$company_phone",
|
||||
],
|
||||
[
|
||||
'from' => $config_ticket_from_email,
|
||||
'from_name' => $config_ticket_from_name,
|
||||
'recipient' => $row['user_email'],
|
||||
'recipient_name' => $row['user_first_name'] . ' ' . $row['user_last_name'],
|
||||
'subject' => "Ticket Scheduled - [$ticket_prefix$ticket_number] - $ticket_subject",
|
||||
'body' => "Hello, " . $row['user_first_name'] . "<br><br>The ticket regarding $ticket_subject has been scheduled for $schedule.<br><br>--------------------------------<br><a href=\"$full_ticket_url\">$ticket_link</a><br>--------------------------------<br><br>We hope the issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/portal/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email<br>$company_phone",
|
||||
]
|
||||
];
|
||||
$response = addToMailQueue($mysqli, $data);
|
||||
|
||||
|
||||
//Logging
|
||||
mysqli_query(
|
||||
$mysqli,
|
||||
"INSERT INTO logs SET
|
||||
log_type = 'Ticket',
|
||||
log_action = 'Modify',
|
||||
log_description = '$session_name modified ticket schedule',
|
||||
log_ip = '$session_ip',
|
||||
log_user_agent = '$session_user_agent',
|
||||
log_user_id = $session_user_id,
|
||||
log_entity_id = $ticket_id"
|
||||
);
|
||||
|
||||
$_SESSION['alert_message'] = "Ticket schedule updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
33
ticket.php
33
ticket.php
|
|
@ -58,6 +58,7 @@ if (isset($_GET['ticket_id'])) {
|
|||
$ticket_details = $purifier->purify($row['ticket_details']);
|
||||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']);
|
||||
|
||||
//Set Ticket Bage Color based of priority
|
||||
if ($ticket_priority == "High") {
|
||||
|
|
@ -314,7 +315,6 @@ if (isset($_GET['ticket_id'])) {
|
|||
<option <?php if ($ticket_status == "Pending-Client") {echo "selected";}?> >Pending-Client</option>
|
||||
<option <?php if ($ticket_status == "Pending-Vendor") {echo "selected";}?> >Pending-Vendor</option>
|
||||
<option <?php if ($ticket_status == "Pending-Shipment") {echo "selected";}?> >Pending-Shipment</option>
|
||||
<option <?php if ($ticket_status == "Scheduled") {echo "selected";}?> >Scheduled</option>
|
||||
<?php if($config_ticket_autoclose) { ?>
|
||||
<option <?php if ($ticket_status == 'Auto Close') { echo "selected"; } ?> >Auto Close</option>
|
||||
<?php } ?>
|
||||
|
|
@ -322,6 +322,8 @@ if (isset($_GET['ticket_id'])) {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="custom-tt-horizontal-spacing"></div> <!-- Add custom class for smaller spacing -->
|
||||
|
||||
<!-- Time Tracking -->
|
||||
|
|
@ -642,15 +644,25 @@ if (isset($_GET['ticket_id'])) {
|
|||
<div class="mt-1">
|
||||
<i class="fa fa-fw fa-comment-dots text-secondary ml-1 mr-2"></i>Feedback: <?php echo $ticket_feedback; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
<?php if (!empty($ticket_total_reply_time)) { ?>
|
||||
if (!empty($ticket_scheduled_for)) { ?>
|
||||
<div class="mt-1">
|
||||
<i class="fa fa-fw fa-calendar-check text-secondary ml-1 mr-2"></i>Scheduled for: <a href="#" data-toggle="modal" data-target="#editTicketScheduleModal"><?php echo $ticket_scheduled_for; ?></a>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="mt-1">
|
||||
<i class="fa fa-fw fa-calendar-check text-secondary ml-1 mr-2"></i>Scheduled for: <a href="#" data-toggle="modal" data-target="#editTicketScheduleModal">Add</a>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
if (!empty($ticket_total_reply_time)) { ?>
|
||||
<div class="mt-1">
|
||||
<i class="far fa-fw fa-clock text-secondary ml-1 mr-2"></i>Total time worked: <?php echo $ticket_total_reply_time; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
if ($config_module_enable_accounting) { ?>
|
||||
<div class="mt-1">
|
||||
<i class="fa fa-fw fa-dollar-sign text-secondary ml-1 mr-2"></i>Billable:
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketBillableModal<?php echo $ticket_id; ?>">
|
||||
|
|
@ -874,6 +886,8 @@ if (isset($_GET['ticket_id'])) {
|
|||
|
||||
require_once "ticket_change_client_modal.php";
|
||||
|
||||
require_once "ticket_edit_schedule_modal.php";
|
||||
|
||||
require_once "ticket_merge_modal.php";
|
||||
|
||||
if ($config_module_enable_accounting) {
|
||||
|
|
@ -885,9 +899,16 @@ if (isset($_GET['ticket_id'])) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
?> <script src="js/show_modals.js"></script> <?php
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="js/show_modals.js"></script> <?php
|
||||
|
||||
if ($ticket_status !== "Closed") { ?>
|
||||
<!-- Ticket Time Tracking JS -->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
<div class="modal" id="editTicketScheduleModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class="fa fa-fw fa-user mr-2"></i>
|
||||
Edit Scheduled Time for <strong><?php echo "$ticket_prefix$ticket_number"; ?></strong>
|
||||
</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
<div class="form-group">
|
||||
<label>Scheduled Date and Time</label>
|
||||
<?php if (!$ticket_scheduled_for) { ?>
|
||||
<input type="datetime-local" class="form-control" name="scheduled_date_time"
|
||||
placeholder="Scheduled Date & Time">
|
||||
<?php } else { ?>
|
||||
<input type="datetime-local" class="form-control" name="scheduled_date_time"
|
||||
value="<?php echo $ticket_scheduled_for; ?>">
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_ticket_schedule" class="btn btn-primary text-bold"><i
|
||||
class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i
|
||||
class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue