mirror of https://github.com/itflow-org/itflow
Fix Timezone always being UTC when sent to the mail queue when scheduling / cancelling tickets
This commit is contained in:
parent
7a2e063bde
commit
894a4369b3
|
|
@ -37,6 +37,12 @@ echo "<H1>$start_date</H1>";
|
|||
<?php echo randomString(100); ?>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
// show the current Date and Time
|
||||
$date_time = date('Y-m-d H:i:s');
|
||||
echo "Current Date and Time: <strong>$date_time</strong>";
|
||||
?>
|
||||
|
||||
<script>toastr.success('Have Fun Wozz!!')</script>
|
||||
|
||||
<?php require_once "footer.php";
|
||||
|
|
|
|||
|
|
@ -1019,8 +1019,7 @@ function generateReadablePassword($security_level)
|
|||
return $password;
|
||||
}
|
||||
|
||||
function addToMailQueue($mysqli, $data)
|
||||
{
|
||||
function addToMailQueue($mysqli, $data) {
|
||||
|
||||
foreach ($data as $email) {
|
||||
$from = strval($email['from']);
|
||||
|
|
@ -1037,13 +1036,13 @@ function addToMailQueue($mysqli, $data)
|
|||
|
||||
// Check if 'email_queued_at' is set and not empty
|
||||
if (isset($email['queued_at']) && !empty($email['queued_at'])) {
|
||||
$queued_at = $email['queued_at'];
|
||||
$queued_at = "'" . sanitizeInput($email['queued_at']) . "'";
|
||||
} else {
|
||||
// Use the current date and time if 'email_queued_at' is not set or empty
|
||||
$queued_at = date('Y-m-d H:i:s');
|
||||
$queued_at = 'CURRENT_TIMESTAMP()';
|
||||
}
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$recipient', email_recipient_name = '$recipient_name', email_from = '$from', email_from_name = '$from_name', email_subject = '$subject', email_content = '$body', email_queued_at = '$queued_at', email_cal_str = '$cal_str'");
|
||||
mysqli_query($mysqli, "INSERT INTO email_queue SET email_recipient = '$recipient', email_recipient_name = '$recipient_name', email_from = '$from', email_from_name = '$from_name', email_subject = '$subject', email_content = '$body', email_queued_at = $queued_at, email_cal_str = '$cal_str'");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1735,8 +1735,8 @@ if (isset($_POST['edit_ticket_schedule'])) {
|
|||
$mysqli,
|
||||
"UPDATE tickets SET
|
||||
ticket_schedule = '$schedule',
|
||||
ticket_onsite = '$onsite',
|
||||
ticket_status = 'On Hold'
|
||||
ticket_onsite = $onsite,
|
||||
ticket_status = 3
|
||||
WHERE ticket_id = $ticket_id"
|
||||
);
|
||||
|
||||
|
|
@ -1745,7 +1745,7 @@ if (isset($_POST['edit_ticket_schedule'])) {
|
|||
//TODO make this configurable
|
||||
$start = date('Y-m-d H:i:s', strtotime($schedule) - 7200);
|
||||
$end = date('Y-m-d H:i:s', strtotime($schedule) + 7200);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_schedule BETWEEN '$start' AND '$end' AND ticket_id != $ticket_id AND ticket_status = 'Scheduled'");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_schedule BETWEEN '$start' AND '$end' AND ticket_id != $ticket_id");
|
||||
if (mysqli_num_rows($sql) > 0) {
|
||||
$conflicting_tickets = [];
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
|
|
@ -1778,6 +1778,12 @@ if (isset($_POST['edit_ticket_schedule'])) {
|
|||
$cal_location = sanitizeInput($row["location_address"]);
|
||||
$email_datetime = date('l, F j, Y \a\t g:ia', strtotime($schedule));
|
||||
|
||||
// Sanitize Config Vars
|
||||
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
|
||||
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
|
||||
$session_company_name = sanitizeInput($session_company_name);
|
||||
|
||||
|
||||
/// Create iCal event
|
||||
$cal_str = createiCalStr($schedule, $cal_subject, $cal_description, $cal_location);
|
||||
|
||||
|
|
@ -1908,7 +1914,12 @@ if (isset($_GET['cancel_ticket_schedule'])) {
|
|||
$ticket_schedule = sanitizeInput($row['ticket_schedule']);
|
||||
$ticket_cal_str = sanitizeInput($row['ticket_cal_str']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_schedule = NULL, ticket_status = 'Open' WHERE ticket_id = $ticket_id");
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_schedule = NULL, ticket_status = 2 WHERE ticket_id = $ticket_id");
|
||||
|
||||
// Sanitize Config Vars
|
||||
$config_ticket_from_email = sanitizeInput($config_ticket_from_email);
|
||||
$config_ticket_from_name = sanitizeInput($config_ticket_from_name);
|
||||
$session_company_name = sanitizeInput($session_company_name);
|
||||
|
||||
//Create iCal event
|
||||
$cal_str = createiCalStrCancel($ticket_cal_str);
|
||||
|
|
|
|||
Loading…
Reference in New Issue