Merge branch 'master' into techbar

This commit is contained in:
ThaMunsta
2024-11-13 17:19:57 -05:00
3685 changed files with 17272 additions and 285009 deletions
+4
View File
@@ -22,3 +22,7 @@ plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/URI/*
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/* plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/*
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep !plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep
.vscode/settings.json .vscode/settings.json
xcustom/*
!xcustom/readme.php
post/xcustom
!post/xcustom/readme.php
+1 -1
View File
@@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at reported to the community leaders responsible for enforcement at
the forums / Discord. the forums.
All complaints will be reviewed and investigated promptly and fairly. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the All community leaders are obligated to respect the privacy and security of the
+1
View File
@@ -121,6 +121,7 @@ If you want to improve ITFlow, feel free to fork the repo and create a pull requ
### Supporters ### Supporters
Were incredibly grateful to the organizations and individuals who support the project - a big thank you to: Were incredibly grateful to the organizations and individuals who support the project - a big thank you to:
- CompuMatter - CompuMatter
- F1 for HELP
- JetBrains - JetBrains
<!-- LICENSE --> <!-- LICENSE -->
+13 -2
View File
@@ -6,6 +6,9 @@ $order = "ASC";
require_once "inc_all.php"; require_once "inc_all.php";
// Perms
enforceUserPermission('module_financial');
//Rebuild URL //Rebuild URL
$url_query_strings_sort = http_build_query($get_copy); $url_query_strings_sort = http_build_query($get_copy);
@@ -42,8 +45,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_currency_code&order=<?php echo $disp; ?>">Currency</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_currency_code&order=<?php echo $disp; ?>">
Currency <?php if ($sort == 'account_currency_code') { echo $order_icon; } ?>
</a>
</th>
<th class="text-right">Balance</th> <th class="text-right">Balance</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
+25 -5
View File
@@ -78,11 +78,31 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_client_id&order=<?php echo $disp; ?>">Client</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_name&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_secret&order=<?php echo $disp; ?>">Secret</a></th> Name <?php if ($sort == 'api_key_name') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_created_at&order=<?php echo $disp; ?>">Created</a></th> </a>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_expire&order=<?php echo $disp; ?>">Expires</a></th> </th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_client_id&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'api_key_client_id') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_secret&order=<?php echo $disp; ?>">
Secret <?php if ($sort == 'api_key_secret') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_created_at&order=<?php echo $disp; ?>">
Created <?php if ($sort == 'api_key_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=api_key_expire&order=<?php echo $disp; ?>">
Expires <?php if ($sort == 'api_key_expire') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
+1 -1
View File
@@ -60,7 +60,7 @@ $decryptPW = randomString(160);
<select class="form-control select2" name="client" required> <select class="form-control select2" name="client" required>
<option value="0"> ALL CLIENTS </option> <option value="0"> ALL CLIENTS </option>
<?php <?php
$sql = mysqli_query($mysqli, "SELECT * FROM clients ORDER BY client_name ASC"); $sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']); $client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?> $client_name = nullable_htmlentities($row['client_name']); ?>
+43 -11
View File
@@ -200,16 +200,48 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-sm table-striped table-borderless table-hover"> <table class="table table-sm table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_created_at&order=<?php echo $disp; ?>">Timestamp</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">User</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_created_at&order=<?php echo $disp; ?>">
<?php if(empty($client)) { ?> Timestamp <?php if ($sort == 'log_created_at') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Client</a></th> </a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">
User <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (empty($client)) { ?>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_type&order=<?php echo $disp; ?>">Type</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_action&order=<?php echo $disp; ?>">Action</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_type&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_description&order=<?php echo $disp; ?>">Description</a></th> Type <?php if ($sort == 'log_type') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_ip&order=<?php echo $disp; ?>">IP Address</a></th> </a>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_user_agent&order=<?php echo $disp; ?>">User Agent</a></th> </th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_action&order=<?php echo $disp; ?>">
Action <?php if ($sort == 'log_action') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_description&order=<?php echo $disp; ?>">
Description <?php if ($sort == 'log_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_ip&order=<?php echo $disp; ?>">
IP Address <?php if ($sort == 'log_ip') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=log_user_agent&order=<?php echo $disp; ?>">
User Agent <?php if ($sort == 'log_user_agent') { echo $order_icon; } ?>
</a>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -237,7 +269,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
if (empty($client_name)) { if (empty($client_name)) {
$client_name_display = "-"; $client_name_display = "-";
} else { } else {
$client_name_display = "<a href='client_logs.php?client_id=$client_id&tab=logs'>$client_name</a>"; $client_name_display = "<a href='client_overview.php?client_id=$client_id'>$client_name</a>";
} }
$log_entity_id = intval($row['log_entity_id']); $log_entity_id = intval($row['log_entity_id']);
@@ -253,7 +285,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<td><?php echo $log_action; ?></td> <td><?php echo $log_action; ?></td>
<td><?php echo $log_description; ?></td> <td><?php echo $log_description; ?></td>
<td><?php echo $log_ip; ?></td> <td><?php echo $log_ip; ?></td>
<td><?php echo "$log_user_os<br>$log_user_browser"; ?></td> <td><?php echo "$log_user_os<div class='text-secondary'>$log_user_browser</div>"; ?></td>
</tr> </tr>
<?php <?php
+3 -2
View File
@@ -1,13 +1,14 @@
<?php <?php
require_once "inc_all_admin.php"; require_once "inc_all_admin.php";
?> ?>
<div class="card card-dark mb-3"> <div class="card card-dark mb-3">
<div class="card-header py-3"> <div class="card-header py-3">
<h3 class="card-title"><i class="fas fa-fw fa-database mr-2"></i>Download Database</h3> <h3 class="card-title"><i class="fas fa-fw fa-database mr-2"></i>Download Database</h3>
</div> </div>
<div class="card-body" style="text-align: center;"> <div class="card-body" style="text-align: center;">
<a class="btn btn-primary btn-lg p-3" href="post.php?download_database&csrf_token=<?php echo $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-4x fa-download"></i><br><br>Download</a> <div class="alert alert-secondary">If you are unable to back up the entire VM, you'll need to back up the files & database individually. There is no built-in restore. See the <a href="https://docs.itflow.org/backups" target="_blank">docs here</a>.</div>
<a class="btn btn-primary btn-lg p-3" href="post.php?download_database&csrf_token=<?php echo $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-4x fa-download"></i><br><br>Download database</a>
</div> </div>
</div> </div>
+5 -5
View File
@@ -113,12 +113,12 @@ if (isset($_GET['archived'])) {
<hr> <hr>
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
echo "d-none";
} ?>">
<tr> <tr>
<th><a class="text-dark" <th>
href="?<?php echo $url_query_strings_sort; ?>&sort=category_name&order=<?php echo $disp; ?>">Name</a> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=category_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th> </th>
<th>Color</th> <th>Color</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
@@ -50,10 +50,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_order&order=<?php echo $disp; ?>">Order</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_name&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_uri&order=<?php echo $disp; ?>">URI / <span class="text-secondary">New Tab</span></a></th> Name <?php if ($sort == 'custom_link_name') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_location&order=<?php echo $disp; ?>">Location</a></th> </a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_order&order=<?php echo $disp; ?>">
Order <?php if ($sort == 'custom_link_order') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_uri&order=<?php echo $disp; ?>">
URI / <span class="text-secondary">New Tab</span> <?php if ($sort == 'custom_link_uri') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_location&order=<?php echo $disp; ?>">
Location <?php if ($sort == 'custom_link_location') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -78,6 +94,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$custom_link_order_display = $custom_link_order; $custom_link_order_display = $custom_link_order;
} }
$custom_link_location = intval($row['custom_link_location']); $custom_link_location = intval($row['custom_link_location']);
if ($custom_link_location == 1) {
$custom_link_location_display = "Main Side Nav";
} else {
$custom_link_location_display = "Top Nav";
}
?> ?>
<tr> <tr>
@@ -89,7 +110,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</td> </td>
<td><?php echo $custom_link_order_display; ?></td> <td><?php echo $custom_link_order_display; ?></td>
<td><?php echo "$custom_link_uri $custom_link_new_tab_display"; ?></td> <td><?php echo "$custom_link_uri $custom_link_new_tab_display"; ?></td>
<td><?php echo $custom_link_location; ?></td> <td><?php echo $custom_link_location_display; ?></td>
<td> <td>
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"> <button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
+1
View File
@@ -66,6 +66,7 @@
</div> </div>
<select class="form-control select2" name="location" required> <select class="form-control select2" name="location" required>
<option value="1">Main Side Nav</option> <option value="1">Main Side Nav</option>
<option value="2">Top Nav (Icon Required)</option>
</select> </select>
</div> </div>
</div> </div>
+1
View File
@@ -64,6 +64,7 @@
</div> </div>
<select class="form-control select2" name="location" required> <select class="form-control select2" name="location" required>
<option value="1" <?php if ($custom_link_location == 1) { echo "selected"; } ?> >Main Side Nav</option> <option value="1" <?php if ($custom_link_location == 1) { echo "selected"; } ?> >Main Side Nav</option>
<option value="2" <?php if ($custom_link_location == 2) { echo "selected"; } ?> >Top Nav (Icon Required)</option>
</select> </select>
</div> </div>
</div> </div>
+690 -277
View File
File diff suppressed because it is too large Load Diff
+137
View File
@@ -0,0 +1,137 @@
<?php
// Default Column Sort by Filter
$sort = "document_name";
$order = "ASC";
require_once "inc_all_admin.php";
// Search query SQL snippet
if (!empty($q)) {
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
} else {
$query_snippet = ""; // empty
}
// Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
LEFT JOIN users ON document_created_by = user_id
WHERE document_template = 1
$query_snippet
ORDER BY $sort $order LIMIT $record_from, $record_to"
);
$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="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
<i class="fas fa-plus mr-2"></i>New Template
</button>
</div>
</div>
<div class="card-body">
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search templates">
<div class="input-group-append">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
Template Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
Updated <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
Action
</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($sql)) {
$document_id = intval($row['document_id']);
$document_name = nullable_htmlentities($row['document_name']);
$document_description = nullable_htmlentities($row['document_description']);
$document_content = nullable_htmlentities($row['document_content']);
$document_created_by_name = nullable_htmlentities($row['user_name']);
$document_created_at = nullable_htmlentities($row['document_created_at']);
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
$document_folder_id = intval($row['document_folder_id']);
?>
<tr>
<td>
<a class="text-bold" href="admin_document_template_details.php?document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt text-dark"></i> <?php echo $document_name; ?></a>
<div class="mt-1 text-secondary"><?php echo $document_description; ?></div>
</td>
<td>
<?php echo $document_created_at; ?>
<div class="text-secondary"><?php echo $document_created_by_name; ?></div>
</td>
<td><?php echo $document_updated_at; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
include "admin_document_template_edit_modal.php";
}
?>
</tbody>
</table>
<br>
</div>
<?php include "pagination.php"; ?>
</div>
</div>
<?php include "admin_document_template_add_modal.php"; ?>
<?php include "footer.php"; ?>
+2 -2
View File
@@ -31,10 +31,10 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
<a href="clients.php">Home</a> <a href="clients.php">Home</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_users.php">Admin</a> <a href="admin_user.php">Admin</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_document_templates.php">Document Templates</a> <a href="admin_document_template.php">Document Templates</a>
</li> </li>
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li> <li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
</ol> </ol>
-139
View File
@@ -1,139 +0,0 @@
<?php
// Default Column Sort by Filter
$sort = "document_name";
$order = "ASC";
require_once "inc_all_admin.php";
// Search query SQL snippet
if (!empty($q)) {
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
}else{
$query_snippet = ""; // empty
}
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM documents
LEFT JOIN users ON document_created_by = user_id
WHERE document_template = 1
$query_snippet
ORDER BY $sort $order LIMIT $record_from, $record_to"
);
$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="fa fa-fw fa-file mr-2"></i>Document Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
<i class="fas fa-plus mr-2"></i>New Template
</button>
</div>
</div>
<div class="card-body">
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search templates">
<div class="input-group-append">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">Template Name</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">Created</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">Updated</a>
</th>
<th class="text-center">
Action
</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_array($sql)) {
$document_id = intval($row['document_id']);
$document_name = nullable_htmlentities($row['document_name']);
$document_description = nullable_htmlentities($row['document_description']);
$document_content = nullable_htmlentities($row['document_content']);
$document_created_by_name = nullable_htmlentities($row['user_name']);
$document_created_at = nullable_htmlentities($row['document_created_at']);
$document_updated_at = nullable_htmlentities($row['document_updated_at']);
$document_folder_id = intval($row['document_folder_id']);
?>
<tr>
<td>
<a class="text-bold" href="admin_document_template_details.php?document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt text-dark"></i> <?php echo $document_name; ?></a>
<div class="mt-1 text-secondary"><?php echo $document_description; ?></div>
</td>
<td>
<?php echo $document_created_at; ?>
<div class="text-secondary"><?php echo $document_created_by_name; ?></div>
</td>
<td><?php echo $document_updated_at; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
include "admin_document_template_edit_modal.php";
}
?>
</tbody>
</table>
<br>
</div>
<?php include "pagination.php";
?>
</div>
</div>
<?php include "admin_document_template_add_modal.php";
?>
<?php include "footer.php";
?>
+335
View File
@@ -0,0 +1,335 @@
<?php
require_once "inc_all_admin.php";
require_once "database_version.php";
require_once "config.php";
$folderPath = 'uploads';
function countFilesInDirectory($dir) {
$count = 0;
$size = 0;
$files = scandir($dir);
foreach ($files as $file) {
if ($file === '.' || $file === '..') {
continue;
}
$filePath = $dir . '/' . $file;
if (is_file($filePath)) {
$count++;
$size += filesize($filePath);
} elseif (is_dir($filePath)) {
$result = countFilesInDirectory($filePath);
$count += $result['count'];
$size += $result['size'];
}
}
return [
'count' => $count,
'size' => $size
];
}
// Function to compare two arrays recursively and return the differences
function arrayDiffRecursive($array1, $array2) {
$diff = array();
foreach ($array1 as $key => $value) {
if (is_array($value)) {
if (!isset($array2[$key]) || !is_array($array2[$key])) {
$diff[$key] = $value;
} else {
$recursiveDiff = arrayDiffRecursive($value, $array2[$key]);
if (!empty($recursiveDiff)) {
$diff[$key] = $recursiveDiff;
}
}
} else {
if (!isset($array2[$key]) || $array2[$key] !== $value) {
$diff[$key] = $value;
}
}
}
return $diff;
}
// Function to load the table structures from an SQL dump file URL
function loadTableStructuresFromSQLDumpURL($fileURL) {
$context = stream_context_create(array('http' => array('header' => 'Accept: application/octet-stream')));
$fileContent = file_get_contents($fileURL, false, $context);
if ($fileContent === false) {
return null;
}
$structure = array();
$queries = explode(";", $fileContent);
foreach ($queries as $query) {
$query = trim($query);
if (!empty($query)) {
if (preg_match("/^CREATE TABLE `(.*)` \((.*)\)$/s", $query, $matches)) {
$tableName = $matches[1];
$tableStructure = $matches[2];
$structure[$tableName] = array('structure' => $tableStructure);
}
}
}
return $structure;
}
// Function to fetch the database structure from the MySQL server
function fetchDatabaseStructureFromServer() {
global $mysqli;
$tables = array();
// Fetch table names
$result = $mysqli->query("SHOW TABLES");
if ($result->num_rows > 0) {
while ($row = $result->fetch_row()) {
$tableName = $row[0];
$tables[$tableName] = array();
}
}
// Fetch table structures
foreach ($tables as $tableName => &$table) {
$result = $mysqli->query("SHOW CREATE TABLE `$tableName`");
if ($result->num_rows > 0) {
$row = $result->fetch_row();
$table['structure'] = $row[1];
}
}
return $tables;
}
//function to get current crontab and return it as an array
function get_crontab() {
$crontab = shell_exec('crontab -l');
$crontab = explode(PHP_EOL, $crontab);
return $crontab;
}
// URL to the SQL dump file
$fileURL = "https://raw.githubusercontent.com/itflow-org/itflow/master/db.sql";
// Load the desired table structures from the SQL dump file URL
$desiredStructure = loadTableStructuresFromSQLDumpURL($fileURL);
if ($desiredStructure === null) {
die("Failed to load the desired table structures from the SQL dump file URL.");
}
// Fetch the current database structure from the MySQL server
$currentStructure = fetchDatabaseStructureFromServer();
if ($currentStructure === null) {
die("Failed to fetch the current database structure from the server.");
}
// Compare the structures and display the differences
$differences = arrayDiffRecursive($desiredStructure, $currentStructure);
//DB Stats
// Query to fetch the number of tables
$tablesQuery = "SHOW TABLES";
$tablesResult = $mysqli->query($tablesQuery);
$numTables = $tablesResult->num_rows;
$numFields = 0;
$numRows = 0;
// Loop through each table
while ($row = $tablesResult->fetch_row()) {
$tableName = $row[0];
// Query to fetch the number of fields
$fieldsQuery = "DESCRIBE `$tableName`";
$fieldsResult = $mysqli->query($fieldsQuery);
// Check if the query was successful
if ($fieldsResult) {
$numFields += $fieldsResult->num_rows;
// Query to fetch the number of rows
$rowsQuery = "SELECT COUNT(*) FROM `$tableName`";
$rowsResult = $mysqli->query($rowsQuery);
// Check if the query was successful
if ($rowsResult) {
$numRows += $rowsResult->fetch_row()[0];
} else {
echo "Error executing query: " . $mysqli->error;
}
} else {
echo "Error executing query: " . $mysqli->error;
}
}
//Get loaded PHP modules
$loadedModules = get_loaded_extensions();
//Get Server Info / Service versions
$phpVersion = phpversion();
$databaseInfo = mysqli_get_server_info($mysqli) . " / " . $mysqli->server_version;
$operatingSystem = php_uname();
$webServer = $_SERVER['SERVER_SOFTWARE'];
$errorLog = ini_get('error_log') ?: "Debian/Ubuntu default is usually /var/log/apache2/error.log";
$updates = fetchUpdates();
?>
<div class="card card-dark">
<div class="card-header py-3">
<h3 class="card-title"><i class="fas fa-fw fa-bug mr-2"></i>Debug</h3>
</div>
<div class="card-body">
<h2>Debugging</h2>
<ul>
<li>If you are experiencing a problem with ITFlow you may be directed to this page to gather server/app info.</li>
<li>When creating forum posts / support requests ensure you share the information under <i>Server Info</i>, <i>ITFlow app</i> and <i>Database stats</i>.</li>
<li><a class="text-danger text-bold">Caution:</a> Be careful when sharing the full debug output - it contains your PHP session variables/cookies ("PHPSESSID") which could allow anyone to login to your ITFlow instance</li>
<li>Note: Sometimes you might need to gather <a href="https://docs.itflow.org/gathering_logs#error_logs">PHP error logs</a> as well</li>
</ul>
<br>
<h3>Server Info</h3>
<?php
echo "PHP version: " . $phpVersion . "<br>";
echo "Database Version: " . $databaseInfo . "<br>";
echo "Operating System: " . $operatingSystem . "<br>";
echo "Web Server: " . $webServer . "<br>";
echo "Apache/PHP Error Log: " . $errorLog
?>
<hr>
<h3>File System</h3>
<?php
$result = countFilesInDirectory($folderPath);
$totalFiles = $result['count'];
$totalSizeMB = round($result['size'] / (1024 * 1024), 2);
echo "Total number of files in $folderPath and its subdirectories: " . $totalFiles . "<br>";
echo "Total size of files in $folderPath and its subdirectories: " . $totalSizeMB . " MB";
?>
<hr>
<h3>ITFlow app</h3>
<?php
echo "App Version: " . $updates->current_version . "<br>";
echo "Cron enabled: " . $config_enable_cron . "<br>";
echo "App Timezone: " . $config_timezone;
?>
<hr>
<h3>Database Structure Check</h3>
<h4>Database stats</h4>
<?php
echo "Number of tables: " . $numTables . "<br>";
echo "Total number of fields: " . $numFields . "<br>";
echo "Total number of rows: " . $numRows . "<br>";
echo "Current Database Version: " . CURRENT_DATABASE_VERSION . "<br>";
?>
<hr>
<h4>Table Stats</h4>
<?php
// Fetch all table names from the database
$tables = array();
$result = mysqli_query($mysqli, "SHOW TABLES");
while ($row = mysqli_fetch_array($result)) {
$tables[] = $row[0];
}
// Generate an HTML table to display the results
?>
<table class="table table-sm">
<tr>
<th>Table Name</th>
<th>Number of Fields</th>
<th>Number of Rows</th>
</tr>
<?php
foreach ($tables as $table) {
// Count the number of fields and rows for each table
$columns_result = mysqli_query($mysqli, "SHOW COLUMNS FROM `$table`");
$columns = mysqli_num_rows($columns_result);
$rows_result = mysqli_query($mysqli, "SELECT COUNT(*) FROM `$table`");
$rows = mysqli_fetch_array($rows_result)[0];
?>
<tr>
<td><?php echo $table; ?></td>
<td><?php echo $columns; ?></td>
<td><?php echo $rows; ?></td>
</tr>
<?php
}
?>
</table>
<hr>
<h3>PHP Modules Installed</h3>
<?php
foreach ($loadedModules as $module) {
echo $module . "<br>";
}
?>
<hr>
<h3>PHP Info</h3>
<?php
//Output phpinfo, but in a way that doesnt mess up the page
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
//Remove everything before the body tag
$phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $phpinfo);
//Remove everything after the body tag
$phpinfo = preg_replace('%^(.*)</body>.*$%ms', '$1', $phpinfo);
//Remove the body tag itself
$phpinfo = preg_replace('%^<body>(.*)$%ms', '$1', $phpinfo);
//Output the result
echo $phpinfo;
?>
<hr>
</div>
</div>
<?php
require_once "footer.php";
+35 -7
View File
@@ -102,13 +102,41 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_id&order=<?php echo $disp; ?>">ID</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_queued_at&order=<?php echo $disp; ?>">Queued</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_id&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_from&order=<?php echo $disp; ?>">From</a></th> ID <?php if ($sort == 'email_id') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_recipient&order=<?php echo $disp; ?>">To</a></th> </a>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_subject&order=<?php echo $disp; ?>">Subject</a></th> </th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_status&order=<?php echo $disp; ?>">Status</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_attempts&order=<?php echo $disp; ?>">Attempts</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_queued_at&order=<?php echo $disp; ?>">
Queued <?php if ($sort == 'email_queued_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_from&order=<?php echo $disp; ?>">
From <?php if ($sort == 'email_from') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_recipient&order=<?php echo $disp; ?>">
To <?php if ($sort == 'email_recipient') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_subject&order=<?php echo $disp; ?>">
Subject <?php if ($sort == 'email_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_status&order=<?php echo $disp; ?>">
Status <?php if ($sort == 'email_status') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=email_attempts&order=<?php echo $disp; ?>">
Attempts <?php if ($sort == 'email_attempts') { echo $order_icon; } ?>
</a>
</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
+1 -1
View File
@@ -45,7 +45,7 @@ if ($email_status == 0) {
<ol class="breadcrumb d-print-none"> <ol class="breadcrumb d-print-none">
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_users.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a> <a href="admin_user.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a> <a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
@@ -52,7 +52,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>"> <thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=project_template_name&order=<?php echo $disp; ?>">Template</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=project_template_name&order=<?php echo $disp; ?>">
Template <?php if ($sort == 'project_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tickets</th> <th>Tickets</th>
<th>Tasks</th> <th>Tasks</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
+9 -9
View File
@@ -13,14 +13,14 @@ if (isset($_GET['project_template_id'])) {
); );
if (mysqli_num_rows($sql_project_templates) == 0) { if (mysqli_num_rows($sql_project_templates) == 0) {
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='project.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>"; echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='admin_project_template.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
include_once "footer.php"; include_once "footer.php";
exit; exit;
} }
$row = mysqli_fetch_array($sql_project_templates); $row = mysqli_fetch_array($sql_project_templates);
$project_template_name = nullable_htmlentities($row['project_template_name']); $project_template_name = nullable_htmlentities($row['project_template_name']);
$project_template_description = nullable_htmlentities($row['project_template_description']); $project_template_description = nullable_htmlentities($row['project_template_description']);
$project_template_created_at = date("Y-m-d", strtotime($row['project_template_created_at'])); $project_template_created_at = date("Y-m-d", strtotime($row['project_template_created_at']));
@@ -48,10 +48,10 @@ if (isset($_GET['project_template_id'])) {
<!-- Breadcrumbs--> <!-- Breadcrumbs-->
<ol class="breadcrumb d-print-none"> <ol class="breadcrumb d-print-none">
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_users.php">Admin</a> <a href="admin_user.php">Admin</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_project_templates.php">Project Templates</a> <a href="admin_project_template.php">Project Templates</a>
</li> </li>
<li class="breadcrumb-item active">Project Template Details</li> <li class="breadcrumb-item active">Project Template Details</li>
</ol> </ol>
@@ -88,7 +88,7 @@ if (isset($_GET['project_template_id'])) {
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-2"> <div class="col-sm-2">
<div class="btn-group float-right"> <div class="btn-group float-right">
<button type="button" class="btn btn-primary btn-sm" href="#" data-toggle="modal" data-target="#addProjectTemplateTicketTemplateModal"> <button type="button" class="btn btn-primary btn-sm" href="#" data-toggle="modal" data-target="#addProjectTemplateTicketTemplateModal">
@@ -105,7 +105,7 @@ if (isset($_GET['project_template_id'])) {
<?php if ($session_user_role == 3) { ?> <?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project_template=<?php echo $project_template_id; ?>"> <a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project_template=<?php echo $project_template_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive <i class="fas fa-fw fa-archive mr-2"></i>Archive (not yet implemented)
</a> </a>
<?php } ?> <?php } ?>
<?php if ($session_user_role == 3) { ?> <?php if ($session_user_role == 3) { ?>
@@ -123,7 +123,7 @@ if (isset($_GET['project_template_id'])) {
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<!-- Tickets card --> <!-- Tickets card -->
<?php if (mysqli_num_rows($sql_ticket_templates) > 0) { ?> <?php if (mysqli_num_rows($sql_ticket_templates) > 0) { ?>
<div class="card card-body card-outline card-dark mb-3"> <div class="card card-body card-outline card-dark mb-3">
@@ -165,7 +165,7 @@ if (isset($_GET['project_template_id'])) {
</td> </td>
<td> <td>
<a href="admin_ticket_template_details.php?ticket_template_id=<?php echo $ticket_template_id; ?>"> <a href="admin_ticket_template_details.php?ticket_template_id=<?php echo $ticket_template_id; ?>">
<?php echo $ticket_template_name; ?> <?php echo $ticket_template_name; ?>
</a> </a>
</td> </td>
<td><?php echo $ticket_template_description; ?></td> <td><?php echo $ticket_template_description; ?></td>
@@ -192,7 +192,7 @@ if (isset($_GET['project_template_id'])) {
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<!-- Task Templates Card --> <!-- Task Templates Card -->
<?php if (mysqli_num_rows($sql_task_templates) > 0) { ?> <?php if (mysqli_num_rows($sql_task_templates) > 0) { ?>
<div class="card card-body card-outline card-dark"> <div class="card card-body card-outline card-dark">
@@ -21,7 +21,7 @@
<option value="">- Select a Ticket Template -</option> <option value="">- Select a Ticket Template -</option>
<?php <?php
$sql_ticket_templates_select = mysqli_query($mysqli, "SELECT * FROM ticket_templates $sql_ticket_templates_select = mysqli_query($mysqli, "SELECT ticket_template_id, ticket_template_name FROM ticket_templates
WHERE ticket_template_id NOT IN ( WHERE ticket_template_id NOT IN (
SELECT ticket_template_id FROM project_template_ticket_templates SELECT ticket_template_id FROM project_template_ticket_templates
WHERE project_template_id = $project_template_id WHERE project_template_id = $project_template_id
@@ -31,9 +31,9 @@
); );
while ($row = mysqli_fetch_array($sql_ticket_templates_select)) { while ($row = mysqli_fetch_array($sql_ticket_templates_select)) {
$ticket_template_id_select = intval($row['ticket_template_id']); $ticket_template_id_select = intval($row['ticket_template_id']);
$ticket_template_subject_select = nullable_htmlentities($row['ticket_template_subject']); $ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']);
?> ?>
<option value="<?php echo $ticket_template_id_select; ?>"><?php echo $ticket_template_subject_select; ?></option> <option value="<?php echo $ticket_template_id_select; ?>"><?php echo $ticket_template_name_select; ?></option>
<?php <?php
} }
+21 -8
View File
@@ -21,7 +21,7 @@ $sql = mysqli_query(
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?> ?>
<div class="alert alert-danger"><strong>Roles are not yet active/enforced - do not use.</strong><hr></div> <div class="alert alert-warning"><strong>Roles are still in development. Permissions may not be fully enforced.</strong><hr></div>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-2"> <div class="card-header py-2">
@@ -52,11 +52,24 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_description&order=<?php echo $disp; ?>">Description</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">Admin</a></th> Name <?php if ($sort == 'user_role_name') { echo $order_icon; } ?>
<th><a class="text-dark">User count</a></th> </a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_description&order=<?php echo $disp; ?>">
Description <?php if ($sort == 'user_role_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">
Admin <?php if ($sort == 'user_role_is_admin') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
User count
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -76,14 +89,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?> ?>
<tr> <tr>
<td class="text-center"> <td>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>"> <a class="text-dark" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
<div class="text-secondary"><?php echo $role_name; ?></div> <div class="text-secondary"><?php echo $role_name; ?></div>
</a> </a>
</td> </td>
<td><?php echo $role_description; ?></td> <td><?php echo $role_description; ?></td>
<td><?php echo $role_admin ? 'Yes' : 'No' ; ?></td> <td><?php echo $role_admin ? 'Yes' : 'No' ; ?></td>
<td><?php echo $role_user_count ?></td> <td class="text-center"><?php echo $role_user_count ?></td>
<td> <td>
<?php if ($role_id !== 3) { ?> <?php if ($role_id !== 3) { ?>
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">
@@ -110,7 +110,7 @@ require_once "inc_all_admin.php";
<option value="0">- None -</option> <option value="0">- None -</option>
<?php <?php
$sql = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC"); $sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$account_id = intval($row['account_id']); $account_id = intval($row['account_id']);
$account_name = nullable_htmlentities($row['account_name']); ?> $account_name = nullable_htmlentities($row['account_name']); ?>
@@ -230,12 +230,12 @@ require_once "inc_all_admin.php";
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$phone_mask = intval($row['config_phone_mask']); $phone_mask = intval($row['config_phone_mask']);
} ?> } ?>
<option <?php if ($phone_mask == 1) { <option <?php if ($phone_mask == 1) { echo "selected"; }?> value=1>
echo "selected"; Enable - e.g. (412) 888-9999
}?> value=1>Enable</option> </option>
<option <?php if ($phone_mask == 0) { <option <?php if ($phone_mask == 0) { echo "selected"; }?> value=0>
echo "selected"; Disabled - e.g. 4128889999
}?> value=0>Disabled</option> </option>
</select> </select>
</div> </div>
</div> </div>
@@ -57,6 +57,16 @@ require_once "inc_all_admin.php";
<small class="text-secondary">We recommend updating the invoice footer to include policies on your late charges. This will be applied every 30 days after the invoice Due Date.</small> <small class="text-secondary">We recommend updating the invoice footer to include policies on your late charges. This will be applied every 30 days after the invoice Due Date.</small>
</div> </div>
<div class="form-group">
<label>Email address to notify when invoices are paid online <small class="text-secondary">(Ideally a distribution list/shared mailbox)</small></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-bell"></i></span>
</div>
<input type="email" class="form-control" name="config_invoice_paid_notification_email" placeholder="Address to notify for paid invoices, leave bank for none" value="<?php echo nullable_htmlentities($config_invoice_paid_notification_email); ?>">
</div>
</div>
<hr> <hr>
<h4>Recurring Invoice</h4> <h4>Recurring Invoice</h4>
@@ -32,7 +32,7 @@ require_once "inc_all_admin.php";
</div> </div>
<input type="text" class="form-control" name="config_cron_key" placeholder="Generate a CRON Key" value="<?php echo nullable_htmlentities($config_cron_key); ?>" readonly> <input type="text" class="form-control" name="config_cron_key" placeholder="Generate a CRON Key" value="<?php echo nullable_htmlentities($config_cron_key); ?>" readonly>
<div class="input-group-append"> <div class="input-group-append">
<a href="post.php?generate_cron_key" class="btn btn-secondary confirm-link"><i class="fas fa-fw fa-sync mr-2"></i>Generate</a> <a href="post.php?generate_cron_key" class="btn btn-secondary confirm-link"><i class="fas fa-fw fa-sync mr-2"></i>Regenerate</a>
</div> </div>
</div> </div>
</div> </div>
@@ -48,11 +48,14 @@ require_once "inc_all_admin.php";
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th colspan=5>Expirations</th>
</tr>
<tr> <tr>
<th> <th>
<div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div> <div><i class="fas fa-fw fa-globe mr-2"></i>Domain Expiration Notice</div>
<small class="text-muted"> <small class="text-muted">
(This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7, 14, 30, 90, and 120 days prior to expiry.) (This setting triggers a notification when a domain is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
</small> </small>
</th> </th>
<td> <td>
@@ -65,6 +68,35 @@ require_once "inc_all_admin.php";
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr>
<th>
<div><i class="fas fa-fw fa-lock mr-2"></i>Certificate Expiration Notice</div>
<small class="text-muted">
(This setting triggers a notification when a certificate is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
</small>
</th>
<td>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th>
<div><i class="fas fa-fw fa-desktop mr-2"></i>Asset Warranty Expiration Notice</div>
<small class="text-muted">
(This setting triggers a notification when an asset is approaching its expiration date, specifically at 1, 7, 14, 30 and 90 days prior to expiry.)
</small>
</th>
<td>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th colspan=5>Billing</th>
</tr>
<tr> <tr>
<th> <th>
<div><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoice Reminders</div> <div><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoice Reminders</div>
@@ -103,6 +135,9 @@ require_once "inc_all_admin.php";
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<th colspan=5>Operational</th>
</tr>
<tr> <tr>
<th> <th>
<div><i class="fas fa-fw fa-bell mr-2"></i>Send clients general notification emails</div> <div><i class="fas fa-fw fa-bell mr-2"></i>Send clients general notification emails</div>
@@ -118,6 +153,39 @@ require_once "inc_all_admin.php";
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<th>
<div><i class="fas fa-fw fa-link mr-2"></i>Shared Item View</div>
<small class="text-secondary">(Notify when Shared items are viewed)</small>
</th>
<td></td>
<td></td>
<td>
</td>
<td></td>
</tr>
<tr>
<th>
<div><i class="fas fa-fw fa-clock mr-2"></i>Cron Execution</div>
<small class="text-secondary">(Notify when the nightly cron job ran)</small>
</th>
<td></td>
<td></td>
<td>
</td>
<td></td>
</tr>
<tr>
<th>
<div><i class="fas fa-fw fa-download mr-2"></i>ITFlow Updates</div>
<small class="text-secondary">(Notify when ITFlow has an update)</small>
</th>
<td></td>
<td></td>
<td>
</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
@@ -12,6 +12,9 @@ require_once "inc_all_admin.php";
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<div class="alert alert-secondary">Currently, we only integrate with Stripe. Please see <a href="https://forum.itflow.org/d/439-payment-integrations-megathread" target="_blank">this forum post</a>.</div>
<br>
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" name="config_stripe_enable" <?php if ($config_stripe_enable == 1) { echo "checked"; } ?> value="1" id="enableStripeSwitch"> <input type="checkbox" class="custom-control-input" name="config_stripe_enable" <?php if ($config_stripe_enable == 1) { echo "checked"; } ?> value="1" id="enableStripeSwitch">
@@ -50,7 +53,7 @@ require_once "inc_all_admin.php";
<select class="form-control select2" name="config_stripe_account"> <select class="form-control select2" name="config_stripe_account">
<option value="">- Account -</option> <option value="">- Account -</option>
<?php <?php
$sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC"); $sql_accounts = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
while ($row = mysqli_fetch_array($sql_accounts)) { while ($row = mysqli_fetch_array($sql_accounts)) {
$account_id = intval($row['account_id']); $account_id = intval($row['account_id']);
$account_name = nullable_htmlentities($row['account_name']); $account_name = nullable_htmlentities($row['account_name']);
+115 -137
View File
@@ -15,13 +15,18 @@
<nav> <nav>
<ul class="nav nav-pills nav-sidebar flex-column mt-2" data-widget="treeview" data-accordion="false"> <ul class="nav nav-pills nav-sidebar flex-column mt-2" data-widget="treeview" data-accordion="false">
<!-- ACCESS Section --> <!-- ACCESS Section -->
<li class="nav-header">ACCESS</li>
<li class="nav-item"> <li class="nav-item">
<a href="admin_users.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_users.php") {echo "active";} ?>"> <a href="admin_user.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_user.php") {echo "active";} ?>">
<i class="nav-icon fas fa-users"></i> <i class="nav-icon fas fa-users"></i>
<p>Users</p> <p>Users</p>
</a> </a>
</li> </li>
<li class="nav-item">
<a href="admin_role.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_role.php") {echo "active";} ?>">
<i class="nav-icon fas fa-user-shield"></i>
<p>Roles</p>
</a>
</li>
<li class="nav-item"> <li class="nav-item">
<a href="admin_api.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_api.php") {echo "active";} ?>"> <a href="admin_api.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_api.php") {echo "active";} ?>">
<i class="nav-icon fas fa-key"></i> <i class="nav-icon fas fa-key"></i>
@@ -34,135 +39,108 @@
<p>Bulk Mail</p> <p>Bulk Mail</p>
</a> </a>
</li> </li>
<!-- TAGS & CATEGORIES Section --> <li class="nav-header">TAGS & CATEGORIES</li>
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_tags.php', 'admin_categories.php', 'admin_taxes.php', 'admin_account_types.php', 'admin_ticket_statuses.php', 'admin_custom_links.php']) ? 'menu-open' : ''); ?>">
<a href="#" class="nav-link"> <li class="nav-item">
<p> <a href="admin_tag.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_tag.php' ? 'active' : ''); ?>">
TAGS & CATEGORIES <i class="nav-icon fas fa-tags"></i>
<i class="right fas fa-angle-left"></i> <p>Tags</p>
</p> </a>
</li>
<li class="nav-item">
<a href="admin_category.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_category.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-list-ul"></i>
<p>Categories</p>
</a>
</li>
<li class="nav-item">
<a href="admin_tax.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_tax.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-balance-scale"></i>
<p>Taxes</p>
</a>
</li>
<li class="nav-item">
<a href="admin_ticket_status.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_ticket_status.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-info-circle"></i>
<p>Ticket Statuses</p>
</a>
</li>
<li class="nav-item">
<a href="admin_custom_link.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_custom_link.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-external-link-alt"></i>
<p>Custom Links</p>
</a> </a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="admin_tags.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_tags.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-tags"></i>
<p>Tags</p>
</a>
</li>
<li class="nav-item">
<a href="admin_categories.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_categories.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-list-ul"></i>
<p>Categories</p>
</a>
</li>
<li class="nav-item">
<a href="admin_taxes.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_taxes.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-balance-scale"></i>
<p>Taxes</p>
</a>
</li>
<li class="nav-item">
<a href="admin_ticket_statuses.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_ticket_statuses.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-info-circle"></i>
<p>Ticket Statuses</p>
</a>
</li>
<li class="nav-item">
<a href="admin_custom_links.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_custom_links.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-external-link-alt"></i>
<p>Custom Links</p>
</a>
</li>
</ul>
</li> </li>
<!-- TEMPLATES Section --> <li class="nav-header">TEMPLATES</li>
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_project_templates.php', 'admin_project_template_details.php', 'admin_ticket_templates.php', 'admin_ticket_template_details.php', 'admin_vendor_templates.php', 'admin_software_templates.php', 'admin_document_templates.php', 'admin_document_template_details.php']) ? 'menu-open' : ''); ?>">
<a href="#" class="nav-link"> <li class="nav-item">
<p> <a href="admin_project_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_project_template.php', 'admin_project_template_details.php']) ? 'active' : ''); ?>">
TEMPLATES <i class="nav-icon fas fa-project-diagram"></i>
<i class="right fas fa-angle-left"></i> <p>Project Templates</p>
</p> </a>
</li>
<li class="nav-item">
<a href="admin_ticket_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_ticket_template.php', 'admin_ticket_template_details.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-life-ring"></i>
<p>Ticket Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_vendor_template.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_vendor_template.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-building"></i>
<p>Vendor Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_software_template.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_software_template.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-rocket"></i>
<p>License Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_document_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_document_template.php', 'admin_document_template_details.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-file"></i>
<p>Document Templates</p>
</a> </a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="admin_project_templates.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_project_templates.php', 'admin_project_template_details.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-project-diagram"></i>
<p>Project Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_ticket_templates.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_ticket_templates.php', 'admin_ticket_template_details.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-life-ring"></i>
<p>Ticket Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_vendor_templates.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_vendor_templates.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-building"></i>
<p>Vendor Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_software_templates.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_software_templates.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-rocket"></i>
<p>License Templates</p>
</a>
</li>
<li class="nav-item">
<a href="admin_document_templates.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_document_templates.php', 'admin_document_template_details.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-file"></i>
<p>Document Templates</p>
</a>
</li>
</ul>
</li> </li>
<!-- MAINTENANCE Section --> <li class="nav-header">MAINTENANCE</li>
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_mail_queue.php', 'admin_mail_queue_message_view.php', 'admin_logs.php', 'admin_backup.php', 'admin_debug.php', 'admin_update.php']) ? 'menu-open' : ''); ?>">
<a href="#" class="nav-link"> <li class="nav-item">
<p> <a href="admin_mail_queue.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_mail_queue.php', 'admin_mail_queue_message_view.php']) ? 'active' : ''); ?>">
MAINTENANCE <i class="nav-icon fas fa-mail-bulk"></i>
<i class="right fas fa-angle-left"></i> <p>Mail Queue</p>
</p> </a>
</li>
<li class="nav-item">
<a href="admin_audit_log.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_audit_log.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-history"></i>
<p>Audit Logs</p>
</a>
</li>
<li class="nav-item">
<a href="admin_backup.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_backup.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-cloud-upload-alt"></i>
<p>Backup</p>
</a>
</li>
<li class="nav-item">
<a href="admin_debug.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_debug.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-bug"></i>
<p>Debug</p>
</a>
</li>
<li class="nav-item">
<a href="admin_update.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_update.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-download"></i>
<p>Update</p>
</a> </a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="admin_mail_queue.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_mail_queue.php', 'admin_mail_queue_message_view.php']) ? 'active' : ''); ?>">
<i class="nav-icon fas fa-mail-bulk"></i>
<p>Mail Queue</p>
</a>
</li>
<li class="nav-item">
<a href="admin_logs.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_logs.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-history"></i>
<p>Audit Logs</p>
</a>
</li>
<li class="nav-item">
<a href="admin_backup.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_backup.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-cloud-upload-alt"></i>
<p>Backup</p>
</a>
</li>
<li class="nav-item">
<a href="admin_debug.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_debug.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-bug"></i>
<p>Debug</p>
</a>
</li>
<li class="nav-item">
<a href="admin_update.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_update.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-download"></i>
<p>Update</p>
</a>
</li>
</ul>
</li> </li>
<!-- SETTINGS Section --> <!-- SETTINGS Section -->
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['settings_company.php', 'settings_localization.php', 'settings_theme.php', 'settings_security.php', 'settings_mail.php', 'settings_notifications.php', 'settings_defaults.php', 'settings_invoice.php', 'settings_quote.php', 'settings_online_payment.php', 'settings_project.php', 'settings_ticket.php', 'settings_ai.php', 'settings_integrations.php', 'settings_telemetry.php', 'settings_modules.php']) ? 'menu-open' : ''); ?>"> <li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_settings_company.php', 'admin_settings_localization.php', 'admin_settings_theme.php', 'admin_settings_security.php', 'admin_settings_mail.php', 'admin_settings_notification.php', 'admin_settings_default.php', 'admin_settings_invoice.php', 'admin_settings_quote.php', 'admin_settings_online_payment.php', 'admin_settings_project.php', 'admin_settings_ticket.php', 'admin_settings_ai.php', 'admin_settings_integration.php', 'admin_settings_telemetry.php', 'admin_settings_module.php']) ? 'menu-open' : ''); ?>">
<a href="#" class="nav-link"> <a href="#" class="nav-link">
<p> <p>
SETTINGS SETTINGS
@@ -171,97 +149,97 @@
</a> </a>
<ul class="nav nav-treeview"> <ul class="nav nav-treeview">
<li class="nav-item"> <li class="nav-item">
<a href="settings_company.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_company.php' ? 'active' : ''); ?>"> <a href="admin_settings_company.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_company.php' ? 'active' : ''); ?>">
<i class="nav-icon fa fa-briefcase"></i> <i class="nav-icon fa fa-briefcase"></i>
<p>Company Details</p> <p>Company Details</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_localization.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_localization.php' ? 'active' : ''); ?>"> <a href="admin_settings_localization.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_localization.php' ? 'active' : ''); ?>">
<i class="nav-icon fa fa-globe"></i> <i class="nav-icon fa fa-globe"></i>
<p>Localization</p> <p>Localization</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_theme.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_theme.php' ? 'active' : ''); ?>"> <a href="admin_settings_theme.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_theme.php' ? 'active' : ''); ?>">
<i class="nav-icon fa fa-paint-brush"></i> <i class="nav-icon fa fa-paint-brush"></i>
<p>Theme</p> <p>Theme</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_security.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_security.php' ? 'active' : ''); ?>"> <a href="admin_settings_security.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_security.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-shield-alt"></i> <i class="nav-icon fas fa-shield-alt"></i>
<p>Security</p> <p>Security</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_mail.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_mail.php' ? 'active' : ''); ?>"> <a href="admin_settings_mail.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_mail.php' ? 'active' : ''); ?>">
<i class="nav-icon far fa-envelope"></i> <i class="nav-icon far fa-envelope"></i>
<p>Mail</p> <p>Mail</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_notifications.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_notifications.php' ? 'active' : ''); ?>"> <a href="admin_settings_notification.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_notification.php' ? 'active' : ''); ?>">
<i class="nav-icon far fa-bell"></i> <i class="nav-icon far fa-bell"></i>
<p>Notifications</p> <p>Notifications</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_defaults.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_defaults.php' ? 'active' : ''); ?>"> <a href="admin_settings_default.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_default.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-cogs"></i> <i class="nav-icon fas fa-cogs"></i>
<p>Defaults</p> <p>Defaults</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_invoice.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_invoice.php' ? 'active' : ''); ?>"> <a href="admin_settings_invoice.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_invoice.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-file-invoice"></i> <i class="nav-icon fas fa-file-invoice"></i>
<p>Invoice</p> <p>Invoice</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_quote.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_quote.php' ? 'active' : ''); ?>"> <a href="admin_settings_quote.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_quote.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-comment-dollar"></i> <i class="nav-icon fas fa-comment-dollar"></i>
<p>Quote</p> <p>Quote</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_online_payment.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_online_payment.php' ? 'active' : ''); ?>"> <a href="admin_settings_online_payment.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_online_payment.php' ? 'active' : ''); ?>">
<i class="nav-icon far fa-credit-card"></i> <i class="nav-icon far fa-credit-card"></i>
<p>Online Payment</p> <p>Online Payment</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_project.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_project.php' ? 'active' : ''); ?>"> <a href="admin_settings_project.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_project.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-project-diagram"></i> <i class="nav-icon fas fa-project-diagram"></i>
<p>Project</p> <p>Project</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_ticket.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_ticket.php' ? 'active' : ''); ?>"> <a href="admin_settings_ticket.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_ticket.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-life-ring"></i> <i class="nav-icon fas fa-life-ring"></i>
<p>Ticket</p> <p>Ticket</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_ai.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_ai.php' ? 'active' : ''); ?>"> <a href="admin_settings_ai.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_ai.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-robot"></i> <i class="nav-icon fas fa-robot"></i>
<p>AI</p> <p>AI</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_integrations.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_integrations.php' ? 'active' : ''); ?>"> <a href="admin_settings_integration.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_integration.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-plug"></i> <i class="nav-icon fas fa-plug"></i>
<p>Integrations</p> <p>Integrations</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_telemetry.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_telemetry.php' ? 'active' : ''); ?>"> <a href="admin_settings_telemetry.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_telemetry.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-satellite-dish"></i> <i class="nav-icon fas fa-satellite-dish"></i>
<p>Telemetry</p> <p>Telemetry</p>
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="settings_modules.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'settings_modules.php' ? 'active' : ''); ?>"> <a href="admin_settings_module.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_settings_module.php' ? 'active' : ''); ?>">
<i class="nav-icon fas fa-cube"></i> <i class="nav-icon fas fa-cube"></i>
<p>Modules</p> <p>Modules</p>
</a> </a>
@@ -52,9 +52,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>"> <thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_name&order=<?php echo $disp; ?>">Template</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_type&order=<?php echo $disp; ?>">Type</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_name&order=<?php echo $disp; ?>">
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_license_type&order=<?php echo $disp; ?>">License Type</a></th> Template <?php if ($sort == 'software_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_type&order=<?php echo $disp; ?>">
Type <?php if ($sort == 'software_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_license_type&order=<?php echo $disp; ?>">
License Type <?php if ($sort == 'software_license_type') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
+12 -2
View File
@@ -50,8 +50,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tag_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tag_type&order=<?php echo $disp; ?>">Type</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tag_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'tag_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tag_type&order=<?php echo $disp; ?>">
Type <?php if ($sort == 'tag_type') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -68,6 +76,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$tag_type_display = "Location Tag"; $tag_type_display = "Location Tag";
} elseif ( $tag_type == 3) { } elseif ( $tag_type == 3) {
$tag_type_display = "Contact Tag"; $tag_type_display = "Contact Tag";
} elseif ( $tag_type == 4) {
$tag_type_display = "Credential Tag";
} else { } else {
$tag_type_display = "Unknown Tag"; $tag_type_display = "Unknown Tag";
} }
+1
View File
@@ -32,6 +32,7 @@
<option value="1">Client Tag</option> <option value="1">Client Tag</option>
<option value="2">Location Tag</option> <option value="2">Location Tag</option>
<option value="3">Contact Tag</option> <option value="3">Contact Tag</option>
<option value="4">Credential Tag</option>
</select> </select>
</div> </div>
</div> </div>
+1
View File
@@ -32,6 +32,7 @@
<option value="1" <?php if ($tag_type == 1) { echo "selected"; } ?>>Client Tag</option> <option value="1" <?php if ($tag_type == 1) { echo "selected"; } ?>>Client Tag</option>
<option value="2" <?php if ($tag_type == 2) { echo "selected"; } ?>>Location Tag</option> <option value="2" <?php if ($tag_type == 2) { echo "selected"; } ?>>Location Tag</option>
<option value="3" <?php if ($tag_type == 3) { echo "selected"; } ?>>Contact Tag</option> <option value="3" <?php if ($tag_type == 3) { echo "selected"; } ?>>Contact Tag</option>
<option value="4" <?php if ($tag_type == 4) { echo "selected"; } ?>>Credential Tag</option>
</select> </select>
</div> </div>
</div> </div>
+10 -2
View File
@@ -33,8 +33,16 @@ $num_rows = mysqli_num_rows($sql);
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tax_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tax_percent&order=<?php echo $disp; ?>">Percent</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tax_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'tax_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=tax_percent&order=<?php echo $disp; ?>">
Percent <?php if ($sort == 'tax_percent') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -50,9 +50,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_color&order=<?php echo $disp; ?>">Color</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_name&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_arctive&order=<?php echo $disp; ?>">Status</a></th> Name <?php if ($sort == 'ticket_status_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_color&order=<?php echo $disp; ?>">
Color <?php if ($sort == 'ticket_status_color') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_status_active&order=<?php echo $disp; ?>">
Status <?php if ($sort == 'ticket_status_active') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
+1 -1
View File
@@ -39,4 +39,4 @@
</form> </form>
</div> </div>
</div> </div>
</div> </div>
+1 -1
View File
@@ -52,4 +52,4 @@
</form> </form>
</div> </div>
</div> </div>
</div> </div>
@@ -52,7 +52,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>"> <thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_template_name&order=<?php echo $disp; ?>">Template</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=ticket_template_name&order=<?php echo $disp; ?>">
Template <?php if ($sort == 'ticket_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tasks</th> <th>Tasks</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
@@ -70,7 +74,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?> ?>
<tr> <tr>
<td> <td>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editTicketTemplateModal<?php echo $ticket_template_id; ?>"> <a class="text-dark">
<div class="media"> <div class="media">
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i> <i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
<div class="media-body"> <div class="media-body">
@@ -91,18 +95,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<i class="fas fa-ellipsis-h"></i> <i class="fas fa-ellipsis-h"></i>
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<?php if($session_user_role == 3) { ?> <a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_template=<?php echo $ticket_template_id; ?>">
<div class="dropdown-divider"></div> <i class="fas fa-fw fa-trash mr-2"></i>Delete
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_template=<?php echo $ticket_template_id; ?>"> </a>
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div> </div>
</div> </div>
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
@@ -114,6 +115,5 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php <?php
require_once "admin_ticket_template_add_modal.php"; require_once "admin_ticket_template_add_modal.php";
require_once "footer.php"; require_once "footer.php";
+62 -111
View File
@@ -9,121 +9,72 @@
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<ul class="nav nav-pills nav-justified mb-3">
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#pills-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-ticket"><i class="fa fa-fw fa-life-ring mr-2"></i>Template</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-tasks"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-project-template"><i class="fa fa-fw fa-project-diagram mr-2"></i>Project Template</a>
</li>
</ul>
<hr> <div class="form-group">
<label>Template Name <strong class="text-danger">*</strong></label>
<div class="tab-content"> <div class="input-group">
<div class="input-group-prepend">
<div class="tab-pane fade show active" id="pills-details"> <span class="input-group-text"><i class="fa fa-fw fa-life-ring"></i></span>
<div class="form-group">
<label>Template Name <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-life-ring"></i></span>
</div>
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
</div>
</div> </div>
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
<div class="form-group"> </div>
<label>Description</label> </div>
<div class="input-group">
<div class="input-group-prepend"> <div class="form-group">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span> <label>Subject</label>
</div> <div class="input-group">
<input type="text" class="form-control" name="description" placeholder="Short description"> <div class="input-group-prepend">
</div> <span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div> </div>
<input type="text" class="form-control" name="subject" placeholder="Subject">
</div>
</div>
<?php if($config_ai_enable) { ?>
<div class="form-group">
<textarea class="form-control tinymceai" id="textInput" name="details"></textarea>
</div>
<div class="mb-3">
<button id="rewordButton" class="btn btn-primary" type="button"><i class="fas fa-fw fa-robot mr-2"></i>Reword</button>
<button id="undoButton" class="btn btn-secondary" type="button" style="display:none;"><i class="fas fa-fw fa-redo-alt mr-2"></i>Undo</button>
</div>
<?php } else { ?>
<div class="form-group">
<textarea class="form-control tinymce" rows="5" name="details"></textarea>
</div>
<?php } ?>
<div class="form-group">
<label>Description</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="description" placeholder="Short description">
</div>
</div>
<div class="form-group">
<label>Add it to a Project Template?</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
</div>
<select class="form-control select2" name="project_template">
<option value="0">- No -</option>
<?php
$sql_project_templates = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
while ($row = mysqli_fetch_array($sql_project_templates)) {
$project_template_id_select = intval($row['project_template_id']);
$project_template_name_select = nullable_htmlentities($row['project_template_name']); ?>
<option value="<?php echo $project_template_id_select; ?>"><?php echo $project_template_name_select; ?></option>
<?php } ?>
</select>
</div> </div>
<div class="tab-pane fade" id="pills-ticket">
<div class="form-group">
<label>Subject</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="subject" placeholder="Subject">
</div>
</div>
<?php if($config_ai_enable) { ?>
<div class="form-group">
<textarea class="form-control tinymceai" id="textInput" name="details"></textarea>
</div>
<div class="mb-3">
<button id="rewordButton" class="btn btn-primary" type="button"><i class="fas fa-fw fa-robot mr-2"></i>Reword</button>
<button id="undoButton" class="btn btn-secondary" type="button" style="display:none;"><i class="fas fa-fw fa-redo-alt mr-2"></i>Undo</button>
</div>
<?php } else { ?>
<div class="form-group">
<textarea class="form-control tinymce" rows="5" name="details"></textarea>
</div>
<?php } ?>
</div>
<div class="tab-pane fade" id="pills-tasks">
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
</div>
<input type="text" class="form-control" name="tasks[]" placeholder="Enter Task Name">
<div class="input-group-append">
<button type="button" class="btn btn-primary"><i class="fas fa-fw fa-check mr-2"></i>Add</button>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-project-template">
<div class="form-group">
<label>Project Template</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
</div>
<select class="form-control select2" name="project_template">
<option value="0">- None -</option>
<?php
$sql_project_templates = mysqli_query($mysqli, "SELECT * FROM project_templates WHERE project_template_archived_at IS NULL ORDER BY project_template_name ASC");
while ($row = mysqli_fetch_array($sql_project_templates)) {
$project_template_id_select = intval($row['project_template_id']);
$project_template_name_select = nullable_htmlentities($row['project_template_name']); ?>
<option value="<?php echo $project_template_id_select; ?>"><?php echo $project_template_name_select; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="modal-footer bg-white"> <div class="modal-footer bg-white">
<button type="submit" name="add_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button> <button type="submit" name="add_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create</button>
+24 -13
View File
@@ -35,10 +35,10 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
<a href="clients.php">Home</a> <a href="clients.php">Home</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_users.php">Admin</a> <a href="admin_user.php">Admin</a>
</li> </li>
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="admin_ticket_templates.php">Ticket Templates</a> <a href="admin_ticket_template.php">Ticket Templates</a>
</li> </li>
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li> <li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
</ol> </ol>
@@ -58,12 +58,12 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
</div> </div>
</h3> </h3>
<div class="card-tools"> <div class="card-tools">
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal<?php echo $template_id; ?>"> <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal">
<i class="fas fa-edit"></i> <i class="fas fa-edit"></i>
</button> </button>
</div> </div>
</div> </div>
<h5><?php echo $ticket_subject; ?></h5> <h5><?php echo $ticket_template_subject; ?></h5>
<div class="card-body prettyContent"> <div class="card-body prettyContent">
<?php echo $ticket_template_details; ?> <?php echo $ticket_template_details; ?>
</div> </div>
@@ -85,9 +85,9 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
</div> </div>
<input type="text" class="form-control" name="task_name" placeholder="Task name"> <input type="text" class="form-control" name="task_name" placeholder="Create a task" required>
<div class="input-group-append"> <div class="input-group-append">
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check mr-2"></i>Create</button> <button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
</div> </div>
</div> </div>
</div> </div>
@@ -98,18 +98,29 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
$task_id = intval($row['task_template_id']); $task_id = intval($row['task_template_id']);
$task_name = nullable_htmlentities($row['task_template_name']); $task_name = nullable_htmlentities($row['task_template_name']);
$task_order = intval($row['task_template_order']); $task_order = intval($row['task_template_order']);
$task_completion_estimate = intval($row['task_template_completion_estimate']);
$task_description = nullable_htmlentities($row['task_template_description']); $task_description = nullable_htmlentities($row['task_template_description']);
?> ?>
<tr> <tr>
<td><i class="far fa-fw fa-square text-secondary"></i></td> <td><i class="far fa-fw fa-square text-secondary"></i></td>
<td><?php echo $task_name; ?></td> <td><span class="text-secondary"><?php echo $task_completion_estimate; ?>m</span> - <?php echo $task_name; ?></td>
<td class="text-right"> <td class="text-right">
<button type="button" class="btn btn-link btn-sm text-secondary" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>"> <div class="float-right">
<i class="fa fa-fw fa-pencil-alt"></i> <div class="dropdown dropleft text-center">
</button> <button class="btn btn-link text-secondary btn-sm" type="button" data-toggle="dropdown">
<a href="post.php?delete_task_template=<?php echo $task_id; ?>" class="btn btn-link btn-sm text-danger"> <i class="fas fa-fw fa-ellipsis-v"></i>
<i class="fa fa-fw fa-trash-alt"></i> </button>
</a> <div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
</a>
</div>
</div>
</div>
</td> </td>
</tr> </tr>
<?php <?php
+43 -64
View File
@@ -1,4 +1,5 @@
<div class="modal" id="editTicketTemplateModal" tabindex="-1"> <div class="modal" id="editTicketTemplateModal" tabindex="-1">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content bg-dark"> <div class="modal-content bg-dark">
<div class="modal-header"> <div class="modal-header">
@@ -10,74 +11,52 @@
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>"> <input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<ul class="nav nav-pills nav-justified mb-3">
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#pills-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-ticket"><i class="fa fa-fw fa-life-ring mr-2"></i>Template</a>
</li>
</ul>
<hr> <div class="form-group">
<label>Template Name <strong class="text-danger">*</strong></label>
<div class="tab-content"> <div class="input-group">
<div class="input-group-prepend">
<div class="tab-pane fade show active" id="pills-details"> <span class="input-group-text"><i class="fa fa-fw fa-life-ring"></i></span>
<div class="form-group">
<label>Template Name <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-life-ring"></i></span>
</div>
<input type="text" class="form-control" name="name" value="<?php echo $ticket_template_name; ?>" placeholder="Template name" required autofocus>
</div>
</div> </div>
<input type="text" class="form-control" name="name" value="<?php echo $ticket_template_name; ?>" placeholder="Template name" required autofocus>
<div class="form-group">
<label>Description</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="description" value="<?php echo $ticket_template_description; ?>" placeholder="Short description">
</div>
</div>
</div> </div>
<div class="tab-pane fade" id="pills-ticket">
<div class="form-group">
<label>Subject</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="subject" value="<?php echo $ticket_template_subject; ?>" placeholder="Subject">
</div>
</div>
<?php if($config_ai_enable) { ?>
<div class="form-group">
<textarea class="form-control tinymceai" id="textInput" name="details"><?php echo $ticket_template_details; ?></textarea>
</div>
<div class="mb-3">
<button id="rewordButton" class="btn btn-primary" type="button"><i class="fas fa-fw fa-robot mr-2"></i>Reword</button>
<button id="undoButton" class="btn btn-secondary" type="button" style="display:none;"><i class="fas fa-fw fa-redo-alt mr-2"></i>Undo</button>
</div>
<?php } else { ?>
<div class="form-group">
<textarea class="form-control tinymce" rows="5" name="details"><?php echo $ticket_template_details; ?></textarea>
</div>
<?php } ?>
</div>
</div> </div>
<div class="form-group">
<label>Subject</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="subject" value="<?php echo $ticket_template_subject; ?>" placeholder="Subject">
</div>
</div>
<?php if($config_ai_enable) { ?>
<div class="form-group">
<textarea class="form-control tinymceai" id="textInput" name="details"><?php echo $ticket_template_details; ?></textarea>
</div>
<div class="mb-3">
<button id="rewordButton" class="btn btn-primary" type="button"><i class="fas fa-fw fa-robot mr-2"></i>Reword</button>
<button id="undoButton" class="btn btn-secondary" type="button" style="display:none;"><i class="fas fa-fw fa-redo-alt mr-2"></i>Undo</button>
</div>
<?php } else { ?>
<div class="form-group">
<textarea class="form-control tinymce" rows="5" name="details"><?php echo $ticket_template_details; ?></textarea>
</div>
<?php } ?>
<div class="form-group">
<label>Description</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="description" value="<?php echo $ticket_template_description; ?>" placeholder="Short description">
</div>
</div>
</div> </div>
<div class="modal-footer bg-white"> <div class="modal-footer bg-white">
<button type="submit" name="edit_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button> <button type="submit" name="edit_ticket_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
+18 -15
View File
@@ -32,24 +32,27 @@ $git_log = shell_exec("git log $repo_branch..origin/$repo_branch --pretty=format
</div> </div>
<?php } ?> <?php } ?>
<?php if (!empty($git_log)) { ?> <?php if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?>
<a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update App</h5></a> <div class="alert alert-warning">
<a class="btn btn-danger btn-lg" href="post.php?update&force_update=1"><i class="fas fa-fw fa-4x fa-hammer mb-1"></i><h5>FORCE Update App</h5></a> <strong>Ensure you have a current <a href="https://docs.itflow.org/backups">app & database backup</a> before updating!</strong>
</div>
<br>
<a class="btn btn-dark btn-lg my-4" href="post.php?update_db"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update Database</h5></a>
<br>
<small class="text-secondary">Current DB Version: <?php echo CURRENT_DATABASE_VERSION; ?></small>
<br>
<small class="text-secondary">Latest DB Version: <?php echo LATEST_DATABASE_VERSION; ?></small>
<br>
<small class="text-secondary">Branch: <?php echo $repo_branch; ?></small>
<hr> <hr>
<?php } else { <?php } else {
if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { ?> if (!empty($git_log)) { ?>
<div class="alert alert-warning">
<strong>Ensure you have a current <a href="https://docs.itflow.org/backups">app & database backup</a> before updating!</strong> <a class="btn btn-primary btn-lg my-4" href="post.php?update"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update App</h5></a>
</div> <a class="btn btn-danger btn-lg" href="post.php?update&force_update=1"><i class="fas fa-fw fa-4x fa-hammer mb-1"></i><h5>FORCE Update App</h5></a>
<br>
<a class="btn btn-dark btn-lg my-4" href="post.php?update_db"><i class="fas fa-fw fa-4x fa-download mb-1"></i><h5>Update Database</h5></a>
<br>
<small class="text-secondary">Current DB Version: <?php echo CURRENT_DATABASE_VERSION; ?></small>
<br>
<small class="text-secondary">Latest DB Version: <?php echo LATEST_DATABASE_VERSION; ?></small>
<br>
<small class="text-secondary">Branch: <?php echo $repo_branch; ?></small>
<?php } else { ?> <?php } else { ?>
<p class="text-secondary">Current Database Version:<br><strong class="text-dark"><?php echo CURRENT_DATABASE_VERSION; ?></strong></p> <p class="text-secondary">Current Database Version:<br><strong class="text-dark"><?php echo CURRENT_DATABASE_VERSION; ?></strong></p>
<p class="text-secondary">Current App Version:<br><strong class="text-dark"><?php echo $current_version; ?></strong></p> <p class="text-secondary">Current App Version:<br><strong class="text-dark"><?php echo $current_version; ?></strong></p>
+23 -5
View File
@@ -66,12 +66,30 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Name</a></th> <th class="text-center">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_email&order=<?php echo $disp; ?>">Email</a></th> <a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role&order=<?php echo $disp; ?>">Role</a></th> Name <?php if ($sort == 'user_name') { echo $order_icon; } ?>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_status&order=<?php echo $disp; ?>">Status</a></th> </a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_email&order=<?php echo $disp; ?>">
Email <?php if ($sort == 'user_email') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role&order=<?php echo $disp; ?>">
Role <?php if ($sort == 'user_role') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_status&order=<?php echo $disp; ?>">
Status <?php if ($sort == 'user_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">MFA</th> <th class="text-center">MFA</th>
<th>Last Login</th> <th>
Last Login
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -52,8 +52,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>"> <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr> <tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_name&order=<?php echo $disp; ?>">Vendor</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_description&order=<?php echo $disp; ?>">Description</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_name&order=<?php echo $disp; ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=vendor_description&order=<?php echo $disp; ?>">
Description <?php if ($sort == 'vendor_description') { echo $order_icon; } ?>
</a>
</th>
<th>Contact</th> <th>Contact</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
-8
View File
@@ -66,14 +66,6 @@ if (isset($_POST['contact_notes'])) {
$notes = ''; $notes = '';
} }
if (isset($_POST['contact_auth_method'])) {
$auth_method = sanitizeInput($_POST['contact_auth_method']);
} elseif ($contact_row) {
$auth_method = $contact_row['contact_auth_method'];
} else {
$auth_method = '';
}
if (isset($_POST['contact_primary'])) { if (isset($_POST['contact_primary'])) {
$primary = intval($_POST['contact_primary']); $primary = intval($_POST['contact_primary']);
} elseif ($contact_row) { } elseif ($contact_row) {
+1 -1
View File
@@ -20,7 +20,7 @@ if (!empty($name) && !empty($email) && !empty($client_id)) {
if (mysqli_num_rows($email_duplication_sql) == 0) { if (mysqli_num_rows($email_duplication_sql) == 0) {
// Insert contact // Insert contact
$insert_sql = mysqli_query($mysqli, "INSERT INTO contacts SET contact_name = '$name', contact_title = '$title', contact_department = '$department', contact_email = '$email', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_notes = '$notes', contact_auth_method = '$auth_method', contact_primary = '$primary', contact_important = '$important', contact_billing = '$billing', contact_technical = '$technical', contact_location_id = $location_id, contact_client_id = $client_id"); $insert_sql = mysqli_query($mysqli, "INSERT INTO contacts SET contact_name = '$name', contact_title = '$title', contact_department = '$department', contact_email = '$email', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_notes = '$notes', contact_primary = '$primary', contact_important = '$important', contact_billing = '$billing', contact_technical = '$technical', contact_location_id = $location_id, contact_client_id = $client_id");
// Check insert & get insert ID // Check insert & get insert ID
if ($insert_sql) { if ($insert_sql) {
+1 -1
View File
@@ -19,7 +19,7 @@ if (!empty($contact_id)) {
require_once 'contact_model.php'; require_once 'contact_model.php';
$update_sql = mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_department = '$department', contact_email = '$email', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_notes = '$notes', contact_auth_method = '$auth_method', contact_primary = '$primary', contact_important = '$important', contact_billing = '$billing', contact_technical = '$technical', contact_location_id = $location_id, contact_client_id = $client_id WHERE contact_id = $contact_id LIMIT 1"); $update_sql = mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$name', contact_title = '$title', contact_department = '$department', contact_email = '$email', contact_phone = '$phone', contact_extension = '$extension', contact_mobile = '$mobile', contact_notes = '$notes', contact_primary = '$primary', contact_important = '$important', contact_billing = '$billing', contact_technical = '$technical', contact_location_id = $location_id, contact_client_id = $client_id WHERE contact_id = $contact_id LIMIT 1");
// Check insert & get insert ID // Check insert & get insert ID
if ($update_sql) { if ($update_sql) {
+3
View File
@@ -2,6 +2,9 @@
require_once "inc_all.php"; require_once "inc_all.php";
// Perms
enforceUserPermission('module_financial');
// Fetch categories // Fetch categories
$query = "SELECT category_id, category_name FROM categories WHERE category_type ='Expense' AND category_archived_at IS NULL"; $query = "SELECT category_id, category_name FROM categories WHERE category_type ='Expense' AND category_archived_at IS NULL";
$result = mysqli_query($mysqli, $query); $result = mysqli_query($mysqli, $query);
+4
View File
@@ -2,6 +2,8 @@
require_once "inc_all.php"; require_once "inc_all.php";
enforceUserPermission('module_financial', 2);
// Fetch categories // Fetch categories
$query = "SELECT category_id, category_name FROM categories WHERE category_type ='Expense' AND category_archived_at IS NULL"; $query = "SELECT category_id, category_name FROM categories WHERE category_type ='Expense' AND category_archived_at IS NULL";
$result = mysqli_query($mysqli, $query); $result = mysqli_query($mysqli, $query);
@@ -52,6 +54,8 @@ $grandTotal = 0;
</form> </form>
<form id="budgetForm" method="POST" action="post.php"> <form id="budgetForm" method="POST" action="post.php">
<input type="hidden" name="year" value="<?php echo $currentYear; ?>"> <input type="hidden" name="year" value="<?php echo $currentYear; ?>">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
+2 -2
View File
@@ -70,7 +70,7 @@
<input type="datetime-local" class="form-control" id="event_add_start" name="start" required onblur="updateIncrementEndTime()"> <input type="datetime-local" class="form-control" id="event_add_start" name="start" required onblur="updateIncrementEndTime()">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
@@ -86,7 +86,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
</div> </div>
<select class="form-control select2" name="repeat"> <select class="form-control select2" name="repeat" disabled>
<option value="">Never</option> <option value="">Never</option>
<option>Day</option> <option>Day</option>
<option>Week</option> <option>Week</option>
+4 -4
View File
@@ -72,7 +72,7 @@
<input type="datetime-local" class="form-control" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required> <input type="datetime-local" class="form-control" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
@@ -88,7 +88,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
</div> </div>
<select class="form-control select2" name="repeat"> <select class="form-control select2" name="repeat" disabled>
<option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option> <option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option>
<option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option> <option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option>
<option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option> <option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option>
@@ -96,7 +96,7 @@
<option <?php if ($event_repeat == "Year") { echo "selected"; } ?>>Year</option> <option <?php if ($event_repeat == "Year") { echo "selected"; } ?>>Year</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
@@ -115,7 +115,7 @@
<label>Description</label> <label>Description</label>
<textarea class="form-control" rows="8" name="description" placeholder="Enter a description"><?php echo $event_description; ?></textarea> <textarea class="form-control" rows="8" name="description" placeholder="Enter a description"><?php echo $event_description; ?></textarea>
</div> </div>
</div> </div>
+5 -6
View File
@@ -8,7 +8,6 @@ if (isset($_GET['calendar_id'])) {
} }
?> ?>
<link href='plugins/fullcalendar-6.1.10/dist/index.global.js' rel='stylesheet' />
<!-- So that when hovering over a created event it turns into a hand instead of cursor --> <!-- So that when hovering over a created event it turns into a hand instead of cursor -->
<style> <style>
@@ -30,7 +29,7 @@ if (isset($_GET['calendar_id'])) {
<div class="card-body"> <div class="card-body">
<form> <form>
<?php <?php
$sql = mysqli_query($mysqli, "SELECT * FROM calendars"); $sql = mysqli_query($mysqli, "SELECT * FROM calendars");
while ($row = mysqli_fetch_array($sql)) { while ($row = mysqli_fetch_array($sql)) {
$calendar_id = intval($row['calendar_id']); $calendar_id = intval($row['calendar_id']);
@@ -41,9 +40,9 @@ if (isset($_GET['calendar_id'])) {
<i class="fas fa-fw fa-circle mr-2" style="color:<?php echo $calendar_color; ?>;"></i><?php echo $calendar_name; ?> <i class="fas fa-fw fa-circle mr-2" style="color:<?php echo $calendar_color; ?>;"></i><?php echo $calendar_name; ?>
<button type="button" class="btn btn-link btn-sm float-right" data-toggle="modal" data-target="#editCalendarModal<?php echo $calendar_id; ?>"><i class="fas fa-fw fa-pencil-alt text-secondary"></i></button> <button type="button" class="btn btn-link btn-sm float-right" data-toggle="modal" data-target="#editCalendarModal<?php echo $calendar_id; ?>"><i class="fas fa-fw fa-pencil-alt text-secondary"></i></button>
</div> </div>
<?php <?php
require "calendar_edit_modal.php"; require "calendar_edit_modal.php";
} }
?> ?>
</form> </form>
</div> </div>
@@ -98,7 +97,7 @@ while ($row = mysqli_fetch_array($sql)) {
<?php require_once "footer.php"; <?php require_once "footer.php";
?> ?>
<script src='plugins/fullcalendar-6.1.10/dist/index.global.js'></script> <script src='plugins/fullcalendar/dist/index.global.js'></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
+8 -8
View File
@@ -38,20 +38,20 @@ $session_user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']);
$session_user_id = intval($_SESSION['user_id']); $session_user_id = intval($_SESSION['user_id']);
$sql = mysqli_query($mysqli, "SELECT * FROM users, user_settings WHERE users.user_id = user_settings.user_id AND users.user_id = $session_user_id"); $sql = mysqli_query(
$mysqli,
"SELECT * FROM users
LEFT JOIN user_settings ON users.user_id = user_settings.user_id
LEFT JOIN user_roles ON user_settings.user_role = user_roles.user_role_id
WHERE users.user_id = $session_user_id");
$row = mysqli_fetch_array($sql); $row = mysqli_fetch_array($sql);
$session_name = sanitizeInput($row['user_name']); $session_name = sanitizeInput($row['user_name']);
$session_email = $row['user_email']; $session_email = $row['user_email'];
$session_avatar = $row['user_avatar']; $session_avatar = $row['user_avatar'];
$session_token = $row['user_token']; $session_token = $row['user_token'];
$session_user_role = intval($row['user_role']); $session_user_role = intval($row['user_role']);
if ($session_user_role == 3) { $session_user_role_display = sanitizeInput($row['user_role_name']);
$session_user_role_display = "Administrator";
} elseif ($session_user_role == 2) {
$session_user_role_display = "Technician";
} else {
$session_user_role_display = "Accountant";
}
if (isset($row['user_role_is_admin']) && $row['user_role_is_admin'] == 1) { if (isset($row['user_role_is_admin']) && $row['user_role_is_admin'] == 1) {
$session_is_admin = true; $session_is_admin = true;
} }
+35 -41
View File
@@ -2,12 +2,13 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content bg-dark"> <div class="modal-content bg-dark">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-user-plus mr-2"></i>Create <?php if($leads == 0){ echo "Client"; } else { echo "Lead"; } ?></h5> <h5 class="modal-title"><i class="fa fa-fw fa-user-plus mr-2"></i>Creating New <?php if($leads == 0){ echo "Client"; } else { echo "Lead"; } ?></h5>
<button type="button" class="close text-white" data-dismiss="modal"> <button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span> <span>&times;</span>
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<input type="hidden" name="lead" value="0"> <input type="hidden" name="lead" value="0">
<input type="hidden" name="net_terms" value="0"> <input type="hidden" name="net_terms" value="0">
<input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>"> <input type="hidden" name="currency_code" value="<?php echo $session_company_currency; ?>">
@@ -29,7 +30,7 @@
</li> </li>
<?php } ?> <?php } ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-more">More</a> <a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
</li> </li>
</ul> </ul>
@@ -40,12 +41,27 @@
<div class="tab-pane fade show active" id="pills-details"> <div class="tab-pane fade show active" id="pills-details">
<div class="form-group"> <div class="form-group">
<label>Name <strong class="text-danger">*</strong></label> <label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Is Lead</span></label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div> </div>
<input type="text" class="form-control" name="name" placeholder="Name or Company" required autofocus> <input type="text" class="form-control" name="name" placeholder="Name or Company" required autofocus>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="lead" value="1" <?php if($leads == 1){ echo "checked"; } ?>>
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Shortened Name</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Shortned name for client - Max chars 6" maxlength="6" oninput="this.value = this.value.toUpperCase()">
</div> </div>
</div> </div>
@@ -90,11 +106,23 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label><i class="fas fa-fw fa-bullhorn mr-2"></i>Is Lead</label> <label>Tags</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<input type="checkbox" name="lead" value="1" <?php if($leads == 1){ echo "checked"; } ?>> <span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
</div> </div>
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
<?php
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = intval($row['tag_id']);
$tag_name_select = nullable_htmlentities($row['tag_name']);
?>
<option value="<?php echo $tag_id_select; ?>"><?php echo $tag_name_select; ?></option>
<?php } ?>
</select>
</div> </div>
</div> </div>
@@ -289,44 +317,10 @@
<?php } ?> <?php } ?>
<div class="tab-pane fade" id="pills-more"> <div class="tab-pane fade" id="pills-notes">
<div class="form-group"> <div class="form-group">
<label>Abbreviation</label> <textarea class="form-control" rows="10" name="notes" placeholder="Enter some notes"></textarea>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Abbreviated name for client" maxlength="6" oninput="this.value = this.value.toUpperCase()">
</div>
</div> </div>
<div class="form-group">
<label>Notes</label>
<textarea class="form-control" rows="6" name="notes" placeholder="Enter some notes"></textarea>
</div>
<div class="form-group">
<label>Tags</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
</div>
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
<?php
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = intval($row['tag_id']);
$tag_name_select = nullable_htmlentities($row['tag_name']);
?>
<option value="<?php echo $tag_id_select; ?>"><?php echo $tag_name_select; ?></option>
<?php } ?>
</select>
</div>
</div>
</div> </div>
</div> </div>
+148
View File
@@ -0,0 +1,148 @@
<div class="modal" id="bulkAddTicketModal" 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>Creating Tickets for Assets</h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<input type="hidden" name="bulk_billable" value="0">
<input type="hidden" name="bulk_client" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white">
<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" name="bulk_subject" placeholder="Asset Name will be prepended to Subject">
</div>
</div>
<?php if($config_ai_enable) { ?>
<div class="form-group">
<textarea class="form-control tinymceai" id="textInput" name="bulk_details"></textarea>
</div>
<div class="mb-3">
<button id="rewordButton" class="btn btn-primary" type="button"><i class="fas fa-fw fa-robot mr-2"></i>Reword</button>
<button id="undoButton" class="btn btn-secondary" type="button" style="display:none;"><i class="fas fa-fw fa-redo-alt mr-2"></i>Undo</button>
</div>
<?php } else { ?>
<div class="form-group">
<textarea class="form-control tinymce" rows="5" name="bulk_details"></textarea>
</div>
<?php } ?>
<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="bulk_priority">
<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="bulk_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");
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>
</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="bulk_assigned_to">
<option value="0">Not Assigned</option>
<?php
$sql = mysqli_query(
$mysqli,
"SELECT users.user_id, user_name FROM users
LEFT JOIN user_settings on users.user_id = user_settings.user_id
WHERE user_role > 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 <?php if ($session_user_id == $user_id) { echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<label>Project</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
</div>
<select class="form-control select2" name="bulk_project">
<option value="0">- None -</option>
<?php
$sql_projects = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_client_id = $client_id AND project_completed_at IS NULL AND project_archived_at IS NULL ORDER BY project_name ASC");
while ($row = mysqli_fetch_array($sql_projects)) {
$project_id_select = intval($row['project_id']);
$project_name_select = nullable_htmlentities($row['project_name']); ?>
<option value="<?php echo $project_id_select; ?>"><?php echo $project_name_select; ?></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="bulk_billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billableSwitch">
<label class="custom-control-label" for="billableSwitch">Billable</label>
</div>
</div>
<?php } ?>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="bulk_add_asset_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>
</div>
</div>
</div>
+27 -2
View File
@@ -117,8 +117,11 @@ if (isset($_GET['asset_id'])) {
// Related Logins Query // Related Logins Query
$sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins $sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins
LEFT JOIN login_tags ON login_tags.login_id = logins.login_id
LEFT JOIN tags ON tags.tag_id = login_tags.tag_id
WHERE login_asset_id = $asset_id WHERE login_asset_id = $asset_id
AND login_archived_at IS NULL AND login_archived_at IS NULL
GROUP BY logins.login_id
ORDER BY login_name DESC" ORDER BY login_name DESC"
); );
$login_count = mysqli_num_rows($sql_related_logins); $login_count = mysqli_num_rows($sql_related_logins);
@@ -410,6 +413,28 @@ if (isset($_GET['asset_id'])) {
$login_asset_id = intval($row['login_asset_id']); $login_asset_id = intval($row['login_asset_id']);
$login_software_id = intval($row['login_software_id']); $login_software_id = intval($row['login_software_id']);
// Tags
$login_tag_name_display_array = array();
$login_tag_id_array = array();
$sql_login_tags = mysqli_query($mysqli, "SELECT * FROM login_tags LEFT JOIN tags ON login_tags.tag_id = tags.tag_id WHERE login_id = $login_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_login_tags)) {
$login_tag_id = intval($row['tag_id']);
$login_tag_name = nullable_htmlentities($row['tag_name']);
$login_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($login_tag_color)) {
$login_tag_color = "dark";
}
$login_tag_icon = nullable_htmlentities($row['tag_icon']);
if (empty($login_tag_icon)) {
$login_tag_icon = "tag";
}
$login_tag_id_array[] = $login_tag_id;
$login_tag_name_display_array[] = "<a href='client_logins.php?client_id=$client_id&tags[]=$login_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $login_tag_color;'><i class='fa fa-fw fa-$login_tag_icon mr-2'></i>$login_tag_name</span></a>";
}
$login_tags_display = implode('', $login_tag_name_display_array);
?> ?>
<tr> <tr>
<td> <td>
@@ -684,8 +709,8 @@ if (isset($_GET['asset_id'])) {
?> ?>
<tr> <tr>
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td> <td><a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td>
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td> <td><a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
<td><?php echo $ticket_priority_display; ?></td> <td><?php echo $ticket_priority_display; ?></td>
<td> <td>
<span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span> <span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span>
+6 -9
View File
@@ -37,7 +37,7 @@
<hr> <hr>
<div class="tab-content"> <div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
<div class="tab-pane fade show active" id="pills-details<?php echo $asset_id; ?>"> <div class="tab-pane fade show active" id="pills-details<?php echo $asset_id; ?>">
@@ -397,7 +397,7 @@
<div class="tab-pane fade" id="pills-history<?php echo $asset_id; ?>"> <div class="tab-pane fade" id="pills-history<?php echo $asset_id; ?>">
<?php $sql_history = mysqli_query($mysqli, "SELECT * FROM logs WHERE log_type = 'asset' and log_entity_id = $asset_id and log_client_id = $client_id"); ?> <?php $sql_asset_history = mysqli_query($mysqli, "SELECT * FROM asset_history WHERE asset_history_asset_id = $asset_id ORDER BY asset_history_id DESC LIMIT 10"); ?>
<div class="form-group"> <div class="form-group">
<label>Asset History</label> <label>Asset History</label>
@@ -405,19 +405,16 @@
<ul> <ul>
<?php <?php
while ($row = mysqli_fetch_array($sql_history)) { while ($row = mysqli_fetch_array($sql_asset_history)) {
$log_action = nullable_htmlentities(($row['log_action'])); $asset_history_description = nullable_htmlentities(($row['asset_history_description']));
$log_description = nullable_htmlentities(($row['log_description'])); $asset_history_created_at = nullable_htmlentities(($row['asset_history_created_at']));
$log_created_at = nullable_htmlentities(($row['log_created_at'])); echo "<li><small class='text-secondary'>$asset_history_created_at</small><br>$asset_history_description</li>";
echo "<li>$log_created_at - $log_action: $log_description</li>";
} }
?> ?>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
+1 -1
View File
@@ -12,7 +12,7 @@
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<input type="hidden" name="interface_id" value="<?php echo $interface_id; ?>"> <input type="hidden" name="interface_id" value="<?php echo $interface_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
<div class="form-group"> <div class="form-group">
<label>Interface Name</label> <label>Interface Name</label>
+85 -38
View File
@@ -6,6 +6,9 @@ $order = "ASC";
require_once "inc_all_client.php"; require_once "inc_all_client.php";
// Perms
enforceUserPermission('module_support');
//Asset Type from GET //Asset Type from GET
if (isset($_GET['type']) && ($_GET['type']) == 'workstation') { if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
$type_query = "asset_type = 'desktop' OR asset_type = 'laptop'"; $type_query = "asset_type = 'desktop' OR asset_type = 'laptop'";
@@ -96,7 +99,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="card-header py-2"> <div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-desktop mr-2"></i>Assets</h3> <h3 class="card-title mt-2"><i class="fa fa-fw fa-desktop mr-2"></i>Assets</h3>
<div class="card-tools"> <div class="card-tools">
<div class="btn-group"> <?php if (lookupUserPermission("module_support") >= 2) { ?>
<div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal">
<i class="fas fa-plus mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(nullable_htmlentities($_GET['type']))); } else { echo "Asset"; } ?> <i class="fas fa-plus mr-2"></i>New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(nullable_htmlentities($_GET['type']))); } else { echo "Asset"; } ?>
</button> </button>
@@ -113,6 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?> <?php } ?>
</div> </div>
</div> </div>
<?php } ?>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
@@ -208,7 +213,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</a> </a>
<div class="dropdown ml-2" id="bulkActionButton" hidden> <div class="dropdown ml-2" id="bulkActionButton" hidden>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"> <button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>) <i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount"></span>)
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignContactModal"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAssignContactModal">
@@ -222,6 +227,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditStatusModal"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditStatusModal">
<i class="fas fa-fw fa-info mr-2"></i>Set Status <i class="fas fa-fw fa-info mr-2"></i>Set Status
</a> </a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkAddTicketModal">
<i class="fas fa-fw fa-life-ring mr-2"></i>Create Tickets
</a>
<?php if ($archived) { ?> <?php if ($archived) { ?>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button class="dropdown-item text-info" <button class="dropdown-item text-info"
@@ -255,55 +264,94 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'asset_name') { echo $order_icon; } ?>
</a>
</th>
<?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?> <?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_type&order=<?php echo $disp; ?>">Type</a></th> <th>
<?php } <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_type&order=<?php echo $disp; ?>">
if ($_GET['type'] !== 'virtual') { ?> Type <?php if ($sort == 'asset_type') { echo $order_icon; } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_make&order=<?php echo $disp; ?>">Model</a></th> </a>
<?php } </th>
if ($_GET['type'] !== 'virtual') { ?> <?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_serial&order=<?php echo $disp; ?>">Serial</a></th> <?php if ($_GET['type'] !== 'virtual') { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_make&order=<?php echo $disp; ?>">
Model <?php if ($sort == 'asset_make') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_serial&order=<?php echo $disp; ?>">
Serial <?php if ($sort == 'asset_serial') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('OS', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('OS', $_GET['show_column'])) { ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?> <?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_os&order=<?php echo $disp; ?>">OS</a></th> <th>
<?php } ?> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_os&order=<?php echo $disp; ?>">
OS <?php if ($sort == 'asset_os') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php } ?> <?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('IP', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('IP', $_GET['show_column'])) { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=interface_ip&order=<?php echo $disp; ?>">IP</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=interface_ip&order=<?php echo $disp; ?>">
</th> IP <?php if ($sort == 'interface_ip') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_purchase_date&order=<?php echo $disp; ?>">Purchase Date</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_purchase_date&order=<?php echo $disp; ?>">
</th> Purchase Date <?php if ($sort == 'asset_purchase_date') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_install_date&order=<?php echo $disp; ?>">Install Date</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_install_date&order=<?php echo $disp; ?>">
</th> Install Date <?php if ($sort == 'asset_install_date') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_warranty_expire&order=<?php echo $disp; ?>">Warranty Expire</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_warranty_expire&order=<?php echo $disp; ?>">
</th> Warranty Expire <?php if ($sort == 'asset_warranty_expire') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?> <?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Assigned To</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">
</th> Assigned To <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">Location</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Physical_Location', $_GET['show_column'])) { ?> <?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Physical_Location', $_GET['show_column'])) { ?>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_physical_location&order=<?php echo $disp; ?>">Physical Location</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_physical_location&order=<?php echo $disp; ?>">
</th> Physical Location <?php if ($sort == 'asset_physical_location') { echo $order_icon; } ?>
</a>
</th>
<?php } ?> <?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_status&order=<?php echo $disp; ?>">Status</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_status&order=<?php echo $disp; ?>">
Status <?php if ($sort == 'asset_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
@@ -550,6 +598,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<a class="dropdown-item text-info" href="post.php?unarchive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>"> <a class="dropdown-item text-info" href="post.php?unarchive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive <i class="fas fa-fw fa-redo mr-2"></i>Unarchive
</a> </a>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } else { ?> <?php } else { ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#transferAssetModal<?php echo $asset_id; ?>"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#transferAssetModal<?php echo $asset_id; ?>">
<i class="fas fa-fw fa-arrow-right mr-2"></i>Transfer <i class="fas fa-fw fa-arrow-right mr-2"></i>Transfer
@@ -558,11 +609,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<i class="fas fa-fw fa-archive mr-2"></i>Archive <i class="fas fa-fw fa-archive mr-2"></i>Archive
</a> </a>
<?php } ?> <?php } ?>
<?php if ($config_destructive_deletes_enable) { ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Delete
</a>
<?php } ?>
<?php } ?> <?php } ?>
</div> </div>
@@ -589,6 +635,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php require_once "client_asset_bulk_assign_location_modal.php"; ?> <?php require_once "client_asset_bulk_assign_location_modal.php"; ?>
<?php require_once "client_asset_bulk_assign_contact_modal.php"; ?> <?php require_once "client_asset_bulk_assign_contact_modal.php"; ?>
<?php require_once "client_asset_bulk_edit_status_modal.php"; ?> <?php require_once "client_asset_bulk_edit_status_modal.php"; ?>
<?php require_once "client_asset_bulk_add_ticket_modal.php"; ?>
</form> </form>
<?php require_once "pagination.php"; ?> <?php require_once "pagination.php"; ?>
</div> </div>
+1 -1
View File
@@ -26,7 +26,7 @@
<hr> <hr>
<div class="tab-content"> <div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
<div class="tab-pane fade show active" id="pillsEditDetails"> <div class="tab-pane fade show active" id="pillsEditDetails">
+22 -4
View File
@@ -6,6 +6,8 @@ $order = "ASC";
require_once "inc_all_client.php"; require_once "inc_all_client.php";
// Perms
enforceUserPermission('module_support');
//Rebuild URL //Rebuild URL
$url_query_strings_sort = http_build_query($get_copy); $url_query_strings_sort = http_build_query($get_copy);
@@ -83,10 +85,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_domain&order=<?php echo $disp; ?>">Domain</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_name&order=<?php echo $disp; ?>">
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_issued_by&order=<?php echo $disp; ?>">Issued By</a></th> Name <?php if ($sort == 'certificate_name') { echo $order_icon; } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_expire&order=<?php echo $disp; ?>">Expire</a></th> </a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_domain&order=<?php echo $disp; ?>">
Domain <?php if ($sort == 'certificate_domain') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_issued_by&order=<?php echo $disp; ?>">
Issued By <?php if ($sort == 'certificate_issued_by') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=certificate_expire&order=<?php echo $disp; ?>">
Expire <?php if ($sort == 'certificate_expire') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
+3
View File
@@ -198,6 +198,7 @@
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox" name="contact_important" value="1"> <input type="checkbox" class="custom-control-input" id="contactImportantCheckbox" name="contact_important" value="1">
<label class="custom-control-label" for="contactImportantCheckbox">Important</label> <label class="custom-control-label" for="contactImportantCheckbox">Important</label>
<p class="text-secondary"><small>Pin Top</small></p>
</div> </div>
</div> </div>
</div> </div>
@@ -206,6 +207,7 @@
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox" name="contact_billing" value="1"> <input type="checkbox" class="custom-control-input" id="contactBillingCheckbox" name="contact_billing" value="1">
<label class="custom-control-label" for="contactBillingCheckbox">Billing</label> <label class="custom-control-label" for="contactBillingCheckbox">Billing</label>
<p class="text-secondary"><small>Receives Invoices</small></p>
</div> </div>
</div> </div>
</div> </div>
@@ -214,6 +216,7 @@
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox" name="contact_technical" value="1"> <input type="checkbox" class="custom-control-input" id="contactTechnicalCheckbox" name="contact_technical" value="1">
<label class="custom-control-label" for="contactTechnicalCheckbox">Technical</label> <label class="custom-control-label" for="contactTechnicalCheckbox">Technical</label>
<p class="text-secondary"><small>Access </small></p>
</div> </div>
</div> </div>
</div> </div>
+56
View File
@@ -0,0 +1,56 @@
<div class="modal" id="archiveContactModal<?php echo $contact_id; ?>" 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-archive mr-2"></i>Archiving contact: <strong><?php echo $contact_name; ?></strong></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
<div class="modal-body bg-white">
<div class="alert alert-warning">
Client Portal Access will be revoked upon archiving
</div>
<label>Unassign:</label>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="unassignAssetsCheckbox<?php echo $contact_id; ?>" name="unassign_assets" value="1">
<label class="custom-control-label" for="unassignAssetsCheckbox<?php echo $contact_id; ?>">Assets</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="unassignLicensesCheckbox<?php echo $contact_id; ?>" name="unassign_licenses" value="1">
<label class="custom-control-label" for="unassignLicensesCheckbox<?php echo $contact_id; ?>">Licenses</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="unassignDocumentsCheckbox<?php echo $contact_id; ?>" name="unassign_documents" value="1">
<label class="custom-control-label" for="unassignDocumentsCheckbox<?php echo $contact_id; ?>">Documents</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="anonymizeCheckbox<?php echo $contact_id; ?>" name="anonymize_contact" value="1">
<label class="custom-control-label" for="anonymizeCheckbox<?php echo $contact_id; ?>">Anonymize Contact</label>
</div>
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="archive_contact" class="btn btn-danger text-bold"><i class="fas fa-check mr-2"></i>Arhive</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>
+33 -9
View File
@@ -8,6 +8,7 @@ if (isset($_GET['contact_id'])) {
$sql = mysqli_query($mysqli, "SELECT * FROM contacts $sql = mysqli_query($mysqli, "SELECT * FROM contacts
LEFT JOIN locations ON location_id = contact_location_id LEFT JOIN locations ON location_id = contact_location_id
LEFT JOIN users ON user_id = contact_user_id
WHERE contact_id = $contact_id WHERE contact_id = $contact_id
"); ");
@@ -30,7 +31,7 @@ if (isset($_GET['contact_id'])) {
$contact_created_at = nullable_htmlentities($row['contact_created_at']); $contact_created_at = nullable_htmlentities($row['contact_created_at']);
$contact_location_id = intval($row['contact_location_id']); $contact_location_id = intval($row['contact_location_id']);
$location_name = nullable_htmlentities($row['location_name']); $location_name = nullable_htmlentities($row['location_name']);
$auth_method = nullable_htmlentities($row['contact_auth_method']); $auth_method = nullable_htmlentities($row['user_auth_method']);
$contact_client_id = intval($row['contact_client_id']); $contact_client_id = intval($row['contact_client_id']);
// Check to see if Contact belongs to client // Check to see if Contact belongs to client
@@ -43,7 +44,13 @@ if (isset($_GET['contact_id'])) {
$asset_count = mysqli_num_rows($sql_related_assets); $asset_count = mysqli_num_rows($sql_related_assets);
// Related Logins Query // Related Logins Query
$sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_contact_id = $contact_id ORDER BY login_name DESC"); $sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins
LEFT JOIN login_tags ON login_tags.login_id = logins.login_id
LEFT JOIN tags ON tags.tag_id = login_tags.tag_id
WHERE login_contact_id = $contact_id
GROUP BY logins.login_id
ORDER BY login_name DESC
");
$login_count = mysqli_num_rows($sql_related_logins); $login_count = mysqli_num_rows($sql_related_logins);
// Related Software Query // Related Software Query
@@ -183,10 +190,6 @@ if (isset($_GET['contact_id'])) {
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketModal"> <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketModal">
<i class="fa fa-fw fa-plus mr-2"></i>New Ticket <i class="fa fa-fw fa-plus mr-2"></i>New Ticket
</a> </a>
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketFromTemplateModal">
<i class="fa fa-fw fa-plus mr-2"></i>From Template
</a>
<div class="dropdown-divider"></div>
</div> </div>
</div> </div>
@@ -380,6 +383,28 @@ if (isset($_GET['contact_id'])) {
$login_asset_id = intval($row['login_asset_id']); $login_asset_id = intval($row['login_asset_id']);
$login_software_id = intval($row['login_software_id']); $login_software_id = intval($row['login_software_id']);
// Tags
$login_tag_name_display_array = array();
$login_tag_id_array = array();
$sql_login_tags = mysqli_query($mysqli, "SELECT * FROM login_tags LEFT JOIN tags ON login_tags.tag_id = tags.tag_id WHERE login_id = $login_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_login_tags)) {
$login_tag_id = intval($row['tag_id']);
$login_tag_name = nullable_htmlentities($row['tag_name']);
$login_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($login_tag_color)) {
$login_tag_color = "dark";
}
$login_tag_icon = nullable_htmlentities($row['tag_icon']);
if (empty($login_tag_icon)) {
$login_tag_icon = "tag";
}
$login_tag_id_array[] = $login_tag_id;
$login_tag_name_display_array[] = "<a href='client_logins.php?client_id=$client_id&tags[]=$login_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $login_tag_color;'><i class='fa fa-fw fa-$login_tag_icon mr-2'></i>$login_tag_name</span></a>";
}
$login_tags_display = implode('', $login_tag_name_display_array);
?> ?>
<tr> <tr>
<td> <td>
@@ -569,8 +594,8 @@ if (isset($_GET['contact_id'])) {
?> ?>
<tr> <tr>
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td> <td><a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><span class="badge badge-pill badge-secondary p-3"><?php echo "$ticket_prefix$ticket_number"; ?></span></a></td>
<td><a href="ticket.php?ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td> <td><a href="ticket.php?client_id=<?php echo $client_id; ?>&ticket_id=<?php echo $ticket_id; ?>"><?php echo $ticket_subject; ?></a></td>
<td><?php echo $ticket_priority_display; ?></td> <td><?php echo $ticket_priority_display; ?></td>
<td><span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span></td> <td><span class='badge badge-pill text-light p-2' style="background-color: <?php echo $ticket_status_color; ?>"><?php echo $ticket_status_name; ?></span></td>
<td><?php echo $ticket_assigned_to_display; ?></td> <td><?php echo $ticket_assigned_to_display; ?></td>
@@ -658,7 +683,6 @@ if (isset($_GET['contact_id'])) {
<?php <?php
require_once "ticket_add_modal.php"; require_once "ticket_add_modal.php";
require_once "ticket_add_from_template_modal.php";
require_once "footer.php"; require_once "footer.php";
+3 -1
View File
@@ -2,7 +2,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content bg-dark"> <div class="modal-content bg-dark">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing: <strong><?php echo $contact_name; ?></strong></h5> <h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing contact: <strong><?php echo $contact_name; ?></strong></h5>
<button type="button" class="close text-white" data-dismiss="modal"> <button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span> <span>&times;</span>
</button> </button>
@@ -206,6 +206,7 @@
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="contactImportantCheckbox<?php echo $contact_id; ?>" name="contact_important" value="1" <?php if ($contact_important == 1) { echo "checked"; } ?>> <input type="checkbox" class="custom-control-input" id="contactImportantCheckbox<?php echo $contact_id; ?>" name="contact_important" value="1" <?php if ($contact_important == 1) { echo "checked"; } ?>>
<label class="custom-control-label" for="contactImportantCheckbox<?php echo $contact_id; ?>">Important</label> <label class="custom-control-label" for="contactImportantCheckbox<?php echo $contact_id; ?>">Important</label>
<p class="text-secondary"><small>Pin Top</small></p>
</div> </div>
</div> </div>
</div> </div>
@@ -214,6 +215,7 @@
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="contactBillingCheckbox<?php echo $contact_id; ?>" name="contact_billing" value="1" <?php if ($contact_billing == 1) { echo "checked"; } ?>> <input type="checkbox" class="custom-control-input" id="contactBillingCheckbox<?php echo $contact_id; ?>" name="contact_billing" value="1" <?php if ($contact_billing == 1) { echo "checked"; } ?>>
<label class="custom-control-label" for="contactBillingCheckbox<?php echo $contact_id; ?>">Billing</label> <label class="custom-control-label" for="contactBillingCheckbox<?php echo $contact_id; ?>">Billing</label>
<p class="text-secondary"><small>Receives Invoices</small></p>
</div> </div>
</div> </div>
</div> </div>
+24 -13
View File
@@ -35,8 +35,9 @@ if (isset($_GET['location']) & !empty($_GET['location'])) {
//Rebuild URL //Rebuild URL
$url_query_strings_sort = http_build_query($get_copy); $url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.*, locations.*, GROUP_CONCAT(tags.tag_name) FROM contacts $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.*, locations.*, users.*, GROUP_CONCAT(tags.tag_name) FROM contacts
LEFT JOIN locations ON location_id = contact_location_id LEFT JOIN locations ON location_id = contact_location_id
LEFT JOIN users ON user_id = contact_user_id
LEFT JOIN contact_tags ON contact_tags.contact_id = contacts.contact_id LEFT JOIN contact_tags ON contact_tags.contact_id = contacts.contact_id
LEFT JOIN tags ON tags.tag_id = contact_tags.tag_id LEFT JOIN tags ON tags.tag_id = contact_tags.tag_id
WHERE contact_$archive_query WHERE contact_$archive_query
@@ -198,13 +199,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-secondary ml-3" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Name</a></th>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_department&order=<?php echo $disp; ?>">Department <a class="text-secondary ml-3" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_department&order=<?php echo $disp; ?>">
Department <?php if ($sort == 'contact_department') { echo $order_icon; } ?>
</a> </a>
</th> </th>
<th>Contact</th> <th>Contact</th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">Location</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@@ -281,7 +291,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
} else { } else {
$location_name_display = $location_name; $location_name_display = $location_name;
} }
$auth_method = nullable_htmlentities($row['contact_auth_method']); $auth_method = nullable_htmlentities($row['user_auth_method']);
$contact_user_id = intval($row['contact_user_id']);
// Related Assets Query // Related Assets Query
$sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_contact_id = $contact_id ORDER BY asset_id DESC"); $sql_related_assets = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_contact_id = $contact_id ORDER BY asset_id DESC");
@@ -317,7 +328,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
} }
$contact_tag_id_array[] = $contact_tag_id; $contact_tag_id_array[] = $contact_tag_id;
$contact_tag_name_display_array[] = "<a href='client_contacts.php?client_id=$client_id&q=$contact_tag_name'><span class='badge text-light p-1 mr-1' style='background-color: $contact_tag_color;'><i class='fa fa-fw fa-$contact_tag_icon mr-2'></i>$contact_tag_name</span></a>"; $contact_tag_name_display_array[] = "<a href='client_contacts.php?client_id=$client_id&tags[]=$contact_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $contact_tag_color;'><i class='fa fa-fw fa-$contact_tag_icon mr-2'></i>$contact_tag_name</span></a>";
} }
$contact_tags_display = implode('', $contact_tag_name_display_array); $contact_tags_display = implode('', $contact_tag_name_display_array);
@@ -348,16 +359,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="<?php if(!empty($contact_important)) { echo "text-bold"; } ?>"><?php echo $contact_name; ?></div> <div class="<?php if(!empty($contact_important)) { echo "text-bold"; } ?>"><?php echo $contact_name; ?></div>
<?php echo $contact_title_display; ?> <?php echo $contact_title_display; ?>
<div><?php echo $contact_primary_display; ?></div> <div><?php echo $contact_primary_display; ?></div>
<?php
if (!empty($contact_tags_display)) { ?>
<div class="mt-1">
<?php echo $contact_tags_display; ?>
</div>
<?php } ?>
</div> </div>
</div> </div>
</a> </a>
<?php
if (!empty($contact_tags_display)) { ?>
<div class="mt-1">
<?php echo $contact_tags_display; ?>
</div>
<?php } ?>
</td> </td>
<td><?php echo $contact_department_display; ?></td> <td><?php echo $contact_department_display; ?></td>
<td><?php echo $contact_info_display; ?></td> <td><?php echo $contact_info_display; ?></td>
+31 -12
View File
@@ -29,36 +29,55 @@
<textarea class="form-control tinymce" name="content"></textarea> <textarea class="form-control tinymce" name="content"></textarea>
</div> </div>
<?php } ?> <?php } ?>
<div class="form-group"> <div class="form-group">
<label for="folderSelect">Select Folder</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<select class="form-control" name="folder"> <select class="form-control select2" name="folder" id="folderSelect">
<option value="0">/</option> <option value="0">/</option>
<?php <?php
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Recursive function to display folder options
while ($row = mysqli_fetch_array($sql_folders)) { function display_folder_options($parent_folder_id, $client_id, $indent = 0) {
$folder_id = intval($row['folder_id']); global $mysqli;
$folder_name = nullable_htmlentities($row['folder_name']);
?> $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
<option <?php if (isset($_GET['folder_id']) && $_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option> while ($row = mysqli_fetch_array($sql_folders)) {
<?php $folder_id = intval($row['folder_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $indent * 4);
// Check if this folder is selected
$selected = '';
if ((isset($_GET['folder_id']) && $_GET['folder_id'] == $folder_id) || (isset($_POST['folder']) && $_POST['folder'] == $folder_id)) {
$selected = 'selected';
}
echo "<option value=\"$folder_id\" $selected>$indentation$folder_name</option>";
// Recursively display subfolders
display_folder_options($folder_id, $client_id, $indent + 1);
}
} }
?>
// Start displaying folder options from the root (parent_folder = 0)
display_folder_options(0, $client_id);
?>
</select> </select>
</div> </div>
</div> </div>
<label>Description</label>
<div class="form-group"> <div class="form-group">
<label for="descriptionInput">Description</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-file"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-file"></i></span>
</div> </div>
<input type="text" class="form-control" name="description" placeholder="Short summary of the document"> <input type="text" class="form-control" name="description" id="descriptionInput" placeholder="Short summary of the document">
</div> </div>
</div> </div>
</div> </div>
@@ -69,4 +88,4 @@
</form> </form>
</div> </div>
</div> </div>
</div> </div>
+67 -16
View File
@@ -2,7 +2,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content bg-dark"> <div class="modal-content bg-dark">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Moving documents</strong></h5> <h5 class="modal-title"><i class="fa fa-fw fa-file-alt mr-2"></i>Moving documents</h5>
<button type="button" class="close text-white" data-dismiss="modal"> <button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span> <span>&times;</span>
</button> </button>
@@ -10,32 +10,83 @@
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<div class="form-group"> <div class="form-group">
<label>Move Document to</label> <label>Move Documents to</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<select class="form-control select2" name="bulk_folder_id"> <select class="form-control select2" name="bulk_folder_id">
<option value="0">/</option> <option value="0">/</option>
<?php
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC");
while ($row = mysqli_fetch_array($sql_folders_select)) {
$folder_id_select = intval($row['folder_id']);
$folder_name_select = nullable_htmlentities($row['folder_name']);
?>
<option value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
<?php <?php
} // Fetch all folders for the client
?> $sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
$folders = array();
// Build an associative array of folders indexed by folder_id
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
$folders[$row['folder_id']] = array(
'folder_id' => intval($row['folder_id']),
'folder_name' => nullable_htmlentities($row['folder_name']),
'parent_folder' => intval($row['parent_folder']),
'children' => array()
);
}
// Build the folder hierarchy
foreach ($folders as $id => &$folder) {
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
$folders[$folder['parent_folder']]['children'][] = &$folder;
}
}
unset($folder); // Break the reference
// Prepare a list of root folders
$root_folders = array();
foreach ($folders as $id => $folder) {
if ($folder['parent_folder'] == 0) {
$root_folders[] = $folder;
}
}
// Display the folder options iteratively
$stack = array();
foreach (array_reverse($root_folders) as $folder) {
$stack[] = array('folder' => $folder, 'level' => 0);
}
while (!empty($stack)) {
$node = array_pop($stack);
$folder = $node['folder'];
$level = $node['level'];
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $level * 4);
// Check if this folder is selected
$selected = '';
if ($folder['folder_id'] == $get_folder_id) {
$selected = 'selected';
}
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
// Add children to the stack
if (!empty($folder['children'])) {
foreach (array_reverse($folder['children']) as $child_folder) {
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
}
}
}
?>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer bg-white"> <div class="modal-footer bg-white">
<button type="submit" name="bulk_move_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button> <button type="submit" name="bulk_move_document" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Move</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button> <button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
+48 -10
View File
@@ -46,12 +46,47 @@ $document_client_visible = intval($row['document_client_visible']);
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a> <a href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
</li> </li>
<?php if ($document_folder_id > 0) { ?> <?php
<li class="breadcrumb-item"> // Build the full folder path
<a href="client_documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $document_folder_id; ?>"><i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $folder_name; ?></a> $folder_id = $document_folder_id;
$folder_path = array();
while ($folder_id > 0) {
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
$folder_name = nullable_htmlentities($row_folder['folder_name']);
$parent_folder = intval($row_folder['parent_folder']);
// Prepend the folder to the beginning of the array
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
// Move up to the parent folder
$folder_id = $parent_folder;
} else {
// If the folder is not found, break the loop
break;
}
}
// Output breadcrumb items for each folder in the path
foreach ($folder_path as $folder) {
$bread_crumb_folder_id = $folder['folder_id']; // Sanitized before put in array
$bread_crumb_folder_name = $folder['folder_name']; // Sanitized before put in array
?>
<li class="breadcrumb-item">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
</a>
</li>
<?php
}
?>
<li class="breadcrumb-item active">
<i class="fas fa-file"></i> <?php echo $document_name; ?>
<?php if (!empty($document_archived_at)) {
echo "<span class='text-danger ml-2'>(ARCHIVED on $document_archived_at)</span>";
} ?>
</li> </li>
<?php } ?>
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo $document_name; ?> <?php if(!empty($document_archived_at)){ echo "<span class='text-danger ml-2'>(ARCHIVED on $document_archived_at)</span>"; } ?></li>
</ol> </ol>
<div class="row"> <div class="row">
@@ -84,7 +119,7 @@ $document_client_visible = intval($row['document_client_visible']);
<tbody> <tbody>
<?php <?php
$sql_document_revisions = mysqli_query($mysqli, "SELECT * FROM documents $sql_document_revisions = mysqli_query($mysqli, "SELECT * FROM documents
LEFT JOIN users ON document_created_by = user_id LEFT JOIN users ON document_updated_by = user_id
WHERE document_parent = $document_parent WHERE document_parent = $document_parent
ORDER BY document_created_at ASC" ORDER BY document_created_at ASC"
); );
@@ -101,6 +136,9 @@ $document_client_visible = intval($row['document_client_visible']);
$revision_document_description_display = "-"; $revision_document_description_display = "-";
} }
$revision_document_author = nullable_htmlentities($row['user_name']); $revision_document_author = nullable_htmlentities($row['user_name']);
if (empty($revision_document_author)) {
$revision_document_author = $document_created_by_name;
}
$revision_document_created_date = date('Y-m-d', strtotime($row['document_created_at'])); $revision_document_created_date = date('Y-m-d', strtotime($row['document_created_at']));
?> ?>
@@ -174,7 +212,7 @@ $document_client_visible = intval($row['document_client_visible']);
</button> </button>
</h6> </h6>
<?php <?php
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts, contact_documents $sql_contacts = mysqli_query($mysqli, "SELECT contacts.contact_id, contact_name FROM contacts, contact_documents
WHERE contacts.contact_id = contact_documents.contact_id WHERE contacts.contact_id = contact_documents.contact_id
AND contact_documents.document_id = $document_id AND contact_documents.document_id = $document_id
ORDER BY contact_name ASC" ORDER BY contact_name ASC"
@@ -205,7 +243,7 @@ $document_client_visible = intval($row['document_client_visible']);
</button> </button>
</h6> </h6>
<?php <?php
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets, asset_documents $sql_assets = mysqli_query($mysqli, "SELECT assets.asset_id, asset_name FROM assets, asset_documents
WHERE assets.asset_id = asset_documents.asset_id WHERE assets.asset_id = asset_documents.asset_id
AND asset_documents.document_id = $document_id AND asset_documents.document_id = $document_id
ORDER BY asset_name ASC" ORDER BY asset_name ASC"
@@ -236,7 +274,7 @@ $document_client_visible = intval($row['document_client_visible']);
</button> </button>
</h6> </h6>
<?php <?php
$sql_software = mysqli_query($mysqli, "SELECT * FROM software, software_documents $sql_software = mysqli_query($mysqli, "SELECT software.software_id, software_name FROM software, software_documents
WHERE software.software_id = software_documents.software_id WHERE software.software_id = software_documents.software_id
AND software_documents.document_id = $document_id AND software_documents.document_id = $document_id
ORDER BY software_name ASC" ORDER BY software_name ASC"
@@ -267,7 +305,7 @@ $document_client_visible = intval($row['document_client_visible']);
</button> </button>
</h6> </h6>
<?php <?php
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM vendors, vendor_documents $sql_vendors = mysqli_query($mysqli, "SELECT vendors.vendor_id, vendor_name FROM vendors, vendor_documents
WHERE vendors.vendor_id = vendor_documents.vendor_id WHERE vendors.vendor_id = vendor_documents.vendor_id
AND vendor_documents.document_id = $document_id AND vendor_documents.document_id = $document_id
ORDER BY vendor_name ASC" ORDER BY vendor_name ASC"
-1
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
-1
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
-1
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
+1 -2
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
@@ -28,7 +27,7 @@
$exclude_condition = ""; // No condition if there are no displayed vendors $exclude_condition = ""; // No condition if there are no displayed vendors
} }
$sql_software_select = mysqli_query($mysqli, "SELECT * FROM software $sql_software_select = mysqli_query($mysqli, "SELECT software_id, software_name FROM software
WHERE software_client_id = $client_id WHERE software_client_id = $client_id
AND software_archived_at IS NULL AND software_archived_at IS NULL
$exclude_condition $exclude_condition
+1 -2
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
@@ -28,7 +27,7 @@
$exclude_condition = ""; // No condition if there are no displayed vendors $exclude_condition = ""; // No condition if there are no displayed vendors
} }
$sql_vendors_select = mysqli_query($mysqli, "SELECT * FROM vendors $sql_vendors_select = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors
WHERE vendor_client_id = $client_id WHERE vendor_client_id = $client_id
AND vendor_archived_at IS NULL AND vendor_archived_at IS NULL
$exclude_condition $exclude_condition
+58 -8
View File
@@ -9,7 +9,6 @@
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>"> <input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<div class="form-group"> <div class="form-group">
@@ -21,13 +20,64 @@
<select class="form-control select2" name="folder"> <select class="form-control select2" name="folder">
<option value="0">/</option> <option value="0">/</option>
<?php <?php
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Fetch all folders for the client
while ($row = mysqli_fetch_array($sql_folders_select)) { $sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
$folder_id_select = intval($row['folder_id']); $folders = array();
$folder_name_select = nullable_htmlentities($row['folder_name']);
?> // Build an associative array of folders indexed by folder_id
<option <?php if ($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option> while ($row = mysqli_fetch_assoc($sql_all_folders)) {
<?php $folders[$row['folder_id']] = array(
'folder_id' => intval($row['folder_id']),
'folder_name' => nullable_htmlentities($row['folder_name']),
'parent_folder' => intval($row['parent_folder']),
'children' => array()
);
}
// Build the folder hierarchy
foreach ($folders as $id => &$folder) {
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
$folders[$folder['parent_folder']]['children'][] = &$folder;
}
}
unset($folder); // Break the reference
// Prepare a list of root folders
$root_folders = array();
foreach ($folders as $id => $folder) {
if ($folder['parent_folder'] == 0) {
$root_folders[] = $folder;
}
}
// Display the folder options iteratively
$stack = array();
foreach (array_reverse($root_folders) as $folder) {
$stack[] = array('folder' => $folder, 'level' => 0);
}
while (!empty($stack)) {
$node = array_pop($stack);
$folder = $node['folder'];
$level = $node['level'];
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $level * 4);
// Check if this folder is selected
$selected = '';
if ($folder['folder_id'] == $document_folder_id) {
$selected = 'selected';
}
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
// Add children to the stack
if (!empty($folder['children'])) {
foreach (array_reverse($folder['children']) as $child_folder) {
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
}
}
} }
?> ?>
</select> </select>
+212 -85
View File
@@ -6,6 +6,8 @@ $order = "ASC";
require_once "inc_all_client.php"; require_once "inc_all_client.php";
// Perms
enforceUserPermission('module_support');
// Folder // Folder
if (!empty($_GET['folder_id'])) { if (!empty($_GET['folder_id'])) {
@@ -61,8 +63,32 @@ if ($get_folder_id == 0 && $_GET["q"]) {
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
// Breadcrumbs
// Build the full folder path
$folder_id = $get_folder_id;
$folder_path = array();
while ($folder_id > 0) {
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
$folder_name = nullable_htmlentities($row_folder['folder_name']);
$parent_folder = intval($row_folder['parent_folder']);
// Prepend the folder to the beginning of the array
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
// Move up to the parent folder
$folder_id = $parent_folder;
} else {
// If the folder is not found, break the loop
break;
}
}
?> ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-2"> <div class="card-header py-2">
<h3 class="card-title mt-2"> <h3 class="card-title mt-2">
@@ -72,12 +98,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentModal">
<i class="fas fa-plus mr-2"></i>Create <i class="fas fa-plus mr-2"></i>New Document
</button> </button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal"> <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
<i class="fa fa-fw fa-folder-plus mr-2"></i>Folder <i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
</a> </a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a> <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addDocumentFromTemplateModal">From Template</a>
@@ -87,7 +113,48 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<form autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
<div class="row">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search documents in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
<div class="col-md-8">
<div class="btn-group float-right">
<div class="dropdown ml-2" id="bulkActionButton" hidden>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveDocumentModal">
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
</a>
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger text-bold"
type="submit" form="bulkActions" name="bulk_delete_documents">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</button>
</div>
</div>
</div>
</div>
</div>
</form>
<hr>
<div class="row"> <div class="row">
<div class="col-md-3 border-right mb-3"> <div class="col-md-3 border-right mb-3">
<h4>Folders</h4> <h4>Folders</h4>
@@ -96,106 +163,157 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<li class="nav-item"> <li class="nav-item">
<div class="row"> <div class="row">
<div class="col-10"> <div class="col-10">
<?php <?php
// Get a count of documents that have no folder // Get a count of documents that have no folder
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL")); $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = 0 AND document_client_id = $client_id AND document_archived_at IS NULL"));
$num_documents = intval($row['num']); $num_documents = intval($row['num']);
?> ?>
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?></a> <a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">
/ <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
</a>
</div> </div>
<div class="col-2"> <div class="col-2">
</div> </div>
</div> </div>
</li> </li>
<?php <?php
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Function to check if a folder is an ancestor of the current folder
while ($row = mysqli_fetch_array($sql_folders)) { function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
$folder_id = intval($row['folder_id']); global $mysqli;
$folder_name = nullable_htmlentities($row['folder_name']);
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL")); // Base case: if current_folder_id is 0 or equal to folder_id
$num_documents = intval($row['num']); if ($current_folder_id == 0) {
return false;
}
if ($current_folder_id == $folder_id) {
return true;
}
?> // Get the parent folder of the current folder
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
if ($row = mysqli_fetch_assoc($result)) {
$parent_folder_id = intval($row['parent_folder']);
// Recursive call to check the parent folder
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
} else {
// Folder not found
return false;
}
}
<li class="nav-item"> // Recursive function to display folders and subfolders
<div class="row"> function display_folders($parent_folder_id, $client_id, $indent = 0) {
<div class="col-10"> global $mysqli, $get_folder_id, $session_user_role;
<a class="nav-link <?php if ($get_folder_id == $folder_id) { echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>">
<?php
if ($get_folder_id == $folder_id) { ?>
<i class="fas fa-fw fa-folder-open"></i>
<?php } else { ?>
<i class="fas fa-fw fa-folder"></i>
<?php } ?>
<?php echo $folder_name; ?> <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?> $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 0 AND folder_client_id = $client_id ORDER BY folder_name ASC");
while ($row = mysqli_fetch_array($sql_folders)) {
$folder_id = intval($row['folder_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
// Get the number of documents in the folder
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('document_id') AS num FROM documents WHERE document_folder_id = $folder_id AND document_archived_at IS NULL"));
$num_documents = intval($row2['num']);
// Get the number of subfolders
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
echo '<li class="nav-item">';
echo '<div class="row">';
echo '<div class="col-10">';
echo '<a class="nav-link ';
if ($get_folder_id == $folder_id) { echo "active"; }
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
// Indentation for subfolders
echo str_repeat('&nbsp;', $indent * 4);
// Determine if the folder is open
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
echo '<i class="fas fa-fw fa-folder-open"></i>';
} else {
echo '<i class="fas fa-fw fa-folder"></i>';
}
echo ' ' . $folder_name;
if ($num_documents > 0) {
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>";
}
echo '</a>';
echo '</div>';
echo '<div class="col-2">';
?>
<div class="dropdown">
<button class="btn btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Rename
</a> </a>
</div> <?php
<div class="col-2"> // Only show delete option if user is admin, folder has no documents, and no subfolders
<div class="dropdown"> if ($session_user_role == 3 && $num_documents == 0 && $subfolder_count == 0) { ?>
<button class="btn btn-sm" type="button" data-toggle="dropdown"> <div class="dropdown-divider"></div>
<i class="fas fa-ellipsis-v"></i> <a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
</button> <i class="fas fa-fw fa-trash mr-2"></i>Delete
<div class="dropdown-menu"> </a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>"> <?php } ?>
<i class="fas fa-fw fa-edit mr-2"></i>Rename
</a>
<?php if ($session_user_role == 3 && $num_documents == 0) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</div> </div>
</div> </div>
</li> <?php
echo '</div>';
echo '</div>';
<?php // Include the rename and create subfolder modals
require "folder_rename_modal.php"; require "folder_rename_modal.php";
if ($subfolder_count > 0) {
// Display subfolders
echo '<ul class="nav nav-pills flex-column bg-light">';
display_folders($folder_id, $client_id, $indent + 1);
echo '</ul>';
}
echo '</li>';
}
} }
// Start displaying folders from the root (parent_folder = 0)
display_folders(0, $client_id);
?> ?>
</ul> </ul>
<?php require_once "folder_create_modal.php"; <?php require_once "folder_create_modal.php"; ?>
?>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<form autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>"> <nav>
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>"> <ol class="breadcrumb">
<div class="row"> <li class="breadcrumb-item">
<div class="col-md-4"> <a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
<div class="input-group mb-3 mb-md-0"> <i class="fas fa-fw fa-folder mr-2"></i>Root
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Documents"> </a>
<div class="input-group-append"> </li>
<button class="btn btn-dark"><i class="fa fa-search"></i></button> <?php
</div> // Output breadcrumb items for each folder in the path
</div> foreach ($folder_path as $folder) {
</div> $bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
<div class="col-md-8"> $bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
<div class="btn-group float-right">
<div class="dropdown ml-2" id="bulkActionButton" hidden> ?>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown"> <li class="breadcrumb-item">
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>) <a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
</button> <i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
<div class="dropdown-menu"> </a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveDocumentModal"> </li>
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move <?php
</a> }
</div> ?>
</div> </ol>
</div> </nav>
</div>
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post"> <form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
@@ -210,18 +328,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div> </div>
</td> </td>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">Name</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'document_name') { echo $order_icon; } ?>
</a>
</th> </th>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">Created</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_created_at&order=<?php echo $disp; ?>">
Created <?php if ($sort == 'document_created_at') { echo $order_icon; } ?>
</a>
</th> </th>
<th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">Last Update</a> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_updated_at&order=<?php echo $disp; ?>">
Last Update <?php if ($sort == 'document_updated_at') { echo $order_icon; } ?>
</a>
</th> </th>
<th></th> <th></th>
<th class="text-center"> <th class="text-center">Action</th>
Action
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -256,6 +378,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$item_type = nullable_htmlentities($row['item_type']); $item_type = nullable_htmlentities($row['item_type']);
$item_related_id = intval($row['item_related_id']); $item_related_id = intval($row['item_related_id']);
$item_note = nullable_htmlentities($row['item_note']); $item_note = nullable_htmlentities($row['item_note']);
$item_recipient = nullable_htmlentities($row['item_recipient']);
$item_views = nullable_htmlentities($row['item_views']); $item_views = nullable_htmlentities($row['item_views']);
$item_view_limit = nullable_htmlentities($row['item_view_limit']); $item_view_limit = nullable_htmlentities($row['item_view_limit']);
$item_created_at = nullable_htmlentities($row['item_created_at']); $item_created_at = nullable_htmlentities($row['item_created_at']);
@@ -280,10 +403,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</td> </td>
<td><?php echo $document_updated_at; ?></td> <td><?php echo $document_updated_at; ?></td>
<td> <td>
<?php if($item_id) { ?> <?php if (mysqli_num_rows($sql_shared) > 0) { ?>
<div title="Expires <?php echo $item_expire_at_human; ?>"> <div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
<i class="fas fa-fw fa-link"></i> Shared <i class="fas fa-link mr-2 mt-1"></i>
</div> <div class="media-body">Shared
<br>
<small class="text-secondary"><?php echo $item_recipient; ?></small>
</div>
</div>
<?php } ?> <?php } ?>
</td> </td>
<td> <td>
+1 -1
View File
@@ -26,7 +26,7 @@
<hr> <hr>
<div class="tab-content"> <div class="tab-content" <?php if (lookupUserPermission('module_support') <= 1) { echo 'inert'; } ?>>
<div class="tab-pane fade show active" id="pills-overview"> <div class="tab-pane fade show active" id="pills-overview">
+32 -6
View File
@@ -6,6 +6,8 @@ $order = "ASC";
require_once "inc_all_client.php"; require_once "inc_all_client.php";
// Perms
enforceUserPermission('module_support');
//Rebuild URL //Rebuild URL
$url_query_strings_sort = http_build_query($get_copy); $url_query_strings_sort = http_build_query($get_copy);
@@ -109,12 +111,36 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=domain_name&order=<?php echo $disp; ?>">Domain</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=registrar_name&order=<?php echo $disp; ?>">Registrar</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=domain_name&order=<?php echo $disp; ?>">
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=webhost_name&order=<?php echo $disp; ?>">Web Host</a></th> Domain <?php if ($sort == 'domain_name') { echo $order_icon; } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=dnshost_name&order=<?php echo $disp; ?>">DNS Host</a></th> </a>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=mailhost_name&order=<?php echo $disp; ?>">Mail Host</a></th> </th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=domain_expire&order=<?php echo $disp; ?>">Expires</a></th> <th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=registrar_name&order=<?php echo $disp; ?>">
Registrar <?php if ($sort == 'registrar_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=webhost_name&order=<?php echo $disp; ?>">
Web Host <?php if ($sort == 'webhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=dnshost_name&order=<?php echo $disp; ?>">
DNS Host <?php if ($sort == 'dnshost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=mailhost_name&order=<?php echo $disp; ?>">
Mail Host <?php if ($sort == 'mailhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=domain_expire&order=<?php echo $disp; ?>">
Expires <?php if ($sort == 'domain_expire') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
+34 -40
View File
@@ -2,7 +2,7 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content bg-dark"> <div class="modal-content bg-dark">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing: <strong> <h5 class="modal-title"><i class="fa fa-fw fa-user-edit mr-2"></i>Editing Client: <strong>
<?php echo $client_name; ?> <?php echo $client_name; ?>
</strong></h5> </strong></h5>
<button type="button" class="close text-white" data-dismiss="modal"> <button type="button" class="close text-white" data-dismiss="modal">
@@ -30,7 +30,7 @@
</li> </li>
<?php } ?> <?php } ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-client-more<?php echo $client_id; ?>">More</a> <a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
</li> </li>
</ul> </ul>
@@ -41,13 +41,28 @@
<div class="tab-pane fade show active" id="pills-client-details<?php echo $client_id; ?>"> <div class="tab-pane fade show active" id="pills-client-details<?php echo $client_id; ?>">
<div class="form-group"> <div class="form-group">
<label>Name <strong class="text-danger">*</strong></label> <label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Is Lead</span></label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div> </div>
<input type="text" class="form-control" name="name" placeholder="Name or Company" <input type="text" class="form-control" name="name" placeholder="Name or Company"
value="<?php echo $client_name; ?>" required> value="<?php echo $client_name; ?>" required>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="lead" value="1" <?php if($client_is_lead == 1){ echo "checked"; } ?>>
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Shortened Name</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Shortned name for client - Max chars 6" value="<?php echo $client_abbreviation; ?>" maxlength="6" oninput="this.value = this.value.toUpperCase()">
</div> </div>
</div> </div>
@@ -101,13 +116,23 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Is Lead <strong class="text-danger">*</strong></label> <label>Tags</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<input type="checkbox" name="lead" value="1"<?php if ($client_is_lead == 1) { <span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
echo "checked";
} ?>>
</div> </div>
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
<?php
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = intval($row['tag_id']);
$tag_name_select = nullable_htmlentities($row['tag_name']);
?>
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
<?php } ?>
</select>
</div> </div>
</div> </div>
@@ -182,44 +207,13 @@
<?php } ?> <?php } ?>
<div class="tab-pane fade" id="pills-client-more<?php echo $client_id; ?>"> <div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
<div class="form-group"> <div class="form-group">
<label>Abbreviation</label> <textarea class="form-control" rows="10" placeholder="Enter some notes"
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
</div>
<input type="text" class="form-control" name="abbreviation" placeholder="Abbreviated name for client" value="<?php echo $client_abbreviation; ?>" maxlength="6" oninput="this.value = this.value.toUpperCase()">
</div>
</div>
<div class="form-group">
<textarea class="form-control" rows="8" placeholder="Enter some notes"
name="notes"><?php echo $client_notes; ?></textarea> name="notes"><?php echo $client_notes; ?></textarea>
</div> </div>
<div class="form-group">
<label>Tags</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
</div>
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
<?php
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = intval($row['tag_id']);
$tag_name_select = nullable_htmlentities($row['tag_name']);
?>
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
<?php } ?>
</select>
</div>
</div>
</div> </div>
</div> </div>
+5 -7
View File
@@ -9,8 +9,6 @@ if (isset($_GET['calendar_id'])) {
?> ?>
<link href='plugins/fullcalendar-6.1.10/dist/index.global.js' rel='stylesheet' />
<!-- So that when hovering over a created event it turns into a hand instead of cursor --> <!-- So that when hovering over a created event it turns into a hand instead of cursor -->
<style> <style>
.fc-event { .fc-event {
@@ -49,7 +47,7 @@ while ($row = mysqli_fetch_array($sql)) {
?> ?>
<script src='plugins/fullcalendar-6.1.10/dist/index.global.js'></script> <script src='plugins/fullcalendar/dist/index.global.js'></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@@ -133,7 +131,7 @@ while ($row = mysqli_fetch_array($sql)) {
$event_start = json_encode($row['invoice_date']); $event_start = json_encode($row['invoice_date']);
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'blue', url: 'invoice.php?invoice_id=$event_id' },"; echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'blue', url: 'invoice.php?client_id=$client_id&invoice_id=$event_id' },";
} }
//Quotes Created //Quotes Created
@@ -143,7 +141,7 @@ while ($row = mysqli_fetch_array($sql)) {
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']); $event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
$event_start = json_encode($row['quote_date']); $event_start = json_encode($row['quote_date']);
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'purple', url: 'quote.php?quote_id=$event_id' },"; echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'purple', url: 'quote.php?client_id=$client_id&quote_id=$event_id' },";
} }
//Tickets Created //Tickets Created
@@ -177,7 +175,7 @@ while ($row = mysqli_fetch_array($sql)) {
$event_color = "black"; $event_color = "black";
} }
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },"; echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?client_id=$client_id&ticket_id=$event_id' },";
} }
// Recurring Tickets // Recurring Tickets
@@ -235,7 +233,7 @@ while ($row = mysqli_fetch_array($sql)) {
$event_start = json_encode($row['ticket_schedule']); $event_start = json_encode($row['ticket_schedule']);
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },"; echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?client_id=$client_id&ticket_id=$event_id' },";
} }
?> ?>
], ],
+61 -10
View File
@@ -15,18 +15,69 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<select class="form-control" name="bulk_folder_id"> <select class="form-control select2" name="bulk_folder_id">
<option value="0">/</option> <option value="0">/</option>
<?php
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC");
while ($row = mysqli_fetch_array($sql_folders_select)) {
$folder_id_select = intval($row['folder_id']);
$folder_name_select = nullable_htmlentities($row['folder_name']);
?>
<option value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
<?php <?php
} // Fetch all folders for the client
?> $sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
$folders = array();
// Build an associative array of folders indexed by folder_id
while ($row = mysqli_fetch_assoc($sql_all_folders)) {
$folders[$row['folder_id']] = array(
'folder_id' => intval($row['folder_id']),
'folder_name' => nullable_htmlentities($row['folder_name']),
'parent_folder' => intval($row['parent_folder']),
'children' => array()
);
}
// Build the folder hierarchy
foreach ($folders as $id => &$folder) {
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
$folders[$folder['parent_folder']]['children'][] = &$folder;
}
}
unset($folder); // Break the reference
// Prepare a list of root folders
$root_folders = array();
foreach ($folders as $id => $folder) {
if ($folder['parent_folder'] == 0) {
$root_folders[] = $folder;
}
}
// Display the folder options iteratively
$stack = array();
foreach (array_reverse($root_folders) as $folder) {
$stack[] = array('folder' => $folder, 'level' => 0);
}
while (!empty($stack)) {
$node = array_pop($stack);
$folder = $node['folder'];
$level = $node['level'];
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $level * 4);
// Check if this folder is selected
$selected = '';
if ($folder['folder_id'] == $get_folder_id) {
$selected = 'selected';
}
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
// Add children to the stack
if (!empty($folder['children'])) {
foreach (array_reverse($folder['children']) as $child_folder) {
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
}
}
}
?>
</select> </select>
</div> </div>
</div> </div>
-1
View File
@@ -8,7 +8,6 @@
</button> </button>
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>"> <input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
+59 -9
View File
@@ -9,7 +9,6 @@
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>"> <input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<div class="form-group"> <div class="form-group">
@@ -18,16 +17,67 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<select class="form-control" name="folder_id"> <select class="form-control select2" name="folder_id">
<option value="0">/</option> <option value="0">/</option>
<?php <?php
$sql_folders_select = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Fetch all folders for the client
while ($row = mysqli_fetch_array($sql_folders_select)) { $sql_all_folders = mysqli_query($mysqli, "SELECT folder_id, folder_name, parent_folder FROM folders WHERE folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
$folder_id_select = intval($row['folder_id']); $folders = array();
$folder_name_select = nullable_htmlentities($row['folder_name']);
?> // Build an associative array of folders indexed by folder_id
<option <?php if ($folder_id_select == $get_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option> while ($row = mysqli_fetch_assoc($sql_all_folders)) {
<?php $folders[$row['folder_id']] = array(
'folder_id' => intval($row['folder_id']),
'folder_name' => nullable_htmlentities($row['folder_name']),
'parent_folder' => intval($row['parent_folder']),
'children' => array()
);
}
// Build the folder hierarchy
foreach ($folders as $id => &$folder) {
if ($folder['parent_folder'] != 0 && isset($folders[$folder['parent_folder']])) {
$folders[$folder['parent_folder']]['children'][] = &$folder;
}
}
unset($folder); // Break the reference
// Prepare a list of root folders
$root_folders = array();
foreach ($folders as $id => $folder) {
if ($folder['parent_folder'] == 0) {
$root_folders[] = $folder;
}
}
// Display the folder options iteratively
$stack = array();
foreach (array_reverse($root_folders) as $folder) {
$stack[] = array('folder' => $folder, 'level' => 0);
}
while (!empty($stack)) {
$node = array_pop($stack);
$folder = $node['folder'];
$level = $node['level'];
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $level * 4);
// Check if this folder is selected
$selected = '';
if ($folder['folder_id'] == $file_folder_id) {
$selected = 'selected';
}
echo "<option value=\"{$folder['folder_id']}\" $selected>$indentation{$folder['folder_name']}</option>";
// Add children to the stack
if (!empty($folder['children'])) {
foreach (array_reverse($folder['children']) as $child_folder) {
$stack[] = array('folder' => $child_folder, 'level' => $level + 1);
}
}
} }
?> ?>
</select> </select>
+5 -3
View File
@@ -9,18 +9,20 @@
</div> </div>
<form action="post.php" method="post" autocomplete="off"> <form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="file_id" value="<?php echo $file_id; ?>"> <input type="hidden" name="file_id" value="<?php echo $file_id; ?>">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white"> <div class="modal-body bg-white">
<div class="form-group"> <div class="form-group">
<label>Name <strong class="text-danger">*</strong></label> <label>File Name <strong class="text-danger">*</strong></label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<input type="text" class="form-control" name="file_name" placeholder="File Name" value="<?php echo $file_name; ?>" required> <input type="text" class="form-control" name="file_name" placeholder="File Name" value="<?php echo $file_name; ?>" required>
</div> </div>
<label>Description <strong class="text-danger">*</strong></label> </div>
<div class="form-group">
<label>Description</label>
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
+26 -9
View File
@@ -28,20 +28,37 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span> <span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>
</div> </div>
<select class="form-control" name="folder_id"> <select class="form-control select2" name="folder_id">
<option value="0">/</option> <option value="0">/</option>
<?php <?php
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Recursive function to display folder options
while ($row = mysqli_fetch_array($sql_folders)) { function display_folder_options($parent_folder_id, $client_id, $indent = 0) {
$folder_id = intval($row['folder_id']); global $mysqli;
$folder_name = nullable_htmlentities($row['folder_name']);
?> $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
<option <?php if (isset($_GET['folder_id']) && $_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option> while ($row = mysqli_fetch_array($sql_folders)) {
<?php $folder_id = intval($row['folder_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
// Indentation for subfolders
$indentation = str_repeat('&nbsp;', $indent * 4);
// Check if this folder is selected
$selected = '';
if ((isset($_GET['folder_id']) && $_GET['folder_id'] == $folder_id) || (isset($_POST['folder']) && $_POST['folder'] == $folder_id)) {
$selected = 'selected';
}
echo "<option value=\"$folder_id\" $selected>$indentation$folder_name</option>";
// Recursively display subfolders
display_folder_options($folder_id, $client_id, $indent + 1);
}
} }
?>
// Start displaying folder options from the root (parent_folder = 0)
display_folder_options(0, $client_id);
?>
</select> </select>
</div> </div>
</div> </div>
+202 -56
View File
@@ -43,8 +43,8 @@ if ($get_folder_id == 0 && isset($_GET["q"])) {
$sql = mysqli_query( $sql = mysqli_query(
$mysqli, $mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM files "SELECT SQL_CALC_FOUND_ROWS * FROM files
LEFT JOIN users ON file_created_by = user_id
WHERE file_client_id = $client_id WHERE file_client_id = $client_id
AND file_archived_at IS NULL AND file_archived_at IS NULL
AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%') AND (file_name LIKE '%$q%' OR file_ext LIKE '%$q%' OR file_description LIKE '%$q%')
$query_images $query_images
@@ -54,6 +54,7 @@ if ($get_folder_id == 0 && isset($_GET["q"])) {
$sql = mysqli_query( $sql = mysqli_query(
$mysqli, $mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM files "SELECT SQL_CALC_FOUND_ROWS * FROM files
LEFT JOIN users ON file_created_by = user_id
WHERE file_client_id = $client_id WHERE file_client_id = $client_id
AND file_folder_id = $folder_id AND file_folder_id = $folder_id
AND file_archived_at IS NULL AND file_archived_at IS NULL
@@ -67,6 +68,28 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$num_of_files = mysqli_num_rows($sql); $num_of_files = mysqli_num_rows($sql);
// Breadcrumbs
// Build the full folder path
$folder_id = $get_folder_id;
$folder_path = array();
while ($folder_id > 0) {
$sql_folder = mysqli_query($mysqli, "SELECT folder_name, parent_folder FROM folders WHERE folder_id = $folder_id");
if ($row_folder = mysqli_fetch_assoc($sql_folder)) {
$folder_name = nullable_htmlentities($row_folder['folder_name']);
$parent_folder = intval($row_folder['parent_folder']);
// Prepend the folder to the beginning of the array
array_unshift($folder_path, array('folder_id' => $folder_id, 'folder_name' => $folder_name));
// Move up to the parent folder
$folder_id = $parent_folder;
} else {
// If the folder is not found, break the loop
break;
}
}
?> ?>
<div class="card card-dark"> <div class="card card-dark">
@@ -77,12 +100,12 @@ $num_of_files = mysqli_num_rows($sql);
<div class="card-tools"> <div class="card-tools">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadFilesModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadFilesModal">
<i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload <i class="fas fa-fw fa-cloud-upload-alt mr-2"></i>Upload File
</button> </button>
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button> <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal"> <a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createFolderModal">
<i class="fa fa-fw fa-folder-plus mr-2"></i>Create Folder <i class="fa fa-fw fa-folder-plus mr-2"></i>New Folder
</a> </a>
</div> </div>
</div> </div>
@@ -99,62 +122,118 @@ $num_of_files = mysqli_num_rows($sql);
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a> <a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
</li> </li>
<?php <?php
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE folder_location = $folder_location AND folder_client_id = $client_id ORDER BY folder_name ASC"); // Function to check if a folder is an ancestor of the current folder
while ($row = mysqli_fetch_array($sql_folders)) { function is_ancestor_folder($folder_id, $current_folder_id, $client_id) {
$folder_id = intval($row['folder_id']); global $mysqli;
$folder_name = nullable_htmlentities($row['folder_name']);
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_archived_at IS NULL AND file_folder_id = $folder_id")); // Base case: if current_folder_id is 0 or equal to folder_id
$num_files = intval($row['num']); if ($current_folder_id == 0) {
return false;
}
if ($current_folder_id == $folder_id) {
return true;
}
?> // Get the parent folder of the current folder
$result = mysqli_query($mysqli, "SELECT parent_folder FROM folders WHERE folder_id = $current_folder_id AND folder_client_id = $client_id");
if ($row = mysqli_fetch_assoc($result)) {
$parent_folder_id = intval($row['parent_folder']);
// Recursive call to check the parent folder
return is_ancestor_folder($folder_id, $parent_folder_id, $client_id);
} else {
// Folder not found
return false;
}
}
<li class="nav-item"> // Recursive function to display folders and subfolders
<div class="row"> function display_folders($parent_folder_id, $client_id, $indent = 0) {
<div class="col-10"> global $mysqli, $get_folder_id, $session_user_role;
<a class="nav-link <?php if ($get_folder_id == $folder_id) { echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>&view=<?php echo $view; ?>">
<?php
if ($get_folder_id == $folder_id) { ?>
<i class="fas fa-fw fa-folder-open"></i>
<?php } else { ?>
<i class="fas fa-fw fa-folder"></i>
<?php } ?>
<?php echo $folder_name; ?> <?php if ($num_files > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_files</span>"; } ?> $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC");
while ($row = mysqli_fetch_array($sql_folders)) {
$folder_id = intval($row['folder_id']);
$folder_name = nullable_htmlentities($row['folder_name']);
// Get the number of files in the folder
$row2 = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('file_id') AS num FROM files WHERE file_folder_id = $folder_id AND file_archived_at IS NULL"));
$num_files = intval($row2['num']);
// Get the number of subfolders
$subfolder_result = mysqli_query($mysqli, "SELECT COUNT(*) AS count FROM folders WHERE parent_folder = $folder_id AND folder_client_id = $client_id");
$subfolder_count = intval(mysqli_fetch_assoc($subfolder_result)['count']);
echo '<li class="nav-item">';
echo '<div class="row">';
echo '<div class="col-10">';
echo '<a class="nav-link ';
if ($get_folder_id == $folder_id) { echo "active"; }
echo '" href="?client_id=' . $client_id . '&folder_id=' . $folder_id . '">';
// Indentation for subfolders
echo str_repeat('&nbsp;', $indent * 4);
// Determine if the folder is open
if ($get_folder_id == $folder_id || is_ancestor_folder($folder_id, $get_folder_id, $client_id)) {
echo '<i class="fas fa-fw fa-folder-open"></i>';
} else {
echo '<i class="fas fa-fw fa-folder"></i>';
}
echo ' ' . $folder_name;
if ($num_files > 0) {
echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_files</span>";
}
echo '</a>';
echo '</div>';
echo '<div class="col-2">';
?>
<div class="dropdown">
<button class="btn btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Rename
</a> </a>
</div> <?php
<div class="col-2"> // Only show delete option if user is admin, folder has no files, and no subfolders
<div class="dropdown"> if ($session_user_role == 3 && $num_files == 0 && $subfolder_count == 0) { ?>
<button class="btn btn-sm" type="button" data-toggle="dropdown"> <div class="dropdown-divider"></div>
<i class="fas fa-ellipsis-v"></i> <a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
</button> <i class="fas fa-fw fa-trash mr-2"></i>Delete
<div class="dropdown-menu"> </a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>"> <?php } ?>
<i class="fas fa-fw fa-edit mr-2"></i>Rename
</a>
<?php if ($session_user_role == 3 && $num_files == 0) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_folder=<?php echo $folder_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</div> </div>
</div> </div>
</li> <?php
echo '</div>';
echo '</div>';
<?php // Include the rename and create subfolder modals
require "folder_rename_modal.php"; require "folder_rename_modal.php";
if ($subfolder_count > 0) {
// Display subfolders
echo '<ul class="nav nav-pills flex-column bg-light">';
display_folders($folder_id, $client_id, $indent + 1);
echo '</ul>';
}
echo '</li>';
}
} }
// Start displaying folders from the root (parent_folder = 0)
display_folders(0, $client_id);
?> ?>
</ul> </ul>
<?php require_once "folder_create_modal.php"; <?php require_once "folder_create_modal.php"; ?>
?>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<form autocomplete="off"> <form autocomplete="off">
@@ -162,15 +241,15 @@ $num_of_files = mysqli_num_rows($sql);
<input type="hidden" name="view" value="<?php echo $view; ?>"> <input type="hidden" name="view" value="<?php echo $view; ?>">
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>"> <input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-5">
<div class="input-group mb-3 mb-md-0"> <div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Files"> <input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search for files in <?php if($get_folder_id == 0) { echo "all folders"; } else { echo "current folder"; } ?>">
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button> <button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-8"> <div class="col-md-7">
<div class="btn-group float-right"> <div class="btn-group float-right">
<a href="?<?php echo $url_query_strings_sort; ?>&view=0" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a> <a href="?<?php echo $url_query_strings_sort; ?>&view=0" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a>
<a href="?<?php echo $url_query_strings_sort; ?>&view=1" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a> <a href="?<?php echo $url_query_strings_sort; ?>&view=1" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a>
@@ -183,6 +262,11 @@ $num_of_files = mysqli_num_rows($sql);
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveFilesModal"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkMoveFilesModal">
<i class="fas fa-fw fa-exchange-alt mr-2"></i>Move <i class="fas fa-fw fa-exchange-alt mr-2"></i>Move
</a> </a>
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger text-bold"
type="submit" form="bulkActions" name="bulk_delete_files">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</button>
</div> </div>
</div> </div>
@@ -191,6 +275,31 @@ $num_of_files = mysqli_num_rows($sql);
</div> </div>
</form> </form>
<nav class="mt-3">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="?client_id=<?php echo $client_id; ?>&folder_id=0">
<i class="fas fa-fw fa-folder mr-2"></i>Root
</a>
</li>
<?php
// Output breadcrumb items for each folder in the path
foreach ($folder_path as $folder) {
$bread_crumb_folder_id = $folder['folder_id']; // Already Sanitized before it was pushed into array
$bread_crumb_folder_name = $folder['folder_name']; // Already Sanitized before it was pushed into array
?>
<li class="breadcrumb-item">
<a href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $bread_crumb_folder_id; ?>">
<i class="fas fa-fw fa-folder-open mr-2"></i><?php echo $bread_crumb_folder_name; ?>
</a>
</li>
<?php
}
?>
</ol>
</nav>
<hr> <hr>
<?php <?php
@@ -211,6 +320,10 @@ $num_of_files = mysqli_num_rows($sql);
$file_name = nullable_htmlentities($row['file_name']); $file_name = nullable_htmlentities($row['file_name']);
$file_reference_name = nullable_htmlentities($row['file_reference_name']); $file_reference_name = nullable_htmlentities($row['file_reference_name']);
$file_ext = nullable_htmlentities($row['file_ext']); $file_ext = nullable_htmlentities($row['file_ext']);
$file_size = intval($row['file_size']);
$file_size_KB = number_format($file_size / 1024);
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
$file_uploaded_by = nullable_htmlentities($row['user_name']);
?> ?>
@@ -255,8 +368,26 @@ $num_of_files = mysqli_num_rows($sql);
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)"> <input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div> </div>
</td> </td>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_name&order=<?php echo $disp; ?>">Name</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_created_at&order=<?php echo $disp; ?>">Uploaded</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_name&order=<?php echo $disp; ?>">
Name <?php if ($sort == 'file_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_mime_type&order=<?php echo $disp; ?>">
Type <?php if ($sort == 'file_mime_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_size&order=<?php echo $disp; ?>">
Size <?php if ($sort == 'file_size') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=file_created_at&order=<?php echo $disp; ?>">
Uploaded <?php if ($sort == 'file_created_at') { echo $order_icon; } ?>
</a>
</th>
<th></th> <th></th>
<th class="text-center">Action</th> <th class="text-center">Action</th>
</tr> </tr>
@@ -294,7 +425,12 @@ $num_of_files = mysqli_num_rows($sql);
} else { } else {
$file_icon = "file"; $file_icon = "file";
} }
$file_size = intval($row['file_size']);
$file_size_KB = number_format($file_size / 1024);
$file_mime_type = nullable_htmlentities($row['file_mime_type']);
$file_uploaded_by = nullable_htmlentities($row['user_name']);
$file_created_at = nullable_htmlentities($row['file_created_at']); $file_created_at = nullable_htmlentities($row['file_created_at']);
$file_folder_id = intval($row['file_folder_id']);
// Check if shared // Check if shared
$sql_shared = mysqli_query( $sql_shared = mysqli_query(
@@ -315,6 +451,7 @@ $num_of_files = mysqli_num_rows($sql);
$item_type = nullable_htmlentities($row['item_type']); $item_type = nullable_htmlentities($row['item_type']);
$item_related_id = intval($row['item_related_id']); $item_related_id = intval($row['item_related_id']);
$item_note = nullable_htmlentities($row['item_note']); $item_note = nullable_htmlentities($row['item_note']);
$item_recipient = nullable_htmlentities($row['item_recipient']);
$item_views = nullable_htmlentities($row['item_views']); $item_views = nullable_htmlentities($row['item_views']);
$item_view_limit = nullable_htmlentities($row['item_view_limit']); $item_view_limit = nullable_htmlentities($row['item_view_limit']);
$item_created_at = nullable_htmlentities($row['item_created_at']); $item_created_at = nullable_htmlentities($row['item_created_at']);
@@ -330,9 +467,9 @@ $num_of_files = mysqli_num_rows($sql);
</div> </div>
</td> </td>
<td> <td>
<a href="<?php echo "uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank" class="text-secondary"> <a href="<?php echo "uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank">
<div class="media"> <div class="media">
<i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> mr-3"></i> <i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> text-dark mr-3"></i>
<div class="media-body"> <div class="media-body">
<p> <p>
<?php echo basename($file_name); ?> <?php echo basename($file_name); ?>
@@ -343,12 +480,21 @@ $num_of_files = mysqli_num_rows($sql);
</div> </div>
</a> </a>
</td> </td>
<td><?php echo $file_created_at; ?></td> <td><?php echo $file_mime_type; ?></td>
<td><?php echo $file_size_KB; ?> KB</td>
<td> <td>
<?php if($item_id) { ?> <?php echo $file_created_at; ?>
<div title="Expires <?php echo $item_expire_at_human; ?>"> <div class="text-secondary mt-1"><?php echo $file_uploaded_by; ?></div>
<i class="fas fa-fw fa-link"></i> Shared </td>
</div> <td>
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
<div class="media" title="Expires <?php echo $item_expire_at_human; ?>">
<i class="fas fa-link mr-2 mt-1"></i>
<div class="media-body">Shared
<br>
<small class="text-secondary"><?php echo $item_recipient; ?></small>
</div>
</div>
<?php } ?> <?php } ?>
</td> </td>
<td> <td>
+46 -17
View File
@@ -6,6 +6,8 @@ $order = "DESC";
require_once "inc_all_client.php"; require_once "inc_all_client.php";
// Perms
enforceUserPermission('module_sales');
//Rebuild URL //Rebuild URL
$url_query_strings_sort = http_build_query($get_copy); $url_query_strings_sort = http_build_query($get_copy);
@@ -47,9 +49,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-4"> <div class="col-md-4">
<div class="input-group mb-3 mb-md-0"> <div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { <input type="search" class="form-control" name="q"
echo stripslashes(nullable_htmlentities($q)); value="<?php if (isset($q)) {echo stripslashes(nullable_htmlentities($q)); } ?>"
} ?>" placeholder="Search Invoices"> placeholder="Search Invoices"
>
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button> <button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div> </div>
@@ -71,19 +74,45 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<hr> <hr>
<div class="table-responsive-sm"> <div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover"> <table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { <thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
echo "d-none"; <tr>
} ?>"> <th>
<tr> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_number&order=<?php echo $disp; ?>">
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_number&order=<?php echo $disp; ?>">Number</a></th> Number <?php if ($sort == 'invoice_number') { echo $order_icon; } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_scope&order=<?php echo $disp; ?>">Scope</a></th> </a>
<th class="text-right"><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_amount&order=<?php echo $disp; ?>">Amount</a></th> </th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_date&order=<?php echo $disp; ?>">Date</a></th> <th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_due&order=<?php echo $disp; ?>">Due</a></th> <a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_scope&order=<?php echo $disp; ?>">
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=category_name&order=<?php echo $disp; ?>">Category</a></th> Scope <?php if ($sort == 'invoice_scope') { echo $order_icon; } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_status&order=<?php echo $disp; ?>">Status</a></th> </a>
<th class="text-center">Action</th> </th>
</tr> <th class="text-right">
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_amount&order=<?php echo $disp; ?>">
Amount <?php if ($sort == 'invoice_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_date&order=<?php echo $disp; ?>">
Date <?php if ($sort == 'invoice_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_due&order=<?php echo $disp; ?>">
Due <?php if ($sort == 'invoice_due') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=category_name&order=<?php echo $disp; ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=invoice_status&order=<?php echo $disp; ?>">
Status <?php if ($sort == 'invoice_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
@@ -132,7 +161,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?> ?>
<tr> <tr>
<td class="text-bold"><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td> <td class="text-bold"><a href="invoice.php?client_id=<?php echo $client_id; ?>&invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
<td><?php echo $invoice_scope_display; ?></td> <td><?php echo $invoice_scope_display; ?></td>
<td class="text-bold text-right"><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td> <td class="text-bold text-right"><?php echo numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code); ?></td>
<td><?php echo $invoice_date; ?></td> <td><?php echo $invoice_date; ?></td>

Some files were not shown because too many files have changed in this diff Show More