Merge pull request #255 from wrongecho/255_ticket-improvements

Ticket improvements
This commit is contained in:
Johnny
2022-01-08 15:06:24 -05:00
committed by GitHub
4 changed files with 122 additions and 44 deletions
+3
View File
@@ -999,6 +999,8 @@ DROP TABLE IF EXISTS `ticket_replies`;
CREATE TABLE `ticket_replies` (
`ticket_reply_id` int(11) NOT NULL AUTO_INCREMENT,
`ticket_reply` longtext NOT NULL,
`ticket_reply_type` varchar(9) NOT NULL,
`ticket_reply_time_worked` time DEFAULT NULL,
`ticket_reply_created_at` datetime NOT NULL,
`ticket_reply_updated_at` datetime DEFAULT NULL,
`ticket_reply_archived_at` datetime DEFAULT NULL,
@@ -1025,6 +1027,7 @@ CREATE TABLE `tickets` (
`ticket_details` longtext NOT NULL,
`ticket_priority` varchar(200) DEFAULT NULL,
`ticket_status` varchar(200) NOT NULL,
`ticket_feedback` varchar(104) DEFAULT NULL,
`ticket_created_at` datetime NOT NULL,
`ticket_updated_at` datetime DEFAULT NULL,
`ticket_archived_at` datetime DEFAULT NULL,
+10 -2
View File
@@ -4919,7 +4919,7 @@ if(isset($_POST['assign_ticket'])){
mysqli_query($mysqli,"UPDATE tickets SET ticket_updated_at = NOW(), ticket_assigned_to = $assigned_to WHERE ticket_id = $ticket_id AND company_id = $session_company_id");
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = 'Ticket re-assigned', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli));
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = 'Ticket re-assigned', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:01:00', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli));
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket', log_action = 'Modified', log_description = '$subject', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
@@ -4949,8 +4949,16 @@ if(isset($_POST['add_ticket_reply'])){
$ticket_id = intval($_POST['ticket_id']);
$ticket_reply = trim(mysqli_real_escape_string($mysqli,$_POST['ticket_reply']));
$ticket_status = trim(mysqli_real_escape_string($mysqli,$_POST['status']));
$ticket_reply_time_worked = trim(mysqli_real_escape_string($mysqli,$_POST['time']));
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli));
if(isset($_POST['public_reply_type'])){
$ticket_reply_type = 'Public';
}
else{
$ticket_reply_type = 'Internal';
}
mysqli_query($mysqli,"INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '$ticket_reply_time_worked', ticket_reply_type = '$ticket_reply_type', ticket_reply_created_at = NOW(), ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id, company_id = $session_company_id") or die(mysqli_error($mysqli));
//UPDATE Ticket Last Response Field
mysqli_query($mysqli,"UPDATE tickets SET ticket_status = '$ticket_status', ticket_updated_at = NOW() WHERE ticket_id = $ticket_id AND company_id = $session_company_id") or die(mysqli_error($mysqli));
+7 -2
View File
@@ -947,14 +947,19 @@ if(isset($_POST['add_company_settings'])){
<div class="card-body">
<p>A database must be created before proceeding, then click on the Setup button to to get started, </p>
<hr>
<p>After the setup is complete add cron.php to your cron and set it to run once everyday at 11:00PM. This is for tasks such as sending out recurring invoices, late payment reminders, alerts, etc</p>
<p>Post installation, <a href="https://itflow.org/docs.php?doc_id=3">additional steps</a> are required for tasks such as sending out recurring invoices, late payment reminders, scheduled tickets, alerts, etc.</p>
<ul>
<li>Navigate to the settings/alerts page, enable cron and the alerts you want</li>
<li>Add cron.php to your crontab and set it to run once everyday at 11:00PM</li>
</ul>
<hr>
<p>An API is present to allow integration with other third pary apps. An API Key will be auto generated and can be changed in settings after setup. The API will give you the following capabilities</p>
<p>An API is present to allow integration with other third pary apps. An API Key will be auto generated and can be changed in settings after setup. The API will give you the following capabilities:</p>
<ul class="mb-4">
<li>Address book XML for VOIP Phones</li>
<li>Caller ID Lookup</li>
<li>Get List of Emails in CSV to export to a mailing list</li>
<li>Acquire balance can be useful for customer's to get their balance by phone</li>
<li>Add new assets</li>
</ul>
<?php
// Check that there is access to write config.php
+68 -6
View File
@@ -149,6 +149,7 @@ if(isset($_GET['ticket_id'])){
while($row = mysqli_fetch_array($sql)){;
$ticket_reply_id = $row['ticket_reply_id'];
$ticket_reply = $row['ticket_reply'];
$ticket_reply_type = $row['ticket_reply_type'];
$ticket_reply_created_at = $row['ticket_reply_created_at'];
$ticket_reply_updated_at = $row['ticket_reply_updated_at'];
$ticket_reply_by = $row['ticket_reply_by'];
@@ -156,9 +157,11 @@ if(isset($_GET['ticket_id'])){
$user_id = $row['user_id'];
$user_avatar = $row['user_avatar'];
$user_initials = initials($row['user_name']);
$ticket_reply_time_worked = date_create($row['ticket_reply_time_worked']);
?>
<div class="card mb-3">
<div class="card <?php if($ticket_reply_type == 'Internal') {echo "bg-dark";} ?> mb-3">
<!-- Not sure how I feel about the dark background for internal notes, but we need a way to differentiate them from public updates? -->
<div class="card-header">
<h3 class="card-title">
@@ -178,6 +181,8 @@ if(isset($_GET['ticket_id'])){
<?php echo $ticket_reply_by_display; ?>
<br>
<small class="text-muted"><?php echo $ticket_reply_created_at; ?> <?php if(!empty($ticket_reply_updated_at)){ echo "modified: $ticket_reply_updated_at"; } ?></small>
<br>
<small class="text-muted">Time worked: <?php echo date_format($ticket_reply_time_worked, 'H:i:s'); ?></small>
</div>
</div>
</h3>
@@ -215,7 +220,7 @@ if(isset($_GET['ticket_id'])){
<textarea class="form-control summernote" name="ticket_reply" required></textarea>
</div>
<div class="form-row">
<div class="col-md-3">
<div class="col-md-2">
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
@@ -231,18 +236,24 @@ if(isset($_GET['ticket_id'])){
</div>
</div>
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
<div class="col-sm-2">
<div class="form-group">
<input class="form-control timepicker" id="time_worked" name="time" type="time" step="1" value="00:00:00" onchange="setTime()"/>
</div>
</div>
<?php //if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
<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="email_ticket_reply" value="1" checked>
<label class="custom-control-label" for="customControlAutosizing">Email update to client</label>
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="public_reply_type" value="1" checked>
<label class="custom-control-label" for="customControlAutosizing">Email update to client (Public Update)</label>
</div>
</div>
</div>
<?php } ?>
<?php //} ?>
<div class="col-md-2">
<button type="submit" name="add_ticket_reply" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> Save & Reply</button>
@@ -417,4 +428,55 @@ if(isset($_GET['ticket_id'])){
?>
<!-- Maybe move this to it's own JS file? -->
<script type="text/javascript">
// Default values
var hours = 0;
var minutes = 0;
var seconds = 0;
setInterval(countTime, 1000);
// Counter
function countTime()
{
++seconds;
if(seconds == 60) {
seconds = 0;
minutes++;
}
if(minutes == 60) {
minutes = 0;
hours++;
}
// Total timeworked
var time_worked = pad(hours) + ":" + pad(minutes) + ":" + pad(seconds);
document.getElementById("time_worked").value = time_worked;
}
// Allows manually adjusting the timer
function setTime()
{
var time_as_text = document.getElementById("time_worked").value;
const time_text_array = time_as_text.split(":");
hours = parseInt(time_text_array[0]);
minutes = parseInt(time_text_array[1]);
seconds = parseInt(time_text_array[2]);
}
// This function "pads" out the values, adding zeros if they are required
function pad(val)
{
var valString = val + "";
if(valString.length < 2)
{
return "0" + valString;
}
else
{
return valString;
}
}
</script>
<?php include("footer.php");