mirror of https://github.com/itflow-org/itflow
Merge branch 'develop' of https://github.com/itflow-org/itflow into develop
This commit is contained in:
commit
d781130b49
|
|
@ -35,17 +35,17 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
|||
|
||||
<div class="row">
|
||||
<div class="col-md-3 text-center">
|
||||
<?php if($company_logo) { ?>
|
||||
<img class="img-thumbnail" src="<?php echo "uploads/settings/$company_logo"; ?>">
|
||||
<a href="post.php?remove_company_logo" class="btn btn-outline-danger btn-block">Remove Logo</a>
|
||||
<hr>
|
||||
<?php if ($company_logo) { ?>
|
||||
<img class="img-thumbnail" src="<?php echo "uploads/settings/$company_logo"; ?>">
|
||||
<a href="post.php?remove_company_logo" class="btn btn-outline-danger btn-block">Remove Logo</a>
|
||||
<hr>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label>Upload company logo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept=".jpg, .jpeg, .png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-9">
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
|
|
|
|||
73
ajax.php
73
ajax.php
|
|
@ -329,6 +329,79 @@ if (isset($_GET['get_client_contacts'])) {
|
|||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns ordered list of active assets for a specified client
|
||||
*/
|
||||
if (isset($_GET['get_client_assets'])) {
|
||||
enforceUserPermission('module_client');
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
|
||||
$asset_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT asset_id, asset_name, contact_name FROM assets
|
||||
LEFT JOIN clients on asset_client_id = client_id
|
||||
LEFT JOIN contacts ON contact_id = asset_contact_id
|
||||
WHERE assets.asset_archived_at IS NULL AND asset_client_id = $client_id
|
||||
$access_permission_query
|
||||
ORDER BY asset_important DESC, asset_name"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_array($asset_sql)) {
|
||||
$response['assets'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns locations for a specified client
|
||||
*/
|
||||
if (isset($_GET['get_client_locations'])) {
|
||||
enforceUserPermission('module_client');
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
|
||||
$locations_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT location_id, location_name FROM locations
|
||||
LEFT JOIN clients on location_client_id = client_id
|
||||
WHERE locations.location_archived_at IS NULL AND location_client_id = $client_id
|
||||
$access_permission_query
|
||||
ORDER BY location_primary DESC, location_name ASC"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_array($locations_sql)) {
|
||||
$response['locations'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns ordered list of vendors for a specified client
|
||||
*/
|
||||
if (isset($_GET['get_client_vendors'])) {
|
||||
enforceUserPermission('module_client');
|
||||
|
||||
$client_id = intval($_GET['client_id']);
|
||||
|
||||
$vendors_sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT vendor_id, vendor_name FROM vendors
|
||||
LEFT JOIN clients on vendor_client_id = client_id
|
||||
WHERE vendors.vendor_archived_at IS NULL AND vendor_client_id = $client_id
|
||||
$access_permission_query
|
||||
ORDER BY vendor_name ASC"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_array($vendors_sql)) {
|
||||
$response['vendors'][] = $row;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/*
|
||||
* NEW TOTP getter for client login/passwords page
|
||||
* When provided with a login ID, checks permissions and returns the 6-digit code
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $session_company_country = $row['company_country'];
|
|||
$session_company_locale = $row['company_locale'];
|
||||
$session_company_currency = $row['company_currency'];
|
||||
$currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
$session_company_logo = $row['company_logo'];
|
||||
|
||||
// Get contact info
|
||||
$contact_sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = $session_contact_id AND contact_client_id = $session_client_id");
|
||||
|
|
|
|||
|
|
@ -139,10 +139,13 @@ header("X-Frame-Options: DENY"); // Legacy
|
|||
</div>
|
||||
|
||||
<div class="col-md-11 p-0">
|
||||
<?php if ($session_company_logo) { ?>
|
||||
<img height="48" width="142" class="img-fluid float-right" src="<?php echo "../uploads/settings/$session_company_logo"; ?>">
|
||||
<?php } ?>
|
||||
<h4>Welcome, <strong><?php echo stripslashes(nullable_htmlentities($session_contact_name)); ?></strong>!</h4>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
//Alert Feedback
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ header("Content-Security-Policy: default-src 'self'");
|
|||
|
||||
require_once "includes/inc_all.php";
|
||||
|
||||
|
||||
// Billing Card Queries
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $session_client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'");
|
||||
|
|
@ -174,12 +173,12 @@ $sql_assigned_assets = mysqli_query(
|
|||
<a href="ticket_add.php" class="btn btn-primary btn-block mb-3">New ticket</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
// Billing Cards
|
||||
if ($session_contact_primary == 1 || $session_contact_is_billing_contact) { ?>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<?php if ($balance > 0) { ?>
|
||||
<div class="col-sm-3 offset-1">
|
||||
<div class="card">
|
||||
|
|
@ -210,9 +209,9 @@ if ($session_contact_primary == 1 || $session_contact_is_billing_contact) { ?>
|
|||
|
||||
<?php } //End Billing Cards ?>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
// Technical Cards
|
||||
if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
||||
if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ if (isset($_POST['add_ticket'])) {
|
|||
$subject = sanitizeInput($_POST['subject']);
|
||||
$details = mysqli_real_escape_string($mysqli, ($_POST['details']));
|
||||
$category = intval($_POST['category']);
|
||||
$asset = intval($_POST['asset']);
|
||||
|
||||
// Get settings from get_settings.php
|
||||
$config_ticket_prefix = sanitizeInput($config_ticket_prefix);
|
||||
|
|
@ -38,7 +39,7 @@ if (isset($_POST['add_ticket'])) {
|
|||
$new_config_ticket_next_number = $config_ticket_next_number + 1;
|
||||
mysqli_query($mysqli, "UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_source = 'Portal', ticket_category = $category, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = 1, ticket_billable = $config_ticket_default_billable, ticket_created_by = $session_user_id, ticket_contact_id = $session_contact_id, ticket_url_key = '$url_key', ticket_client_id = $session_client_id");
|
||||
mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_source = 'Portal', ticket_category = $category, ticket_subject = '$subject', ticket_details = '$details', ticket_priority = '$priority', ticket_status = 1, ticket_billable = $config_ticket_default_billable, ticket_created_by = $session_user_id, ticket_contact_id = $session_contact_id, ticket_asset_id = $asset, ticket_url_key = '$url_key', ticket_client_id = $session_client_id");
|
||||
$ticket_id = mysqli_insert_id($mysqli);
|
||||
|
||||
// Notify agent DL of the new ticket, if populated with a valid email
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
require_once 'includes/inc_all.php';
|
||||
|
||||
// Allow clients to select a related asset when raising a ticket
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type FROM assets WHERE asset_contact_id = $session_contact_id AND asset_client_id = $session_client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
|
|
@ -75,6 +78,30 @@ require_once 'includes/inc_all.php';
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (mysqli_num_rows($sql_assets) > 0) { ?>
|
||||
<div class="form-group">
|
||||
<label>Asset</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset">
|
||||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_assets)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = sanitizeInput($row['asset_name']);
|
||||
$asset_type = sanitizeInput($row['asset_type']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id ?>"><?php echo "$asset_name ($asset_type)"; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
// Client selected listener
|
||||
// We seem to have to use jQuery to listen for events, as the client input is a select2 component?
|
||||
|
||||
const clientSelectDropdown = document.getElementById("changeClientSelect"); // Define client selector
|
||||
|
||||
// // If the client selector is disabled, we must be on client_recurring_tickets.php instead. Trigger the contact list update.
|
||||
if (clientSelectDropdown.disabled) {
|
||||
|
||||
let client_id = $(clientSelectDropdown).find(':selected').val();
|
||||
|
||||
// Update the contacts dropdown list
|
||||
populateContactsDropdown(client_id);
|
||||
}
|
||||
|
||||
// Listener for client selection. Populate contact select when a client is selected
|
||||
$(clientSelectDropdown).on('select2:select', function (e) {
|
||||
let client_id = $(this).find(':selected').val();
|
||||
|
||||
// Update the contacts dropdown list
|
||||
populateContactsDropdown(client_id);
|
||||
|
||||
// TODO: Update the assets dropdown list
|
||||
|
||||
});
|
||||
|
||||
// Populate client contact function (after a client is selected)
|
||||
function populateContactsDropdown(client_id) {
|
||||
// Send a GET request to ajax.php as ajax.php?get_client_contacts=true&client_id=NUM
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_client_contacts: 'true', client_id: client_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from ajax.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the data for contacts (multiple)
|
||||
const contacts = response.contacts;
|
||||
|
||||
// Contacts dropdown
|
||||
const contactSelectDropdown = document.getElementById("contactSelect");
|
||||
|
||||
// Clear Category dropdown
|
||||
let i, L = contactSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
contactSelectDropdown.remove(i);
|
||||
}
|
||||
contactSelectDropdown[contactSelectDropdown.length] = new Option('- Contact -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
contacts.forEach(contact => {
|
||||
var appendText = "";
|
||||
if (contact.contact_primary == "1") {
|
||||
appendText = " (Primary)";
|
||||
} else if (contact.contact_technical == "1") {
|
||||
appendText = " (Technical)";
|
||||
}
|
||||
contactSelectDropdown[contactSelectDropdown.length] = new Option(contact.contact_name + appendText, contact.contact_id);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
// Used to populate dynamic content in recurring_ticket_add_modal and ticket_add_modal_v2 based on selected client
|
||||
|
||||
// Client selected listener
|
||||
// We seem to have to use jQuery to listen for events, as the client input is a select2 component?
|
||||
|
||||
const clientSelectDropdown = document.getElementById("changeClientSelect"); // Define client selector
|
||||
|
||||
// // If the client selector is disabled, we must be on a client-specific page instead. Trigger the lists to update.
|
||||
if (clientSelectDropdown.disabled) {
|
||||
|
||||
let client_id = $(clientSelectDropdown).find(':selected').val();
|
||||
|
||||
populateLists(client_id);
|
||||
}
|
||||
|
||||
// Listener for client selection. Populate select lists when a client is selected
|
||||
$(clientSelectDropdown).on('select2:select', function (e) {
|
||||
let client_id = $(this).find(':selected').val();
|
||||
|
||||
// Update the contacts dropdown list
|
||||
populateLists(client_id);
|
||||
|
||||
});
|
||||
|
||||
// Populates dropdowns with dynamic content based on the client ID
|
||||
// Called the client select dropdown is used or if the client select is disabled
|
||||
function populateLists(client_id) {
|
||||
|
||||
populateContactsDropdown(client_id);
|
||||
|
||||
populateAssetsDropdown(client_id);
|
||||
|
||||
populateLocationsDropdown(client_id);
|
||||
|
||||
populateVendorsDropdown(client_id);
|
||||
}
|
||||
|
||||
// Populate client contacts
|
||||
function populateContactsDropdown(client_id) {
|
||||
// Send a GET request to ajax.php as ajax.php?get_client_contacts=true&client_id=NUM
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_client_contacts: 'true', client_id: client_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from ajax.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the data for contacts (multiple)
|
||||
const contacts = response.contacts;
|
||||
|
||||
// Contacts dropdown
|
||||
const contactSelectDropdown = document.getElementById("contactSelect");
|
||||
|
||||
// Clear dropdown
|
||||
let i, L = contactSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
contactSelectDropdown.remove(i);
|
||||
}
|
||||
contactSelectDropdown[contactSelectDropdown.length] = new Option('- Contact -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
contacts.forEach(contact => {
|
||||
var appendText = "";
|
||||
if (contact.contact_primary == "1") {
|
||||
appendText = " (Primary)";
|
||||
} else if (contact.contact_technical == "1") {
|
||||
appendText = " (Technical)";
|
||||
}
|
||||
contactSelectDropdown[contactSelectDropdown.length] = new Option(contact.contact_name + appendText, contact.contact_id);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Populate client assets
|
||||
function populateAssetsDropdown(client_id) {
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_client_assets: 'true', client_id: client_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from ajax.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the data for assets (multiple)
|
||||
const assets = response.assets;
|
||||
|
||||
// Assets dropdown
|
||||
const assetSelectDropdown = document.getElementById("assetSelect");
|
||||
|
||||
// Clear dropdown
|
||||
let i, L = assetSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
assetSelectDropdown.remove(i);
|
||||
}
|
||||
assetSelectDropdown[assetSelectDropdown.length] = new Option('- Asset -', '0');
|
||||
|
||||
// Populate dropdown with asset name (and contact, if set)
|
||||
assets.forEach(asset => {
|
||||
let displayText = asset.asset_name;
|
||||
if (asset.contact_name !== null) {
|
||||
displayText = asset.asset_name + " - " + asset.contact_name;
|
||||
}
|
||||
|
||||
assetSelectDropdown[assetSelectDropdown.length] = new Option(displayText, asset.asset_id);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Populate client locations
|
||||
function populateLocationsDropdown(client_id) {
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_client_locations: 'true', client_id: client_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from ajax.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the data for locations (multiple)
|
||||
const locations = response.locations;
|
||||
|
||||
// Locations dropdown
|
||||
const locationSelectDropdown = document.getElementById("locationSelect");
|
||||
|
||||
// Clear dropdown
|
||||
let i, L = locationSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
locationSelectDropdown.remove(i);
|
||||
}
|
||||
locationSelectDropdown[locationSelectDropdown.length] = new Option('- Location -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
locations.forEach(location => {
|
||||
locationSelectDropdown[locationSelectDropdown.length] = new Option(location.location_name, location.location_id);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Populate client vendors
|
||||
function populateVendorsDropdown(client_id) {
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{get_client_vendors: 'true', client_id: client_id},
|
||||
function(data) {
|
||||
|
||||
// If we get a response from ajax.php, parse it as JSON
|
||||
const response = JSON.parse(data);
|
||||
|
||||
// Access the data for locations (multiple)
|
||||
const vendors = response.vendors;
|
||||
|
||||
// Locations dropdown
|
||||
const vendorSelectDropdown = document.getElementById("vendorSelect");
|
||||
|
||||
// Clear dropdown
|
||||
let i, L = vendorSelectDropdown.options.length - 1;
|
||||
for (i = L; i >= 0; i--) {
|
||||
vendorSelectDropdown.remove(i);
|
||||
}
|
||||
vendorSelectDropdown[vendorSelectDropdown.length] = new Option('- Vendor -', '0');
|
||||
|
||||
// Populate dropdown
|
||||
vendors.forEach(vendor => {
|
||||
vendorSelectDropdown[vendorSelectDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id);
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Priority <strong class="text-danger">*</strong></label>
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id_select; ?>"
|
||||
<?php if (isset($_GET['asset_id']) && $asset_id_select == $_GET['asset_id']) { echo "selected"; }
|
||||
<?php if (isset($_GET['asset_id']) && $asset_id_select == $_GET['asset_id']) { echo "selected"; }
|
||||
?>
|
||||
|
||||
><?php echo $asset_name_select; ?>
|
||||
|
|
@ -288,4 +288,4 @@
|
|||
<!-- Recurring Ticket Client/Contact JS -->
|
||||
<link rel="stylesheet" href="plugins/jquery-ui/jquery-ui.min.css">
|
||||
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="js/recurring_tickets_add_modal.js"></script>
|
||||
<script src="js/tickets_add_modal.js"></script>
|
||||
|
|
|
|||
|
|
@ -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="fas fa-fw fa-life-ring mr-2"></i>New Ticket</h5>
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket (v1)</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<?php if (isset($_GET['project_id'])) { ?>
|
||||
<input type="hidden" name="project" value="<?php echo intval($_GET['project_id']); ?>">
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<?php if (isset($_GET['client_id'])) { ?>
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Priority <strong class="text-danger">*</strong></label>
|
||||
|
|
@ -265,16 +265,16 @@
|
|||
}
|
||||
|
||||
?>
|
||||
<option value="<?php echo $contact_id_select; ?>"
|
||||
<?php
|
||||
<option value="<?php echo $contact_id_select; ?>"
|
||||
<?php
|
||||
if (isset($_GET['contact_id']) && $contact_id_select == intval($_GET['contact_id'])) {
|
||||
echo "selected";
|
||||
} elseif (empty($_GET['contact_id']) && $contact_primary_select == 1) {
|
||||
echo "selected";
|
||||
}
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?php echo "$contact_name_select$contact_title_display$contact_primary_display$contact_technical_display"; ?>
|
||||
<?php echo "$contact_name_select$contact_title_display$contact_primary_display$contact_technical_display"; ?>
|
||||
</option>
|
||||
|
||||
<?php } ?>
|
||||
|
|
@ -322,8 +322,8 @@
|
|||
$asset_name_select = nullable_htmlentities($row['asset_name']);
|
||||
$asset_contact_name_select = nullable_htmlentities($row['contact_name']);
|
||||
?>
|
||||
<option value="<?php echo $asset_id_select; ?>"
|
||||
<?php if (isset($_GET['asset_id']) && $asset_id_select == $_GET['asset_id']) { echo "selected"; }
|
||||
<option value="<?php echo $asset_id_select; ?>"
|
||||
<?php if (isset($_GET['asset_id']) && $asset_id_select == $_GET['asset_id']) { echo "selected"; }
|
||||
?>
|
||||
><?php echo "$asset_name_select - $asset_contact_name_select"; ?></option>
|
||||
|
||||
|
|
@ -380,7 +380,7 @@
|
|||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col">
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -417,7 +417,7 @@
|
|||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -486,4 +486,4 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,333 @@
|
|||
<div class="modal" id="addTicketModalv2" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket (v2)</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<!-- Hidden/System fields -->
|
||||
<?php if ($client_url && isset($client_id)) { ?>
|
||||
<input type="hidden" name="client" value="<?php echo $client_id; ?>>">
|
||||
<?php }
|
||||
if (isset($_GET['contact_id'])) { ?>
|
||||
<input type="hidden" name="contact" value="<?php echo intval($_GET['contact_id']); ?>">
|
||||
<?php }
|
||||
if (isset($_GET['project_id'])) { ?>
|
||||
<input type="hidden" name="project" value="<?php echo intval($_GET['project_id']); ?>">
|
||||
<?php } ?>
|
||||
<input type="hidden" name="billable" value="0">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<!-- Nav -->
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-add-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||
</li>
|
||||
<!-- Hide contact if in URL as it means we're creating a ticket from a contact record -->
|
||||
<?php if (!isset($_GET['contact_id'])) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-add-contacts"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-add-relationships"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- Ticket details -->
|
||||
<div class="tab-pane fade show active" id="pills-add-details">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Template</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" id="ticket_template_select" name="ticket_template_id" required>
|
||||
<option value="0">- Choose a Template -</option>
|
||||
<?php
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "
|
||||
SELECT tt.ticket_template_id,
|
||||
tt.ticket_template_name,
|
||||
tt.ticket_template_subject,
|
||||
tt.ticket_template_details,
|
||||
COUNT(ttt.task_template_id) as task_count
|
||||
FROM ticket_templates tt
|
||||
LEFT JOIN task_templates ttt
|
||||
ON tt.ticket_template_id = ttt.task_template_ticket_template_id
|
||||
WHERE tt.ticket_template_archived_at IS NULL
|
||||
GROUP BY tt.ticket_template_id
|
||||
ORDER BY tt.ticket_template_name ASC
|
||||
");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_ticket_templates)) {
|
||||
$ticket_template_id_select = intval($row['ticket_template_id']);
|
||||
$ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']);
|
||||
$ticket_template_subject_select = nullable_htmlentities($row['ticket_template_subject']);
|
||||
$ticket_template_details_select = nullable_htmlentities($row['ticket_template_details']);
|
||||
$task_count = intval($row['task_count']);
|
||||
?>
|
||||
<option value="<?php echo $ticket_template_id_select; ?>"
|
||||
data-subject="<?php echo $ticket_template_subject_select; ?>"
|
||||
data-details="<?php echo $ticket_template_details_select; ?>">
|
||||
<?php echo $ticket_template_name_select; ?> (<?php echo $task_count; ?> tasks)
|
||||
</option>
|
||||
<?php echo "aaaaa"; ?>
|
||||
<?php var_dump($row); ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Subject <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="subjectInput" name="subject" placeholder="Subject" maxlength="500" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control tinymceTicket<?php if ($config_ai_enable) { echo "AI"; } ?>" id="detailsInput" name="details"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Priority <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="priority" required>
|
||||
<option>Low</option>
|
||||
<option>Medium</option>
|
||||
<option>High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category">
|
||||
<option value="0">- Not Categorized -</option>
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_categories)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button"
|
||||
data-toggle="ajax-modal"
|
||||
data-modal-size="sm"
|
||||
data-ajax-url="ajax/ajax_category_add.php?category=Ticket">
|
||||
<i class="fas fa-fw fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Assign to</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="assigned_to">
|
||||
<option value="0">- Not Assigned -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT user_id, user_name FROM users
|
||||
WHERE user_role_id > 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||
);
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$user_id = intval($row['user_id']);
|
||||
$user_name = nullable_htmlentities($row['user_name']); ?>
|
||||
<option value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billable">
|
||||
<label class="custom-control-label" for="billable">Mark Billable</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Ticket client/contact -->
|
||||
<?php if (!isset($_GET['contact_id'])) { ?>
|
||||
<div class="tab-pane fade" id="pills-add-contacts">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Client <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="client" id="changeClientSelect" required <?php if ($client_url && isset($client_id)) { echo "disabled"; } ?>>
|
||||
<option value="">- Client -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$selectable_client_id = intval($row['client_id']);
|
||||
$client_name = nullable_htmlentities($row['client_name']); ?>
|
||||
|
||||
<option value="<?php echo $selectable_client_id; ?>" <?php if ($client_url && isset($client_id) && $client_id == $selectable_client_id) {echo "selected"; } ?>><?php echo $client_name; ?></option>
|
||||
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="contact" id="contactSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-add-relationships">
|
||||
To-do: project, etc.
|
||||
|
||||
<div class="form-group">
|
||||
<label> Asset </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="asset" id="assetSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label> Location </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="location" id="locationSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label> Vendor </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor" id="vendorSelect">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label>Vendor Ticket Number</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ticket Templates -->
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var templateSelect = $('#ticket_template_select');
|
||||
var subjectInput = document.getElementById('subjectInput');
|
||||
var detailsInput = document.getElementById('detailsInput');
|
||||
|
||||
templateSelect.on('select2:select', function(e) {
|
||||
var selectedOption = e.params.data.element;
|
||||
var templateSubject = selectedOption.getAttribute('data-subject');
|
||||
var templateDetails = selectedOption.getAttribute('data-details');
|
||||
|
||||
// Update Subject
|
||||
subjectInput.value = templateSubject || '';
|
||||
|
||||
// Update Details
|
||||
if (typeof tinymce !== 'undefined') {
|
||||
var editor = tinymce.get('detailsInput');
|
||||
if (editor) {
|
||||
editor.setContent(templateDetails || '');
|
||||
} else {
|
||||
detailsInput.value = templateDetails || '';
|
||||
}
|
||||
} else {
|
||||
detailsInput.value = templateDetails || '';
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Ticket Client/Contact JS -->
|
||||
<link rel="stylesheet" href="plugins/jquery-ui/jquery-ui.min.css">
|
||||
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="js/tickets_add_modal.js"></script>
|
||||
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" data-tags="true" name="watcher_email">
|
||||
<option value="">- Select a contact or enter an email -</option>
|
||||
<option value="">- Select a contact or enter an email(s) -</option>
|
||||
<?php
|
||||
|
||||
$sql_client_contacts_select = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_email FROM contacts WHERE contact_client_id = $client_id AND contact_email <> '' ORDER BY contact_name ASC");
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ if (isset($_GET['remove_company_logo'])) {
|
|||
|
||||
unlink("uploads/settings/$company_logo");
|
||||
|
||||
mysqli_query($mysqli,"UPDATE companies SET company_logo = NULL WHERE company_id = 1");
|
||||
|
||||
// Logging
|
||||
logAction("Settings", "Edit", "$session_name deleted company logo");
|
||||
|
||||
|
|
|
|||
|
|
@ -423,66 +423,73 @@ if (isset($_POST['add_ticket_watcher'])) {
|
|||
$ticket_id = intval($_POST['ticket_id']);
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$ticket_number = sanitizeInput($_POST['ticket_number']);
|
||||
$watcher_email = sanitizeInput($_POST['watcher_email']);
|
||||
$watcher_emails = preg_split("/,| |;/", $_POST['watcher_email']); // Split on comma, semicolon or space, we sanitize later
|
||||
$notify = intval($_POST['watcher_notify']);
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_watchers SET watcher_email = '$watcher_email', watcher_ticket_id = $ticket_id");
|
||||
// Process each watcher in list
|
||||
foreach ($watcher_emails as $watcher_email) {
|
||||
|
||||
// Notify watcher
|
||||
if ($notify && !empty($config_smtp_host)) {
|
||||
|
||||
// Get contact/ticket details
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_category, ticket_subject, ticket_details, ticket_priority, ticket_status_name, ticket_url_key, ticket_created_by, ticket_assigned_to, ticket_client_id FROM tickets
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE ticket_id = $ticket_id
|
||||
AND ticket_closed_at IS NULL");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_category = sanitizeInput($row['ticket_category']);
|
||||
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||
$ticket_details = mysqli_escape_string($mysqli, $row['ticket_details']);
|
||||
$ticket_priority = sanitizeInput($row['ticket_priority']);
|
||||
$ticket_status = sanitizeInput($row['ticket_status_name']);
|
||||
$url_key = sanitizeInput($row['ticket_url_key']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$ticket_created_by = intval($row['ticket_created_by']);
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
|
||||
// Get Company Phone Number
|
||||
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$company_name = sanitizeInput($row['company_name']);
|
||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||
|
||||
// Email content
|
||||
$data = []; // Queue array
|
||||
|
||||
$subject = "Ticket Notification - [$ticket_prefix$ticket_number] - $ticket_subject";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello,<br><br>You have been added as a collaborator on this ticket regarding \"$ticket_subject\".<br><br>--------------------------------<br>$ticket_details--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Guest link: https://$config_base_url/guest/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
|
||||
// Only add watcher to email queue if email is valid
|
||||
if (filter_var($watcher_email, FILTER_VALIDATE_EMAIL)) {
|
||||
$data[] = [
|
||||
'from' => $config_ticket_from_email,
|
||||
'from_name' => $config_ticket_from_name,
|
||||
'recipient' => $watcher_email,
|
||||
'recipient_name' => $watcher_email,
|
||||
'subject' => $subject,
|
||||
'body' => $body
|
||||
];
|
||||
|
||||
$watcher_email = sanitizeInput($watcher_email);
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO ticket_watchers SET watcher_email = '$watcher_email', watcher_ticket_id = $ticket_id");
|
||||
|
||||
// Notify watcher
|
||||
if ($notify && !empty($config_smtp_host)) {
|
||||
|
||||
// Get contact/ticket details
|
||||
$sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_category, ticket_subject, ticket_details, ticket_priority, ticket_status_name, ticket_url_key, ticket_created_by, ticket_assigned_to, ticket_client_id FROM tickets
|
||||
LEFT JOIN clients ON ticket_client_id = client_id
|
||||
LEFT JOIN contacts ON ticket_contact_id = contact_id
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE ticket_id = $ticket_id
|
||||
AND ticket_closed_at IS NULL");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$ticket_prefix = sanitizeInput($row['ticket_prefix']);
|
||||
$ticket_number = intval($row['ticket_number']);
|
||||
$ticket_category = sanitizeInput($row['ticket_category']);
|
||||
$ticket_subject = sanitizeInput($row['ticket_subject']);
|
||||
$ticket_details = mysqli_escape_string($mysqli, $row['ticket_details']);
|
||||
$ticket_priority = sanitizeInput($row['ticket_priority']);
|
||||
$ticket_status = sanitizeInput($row['ticket_status_name']);
|
||||
$url_key = sanitizeInput($row['ticket_url_key']);
|
||||
$client_id = intval($row['ticket_client_id']);
|
||||
$ticket_created_by = intval($row['ticket_created_by']);
|
||||
$ticket_assigned_to = intval($row['ticket_assigned_to']);
|
||||
|
||||
// Get Company Phone Number
|
||||
$sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$company_name = sanitizeInput($row['company_name']);
|
||||
$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code']));
|
||||
|
||||
// Email content
|
||||
$data = []; // Queue array
|
||||
|
||||
$subject = "Ticket Notification - [$ticket_prefix$ticket_number] - $ticket_subject";
|
||||
$body = "<i style=\'color: #808080\'>##- Please type your reply above this line -##</i><br><br>Hello,<br><br>You have been added as a collaborator on this ticket regarding \"$ticket_subject\".<br><br>--------------------------------<br>$ticket_details--------------------------------<br><br>Ticket: $ticket_prefix$ticket_number<br>Subject: $ticket_subject<br>Status: $ticket_status<br>Guest link: https://$config_base_url/guest/guest_view_ticket.php?ticket_id=$ticket_id&url_key=$url_key<br><br>--<br>$company_name - Support<br>$config_ticket_from_email<br>$company_phone";
|
||||
|
||||
$data[] = [
|
||||
'from' => $config_ticket_from_email,
|
||||
'from_name' => $config_ticket_from_name,
|
||||
'recipient' => $watcher_email,
|
||||
'recipient_name' => $watcher_email,
|
||||
'subject' => $subject,
|
||||
'body' => $body
|
||||
];
|
||||
|
||||
addToMailQueue($data);
|
||||
}
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", "Edit", "$session_name added $watcher_email as a watcher for ticket $config_ticket_prefix$ticket_number", $client_id, $ticket_id);
|
||||
}
|
||||
|
||||
addToMailQueue($data);
|
||||
}
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", "Edit", "$session_name added $watcher_email as a watcher for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
|
||||
|
||||
$_SESSION['alert_message'] = "Added <strong>$watcher_email</strong> as a watcher";
|
||||
$_SESSION['alert_message'] = "Added watcher(s)";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
|
@ -747,7 +754,7 @@ if (isset($_GET['delete_ticket'])) {
|
|||
|
||||
// Delete all ticket views
|
||||
mysqli_query($mysqli, "DELETE FROM ticket_views WHERE view_ticket_id = $ticket_id");
|
||||
|
||||
|
||||
// Delete ticket watchers
|
||||
mysqli_query($mysqli, "DELETE FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id");
|
||||
|
||||
|
|
@ -755,7 +762,7 @@ if (isset($_GET['delete_ticket'])) {
|
|||
mysqli_query($mysqli, "DELETE FROM ticket_attachments WHERE ticket_attachment_ticket_id = $ticket_id");
|
||||
removeDirectory("uploads/tickets/$ticket_id");
|
||||
|
||||
// No Need to delete ticket assets as this is cascadely deleted via the database.
|
||||
// No Need to delete ticket assets as this is cascadely deleted via the database.
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", "Delete", "$session_name deleted $ticket_prefix$ticket_number along with all replies", $client_id);
|
||||
|
|
@ -797,7 +804,7 @@ if (isset($_POST['bulk_delete_tickets'])) {
|
|||
mysqli_query($mysqli, "DELETE FROM ticket_attachments WHERE ticket_attachment_ticket_id = $ticket_id");
|
||||
removeDirectory("uploads/tickets/$ticket_id");
|
||||
|
||||
// No Need to delete ticket assets as this is cascadely deleted via the database.
|
||||
// No Need to delete ticket assets as this is cascadely deleted via the database.
|
||||
|
||||
// Logging
|
||||
logAction("Ticket", "Delete", "$session_name deleted ticket", 0, $ticket_id);
|
||||
|
|
@ -989,7 +996,7 @@ if (isset($_POST['bulk_edit_ticket_category'])) {
|
|||
$sql = mysqli_query($mysqli, "SELECT category_name FROM categories WHERE category_id = $category_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$category_name = sanitizeInput($row['category_name']);
|
||||
|
||||
|
||||
// Update ticket
|
||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_category = '$category_id' WHERE ticket_id = $ticket_id");
|
||||
|
||||
|
|
@ -1100,7 +1107,7 @@ if (isset($_POST['bulk_resolve_tickets'])) {
|
|||
// Check to make sure Tasks are complete before resolving
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('task_id') AS num FROM tasks WHERE task_completed_at IS NULL AND task_ticket_id = $ticket_id"));
|
||||
$num_of_open_tasks = $row['num'];
|
||||
|
||||
|
||||
if ($num_of_open_tasks == 0) {
|
||||
// Count the Ticket Loop
|
||||
$ticket_count++;
|
||||
|
|
|
|||
11
ticket.php
11
ticket.php
|
|
@ -888,11 +888,12 @@ if (isset($_GET['ticket_id'])) {
|
|||
<?php } ?>
|
||||
|
||||
<!-- Internal collaborators -->
|
||||
<?php if ($ticket_collaborators) { ?>
|
||||
<div class="mt-1">
|
||||
<i class="fas fa-fw fa-users mr-2 text-secondary"></i><strong>Collaborators: </strong><?php echo $ticket_collaborators; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- Commented - there is still something wrong with this -->
|
||||
<!-- --><?php //if ($ticket_collaborators) { ?>
|
||||
<!-- <div class="mt-1">-->
|
||||
<!-- <i class="fas fa-fw fa-users mr-2 text-secondary"></i><strong>Collaborators: </strong>--><?php //echo $ticket_collaborators; ?>
|
||||
<!-- </div>-->
|
||||
<!-- --><?php //} ?>
|
||||
|
||||
<!-- Resolved -->
|
||||
<?php if (!empty($ticket_resolved_at)) { ?>
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ $sql_categories = mysqli_query(
|
|||
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModalv2">
|
||||
<i class="fas fa-plus"></i><span class="d-none d-lg-inline ml-2">New Ticket</span>
|
||||
</button>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
|
|
@ -438,6 +438,6 @@ if (isset($_GET["view"])) {
|
|||
<script src="js/bulk_actions.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "modals/ticket_add_modal.php";
|
||||
require_once "modals/ticket_add_modal_v2.php";
|
||||
require_once "modals/ticket_export_modal.php";
|
||||
require_once "includes/footer.php";
|
||||
|
|
|
|||
Loading…
Reference in New Issue