mirror of https://github.com/itflow-org/itflow
commit
23770ac114
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -1559,6 +1559,8 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.2'");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.0.2') {
|
||||
//Insert queries here required to update to DB version 1.0.3
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_stripe_expense_vendor` INT(11) NOT NULL DEFAULT 0 AFTER `config_stripe_account`");
|
||||
|
|
@ -1575,10 +1577,12 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
// Please add this same comment block to the bottom of this file, and update the version number.
|
||||
// Uncomment Below Lines, to add additional database updates
|
||||
//
|
||||
// if (CURRENT_DATABASE_VERSION == '1.0.3') {
|
||||
// // Insert queries here required to update to DB version 1.0.4
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.0.3') {
|
||||
//Insert queries here required to update to DB version 1.0.4
|
||||
mysqli_query($mysqli, "ALTER TABLE `tickets` ADD `ticket_schedule` DATETIME DEFAULT NULL AFTER `ticket_billable`");
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.4'");
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.0.4'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
1
db.sql
1
db.sql
|
|
@ -1569,6 +1569,7 @@ CREATE TABLE `tickets` (
|
|||
`ticket_priority` varchar(200) DEFAULT NULL,
|
||||
`ticket_status` varchar(200) NOT NULL,
|
||||
`ticket_billable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`ticket_schedule` DATETIME DEFAULT NULL,
|
||||
`ticket_vendor_ticket_number` varchar(255) DEFAULT NULL,
|
||||
`ticket_feedback` varchar(200) DEFAULT NULL,
|
||||
`ticket_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function populateScheduledTicketEditModal(client_id, ticket_id) {
|
|||
const assets = response.assets;
|
||||
|
||||
// Populate the scheduled ticket modal fields
|
||||
document.getElementById("editHeader").innerText = " Edit Scheduled ticket: " + ticket.scheduled_ticket_subject;
|
||||
document.getElementById("editHeader").innerText = " Edit Recurring ticket: " + ticket.scheduled_ticket_subject;
|
||||
document.getElementById("editTicketId").value = ticket_id;
|
||||
document.getElementById("editClientId").value = client_id;
|
||||
document.getElementById("editTicketSubject").value = ticket.scheduled_ticket_subject;
|
||||
|
|
|
|||
|
|
@ -1491,4 +1491,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"]);
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-calendar-check mr-2"></i>New Scheduled Ticket</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-calendar-check mr-2"></i>New Recurring Ticket</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-calendar-check mr-2"></i>Scheduled Tickets</h3>
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-calendar-check mr-2"></i>Recurring Tickets</h3>
|
||||
<div class='card-tools'>
|
||||
<div class="float-left">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal">
|
||||
<i class="fas fa-plus mr-2"></i>New Scheduled Ticket
|
||||
<i class="fas fa-plus mr-2"></i>New Recurring Ticket
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
10
side_nav.php
10
side_nav.php
|
|
@ -31,17 +31,11 @@
|
|||
|
||||
<li class="nav-header mt-3">SUPPORT</li>
|
||||
<li class="nav-item">
|
||||
<a href="tickets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php") { echo "active"; } ?>">
|
||||
<a href="tickets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php" || basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-life-ring"></i>
|
||||
<p>Tickets</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="scheduled_tickets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-calendar-check"></i>
|
||||
<p>Scheduled Tickets</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
|
@ -111,7 +105,7 @@
|
|||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="recurring_expenses.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "recurring_expenses.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-clock"></i>
|
||||
<i class="nav-icon fas fa-redo-alt"></i>
|
||||
<p>Recurring Expenses</p>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
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>
|
||||
|
|
@ -77,6 +77,11 @@ $sql_total_tickets_closed = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS to
|
|||
$row = mysqli_fetch_array($sql_total_tickets_closed);
|
||||
$total_tickets_closed = intval($row['total_tickets_closed']);
|
||||
|
||||
//Get Total Scheduled tickets
|
||||
$sql_total_scheduled_tickets = mysqli_query($mysqli, "SELECT COUNT(scheduled_ticket_id) AS total_scheduled_tickets FROM scheduled_tickets");
|
||||
$row = mysqli_fetch_array($sql_total_scheduled_tickets);
|
||||
$total_scheduled_tickets = intval($row['total_scheduled_tickets']);
|
||||
|
||||
//Get Unassigned tickets
|
||||
$sql_total_tickets_unassigned = mysqli_query($mysqli, "SELECT COUNT(ticket_id) AS total_tickets_unassigned FROM tickets WHERE ticket_assigned_to = '0' AND ticket_status != 'Closed'");
|
||||
$row = mysqli_fetch_array($sql_total_tickets_unassigned);
|
||||
|
|
@ -134,6 +139,10 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
|
|||
<a href="?assigned=unassigned" class="btn btn-outline-danger">
|
||||
<i class="fa fa-fw fa-exclamation-triangle mr-2"></i>Unassigned Tickets | <strong> <?php echo $total_tickets_unassigned; ?></strong>
|
||||
</a>
|
||||
|
||||
<a href="scheduled_tickets.php" class="btn btn-outline-info">
|
||||
<i class="fa fa-fw fa-redo-alt mr-2"></i>Recurring Tickets | <strong> <?php echo $total_scheduled_tickets; ?></strong>
|
||||
</a>
|
||||
|
||||
<div class="dropdown ml-2" id="bulkActionButton" hidden>
|
||||
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
|
||||
|
|
|
|||
Loading…
Reference in New Issue