Skip to content

Commit

Permalink
Ticket scheduling
Browse files Browse the repository at this point in the history
- Prevent scheduling dates in the past (also for API keys expiry date)
- Correct the ticket URL in the agent email
- Update the onsite value in the database when scheduling a ticket
- Reword the internal note to include a user friendly time and whether the ticket is onsite/remote
  • Loading branch information
wrongecho committed Feb 12, 2024
1 parent c207fdd commit b64df19
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion admin_api_key_add_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
</div>
<input type="date" class="form-control" name="expire" max="2999-12-31" required>
<input type="date" class="form-control" name="expire" min="<?php echo date('Y-m-d')?>" max="2999-12-31" required>
</div>
</div>

Expand Down
6 changes: 4 additions & 2 deletions post/ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,7 @@
$mysqli,
"UPDATE tickets SET
ticket_schedule = '$schedule',
ticket_onsite = '$onsite',
ticket_status = 'Scheduled'
WHERE ticket_id = $ticket_id"
);
Expand Down Expand Up @@ -1558,7 +1559,7 @@
'recipient' => $user_email,
'recipient_name' => $user_name,
'subject' => "Ticket Scheduled - [$ticket_prefix$ticket_number] - $ticket_subject",
'body' => "Hello, " . $user_name . "<br><br>The ticket regarding $ticket_subject has been scheduled for $email_datetime.<br><br>--------------------------------<br><a href=\"https://$config_base_url/portal/ticket.php?id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
'body' => "Hello, " . $user_name . "<br><br>The ticket regarding $ticket_subject has been scheduled for $email_datetime.<br><br>--------------------------------<br><a href=\"https://$config_base_url/ticket.php?id=$ticket_id\">$ticket_link</a><br>--------------------------------<br><br>Please do not reply to this email. <br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Portal: https://$config_base_url/ticket.php?id=$ticket_id<br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email",
'cal_str' => $cal_str
]
];
Expand Down Expand Up @@ -1604,7 +1605,8 @@


// Update ticket reply
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket scheduled for $schedule', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:05:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");
$ticket_reply_note = "Ticket scheduled for $email_datetime " . (boolval($onsite) ? '(onsite).' : '(remote).');
mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply_note', ticket_reply_type = 'Internal', ticket_reply_time_worked = '00:01:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id");

//Logging
mysqli_query(
Expand Down
12 changes: 7 additions & 5 deletions ticket_edit_schedule_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
<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>
<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">
<input type="datetime-local" class="form-control" name="scheduled_date_time" placeholder="Scheduled Date & Time" min="<?php echo date('Y-m-d\TH:i'); ?>">
<?php } else { ?>
<input type="datetime-local" class="form-control" name="scheduled_date_time" value="<?php echo $ticket_scheduled_for; ?>">
<input type="datetime-local" class="form-control" name="scheduled_date_time" min="<?php echo date('Y-m-d\TH:i'); ?>" value="<?php echo $ticket_scheduled_for; ?>">
<?php } ?>

</div>
<div class="form-group">
<label>Onsite</label>
<select class="form-control" name="onsite">
<label>Onsite </label>
<select class="form-control" name="onsite" required>
<option value="0" <?php if ($ticket_onsite == 0) echo "selected"; ?>>No</option>
<option value="1" <?php if ($ticket_onsite == 1) echo "selected"; ?>>Yes</option>
</select>
Expand Down

0 comments on commit b64df19

Please sign in to comment.