mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
Added Document Template Listing, editing, deletion, move scheduled tickets into tickets
This commit is contained in:
32
client_document_template_add_modal.php
Normal file
32
client_document_template_add_modal.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<div class="modal" id="addDocumentTemplateModal" tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-xl">
|
||||||
|
<div class="modal-content bg-dark">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt"></i> New Document Template</h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="name" placeholder="Template name" required autofocus>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control summernote" name="content"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" name="add_document_template" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Create</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
63
client_document_template_details.php
Normal file
63
client_document_template_details.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php include("inc_all_client.php"); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($_GET['document_id'])){
|
||||||
|
$document_id = intval($_GET['document_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql_document = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_template = 1 AND document_id = $document_id AND documents.company_id = $session_company_id");
|
||||||
|
|
||||||
|
$row = mysqli_fetch_array($sql_document);
|
||||||
|
|
||||||
|
$document_name = htmlentities($row['document_name']);
|
||||||
|
$document_content = $row['document_content'];
|
||||||
|
$document_created_at = $row['document_created_at'];
|
||||||
|
$document_updated_at = $row['document_updated_at'];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<ol class="breadcrumb d-print-none">
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="invoices.php">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="clients.php">Clients</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item">
|
||||||
|
<a href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active"><i class="fas fa-file"></i> <?php echo "$document_name"; ?></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card card-dark">
|
||||||
|
<div class="card-header">
|
||||||
|
|
||||||
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file"></i> <?php echo $document_name; ?></h3>
|
||||||
|
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>"><i class="fas fa-edit"></i> Edit</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#editDocumentModal"><i class="fas fa-copy"></i> Copy</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php echo $document_content; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("client_document_template_edit_modal.php");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php include("footer.php"); ?>
|
||||||
30
client_document_template_edit_modal.php
Normal file
30
client_document_template_edit_modal.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<div class="modal" id="editDocumentTemplateModal<?php echo $document_id; ?>" tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-xl">
|
||||||
|
<div class="modal-content bg-dark">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title"><i class="fa fa-fw fa-file-alt"></i> Editing template: <strong><?php echo $document_name; ?></strong></h5>
|
||||||
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
|
<span>×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||||
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" name="name" value="<?php echo $document_name; ?>" placeholder="Name" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea class="form-control summernote" name="content"><?php echo $document_content; ?></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-white">
|
||||||
|
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="submit" name="edit_document_template" class="btn btn-primary text-bold"><i class="fa fa-check"></i> Save</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
130
client_document_templates.php
Normal file
130
client_document_templates.php
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<?php include("inc_all_client.php"); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Sort by
|
||||||
|
if(!empty($_GET['sb'])){
|
||||||
|
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
|
||||||
|
}else{
|
||||||
|
$sb = "document_name";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||||
|
WHERE document_template = 1
|
||||||
|
AND documents.company_id = $session_company_id
|
||||||
|
$query_snippet
|
||||||
|
ORDER BY $sb $o 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"></i> Document Templates</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
|
||||||
|
</div>
|
||||||
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDocumentTemplateModal">
|
||||||
|
<i class="fas fa-fw fa-plus"></i> New Template
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form autocomplete="off">
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo intval($client_id); ?>">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){ echo strip_tags(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">
|
||||||
|
<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_sb; ?>&sb=document_name&o=<?php echo $disp; ?>">Template Name</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_created_at&o=<?php echo $disp; ?>">Created</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_updated_at&o=<?php echo $disp; ?>">Updated</a>
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
Action
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
while($row = mysqli_fetch_array($sql)){
|
||||||
|
$document_id = $row['document_id'];
|
||||||
|
$document_name = htmlentities($row['document_name']);
|
||||||
|
$document_content = $row['document_content'];
|
||||||
|
$document_created_at = $row['document_created_at'];
|
||||||
|
$document_updated_at = $row['document_updated_at'];
|
||||||
|
$document_folder_id = $row['document_folder_id'];
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="client_document_template_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><i class="fas fa-fw fa-file-alt"></i> <?php echo $document_name; ?></a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $document_created_at; ?></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; ?>">Edit</a>
|
||||||
|
<?php if($session_user_role == 3) { ?>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item text-danger" href="post.php?delete_document=<?php echo $document_id; ?>">Delete</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("client_document_template_edit_modal.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<?php include("pagination.php"); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php include("client_document_template_add_modal.php"); ?>
|
||||||
|
|
||||||
|
<?php include("footer.php"); ?>
|
||||||
@@ -47,7 +47,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<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"><i class="fa fa-fw fa-file-alt"></i> Documents</h3>
|
<h3 class="card-title mt-2">
|
||||||
|
<i class="fa fa-fw fa-file-alt"></i> Documents
|
||||||
|
</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="client_document_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
|
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
<div class="card card-dark">
|
<div class="card card-dark">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-sync"></i> Scheduled Tickets</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-sync"></i> Scheduled Tickets</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="client_tickets.php?client_id=<?php echo $client_id; ?>">Tickets</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<?php if($config_module_enable_ticketing == 1){ ?>
|
<?php if($config_module_enable_ticketing == 1){ ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_tickets.php") { echo "active"; } ?>">
|
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_tickets.php" || basename($_SERVER["PHP_SELF"]) == "client_scheduled_tickets.php" ) { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-life-ring"></i>
|
<i class="nav-icon fas fa-life-ring"></i>
|
||||||
<p>
|
<p>
|
||||||
Tickets
|
Tickets
|
||||||
@@ -314,15 +314,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php if($config_module_enable_ticketing == 1){ ?>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="client_scheduled_tickets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_scheduled_tickets.php") { echo "active"; } ?>">
|
|
||||||
<i class="nav-icon fas fa-sync"></i>
|
|
||||||
<p>Scheduled Tickets</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="client_logs.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_logs.php") { echo "active"; } ?>">
|
<a href="client_logs.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_logs.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-eye"></i>
|
<i class="nav-icon fas fa-eye"></i>
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
<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"><i class="fa fa-fw fa-life-ring"></i> Tickets</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring"></i> Tickets</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="client_scheduled_tickets.php?client_id=<?php echo $client_id; ?>">Scheduled Tickets</a>
|
||||||
|
</div>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal"><i class="fas fa-fw fa-plus"></i> New Ticket</button>
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTicketModal"><i class="fas fa-fw fa-plus"></i> New Ticket</button>
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal"><i class="fas fa-fw fa-plus"></i> Scheduled Ticket</button>
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addScheduledTicketModal"><i class="fas fa-fw fa-plus"></i> Scheduled Ticket</button>
|
||||||
|
|||||||
@@ -33,15 +33,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<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 dropdown-toggle" data-toggle="dropdown">
|
<h3 class="card-title mt-2">
|
||||||
<i class="fa fa-fw fa-building"></i> Vendors
|
<i class="fa fa-fw fa-building"></i> Vendors
|
||||||
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item text-dark" href="#">Global Vendors</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="client_vendor_templates.php?client_id=<?php echo $client_id; ?>">Templates</a>
|
||||||
|
</div>
|
||||||
<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="#addVendorModal">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addVendorModal">
|
||||||
|
|||||||
74
post.php
74
post.php
@@ -6763,20 +6763,10 @@ if(isset($_POST['add_document'])){
|
|||||||
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
||||||
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||||
|
|
||||||
$template = intval($_POST['template']);
|
$folder = intval($_POST['folder']);
|
||||||
//Templates don't go into folders
|
|
||||||
if($template == 0){
|
|
||||||
$folder = intval($_POST['folder']);
|
|
||||||
}else{
|
|
||||||
$folder = 0;
|
|
||||||
}
|
|
||||||
//Templates don't have assigned client_ids
|
|
||||||
if($template == 1){
|
|
||||||
$client_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document add query
|
// Document add query
|
||||||
$add_document = mysqli_query($mysqli,"INSERT INTO documents SET document_name = '$name', document_content = '$content', document_content_raw = '$content_raw', document_template = $template, document_folder_id = $folder, document_client_id = $client_id, company_id = $session_company_id");
|
$add_document = mysqli_query($mysqli,"INSERT INTO documents SET document_name = '$name', document_content = '$content', document_content_raw = '$content_raw', document_template = 0, document_folder_id = $folder, document_client_id = $client_id, company_id = $session_company_id");
|
||||||
$document_id = $mysqli->insert_id;
|
$document_id = $mysqli->insert_id;
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
@@ -6788,6 +6778,35 @@ if(isset($_POST['add_document'])){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['add_document_template'])){
|
||||||
|
|
||||||
|
validateTechRole();
|
||||||
|
|
||||||
|
// HTML Purifier
|
||||||
|
require("plugins/htmlpurifier/HTMLPurifier.standalone.php");
|
||||||
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
|
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||||
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
|
$client_id = intval($_POST['client_id']);
|
||||||
|
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||||
|
$content = trim(mysqli_real_escape_string($mysqli,$purifier->purify(html_entity_decode($_POST['content']))));
|
||||||
|
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
||||||
|
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||||
|
|
||||||
|
// Document add query
|
||||||
|
$add_document = mysqli_query($mysqli,"INSERT INTO documents SET document_name = '$name', document_content = '$content', document_content_raw = '$content_raw', document_template = 1, document_folder_id = 0, document_client_id = 0, company_id = $session_company_id");
|
||||||
|
$document_id = $mysqli->insert_id;
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document Template', log_action = 'Create', log_description = 'Created Document Template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = '$client_id', company_id = $session_company_id, log_user_id = $session_user_id");
|
||||||
|
|
||||||
|
$_SESSION['alert_message'] = "Document Template created";
|
||||||
|
|
||||||
|
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['add_document_from_template'])){
|
if(isset($_POST['add_document_from_template'])){
|
||||||
|
|
||||||
// ROLE Check
|
// ROLE Check
|
||||||
@@ -6824,7 +6843,7 @@ if(isset($_POST['add_document_from_template'])){
|
|||||||
|
|
||||||
$_SESSION['alert_message'] = "Document created from template";
|
$_SESSION['alert_message'] = "Document created from template";
|
||||||
|
|
||||||
header("Location: client_document_details.php?client_id=$client_id&folder_id=$folder_id&document_id=$document_id");
|
header("Location: client_document_template_details.php?client_id=$client_id&document_id=$document_id");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6859,6 +6878,35 @@ if(isset($_POST['edit_document'])){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['edit_document_template'])){
|
||||||
|
|
||||||
|
validateTechRole();
|
||||||
|
|
||||||
|
// HTML Purifier
|
||||||
|
require("plugins/htmlpurifier/HTMLPurifier.standalone.php");
|
||||||
|
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||||
|
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||||
|
$purifier = new HTMLPurifier($purifier_config);
|
||||||
|
|
||||||
|
$document_id = intval($_POST['document_id']);
|
||||||
|
$name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||||
|
$content = trim(mysqli_real_escape_string($mysqli,$purifier->purify(html_entity_decode($_POST['content']))));
|
||||||
|
$content_raw = trim(mysqli_real_escape_string($mysqli, strip_tags($_POST['name'] . " " . str_replace("<", " <", $_POST['content']))));
|
||||||
|
// Content Raw is used for FULL INDEX searching. Adding a space before HTML tags to allow spaces between newlines, bulletpoints, etc. for searching.
|
||||||
|
|
||||||
|
// Document edit query
|
||||||
|
mysqli_query($mysqli,"UPDATE documents SET document_name = '$name', document_content = '$content', document_content_raw = '$content_raw' WHERE document_id = $document_id AND company_id = $session_company_id");
|
||||||
|
|
||||||
|
//Logging
|
||||||
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Document Template', log_action = 'Modify', log_description = '$name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, company_id = $session_company_id");
|
||||||
|
|
||||||
|
|
||||||
|
$_SESSION['alert_message'] = "Document Template updated";
|
||||||
|
|
||||||
|
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_GET['delete_document'])){
|
if(isset($_GET['delete_document'])){
|
||||||
|
|
||||||
validateAdminRole();
|
validateAdminRole();
|
||||||
|
|||||||
@@ -81,17 +81,11 @@
|
|||||||
|
|
||||||
<li class="nav-header mt-3">SUPPORT</li>
|
<li class="nav-header mt-3">SUPPORT</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="tickets.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php") { echo "active"; } ?>">
|
<a href="tickets.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "tickets.php" || basename($_SERVER["PHP_SELF"]) == "ticket.php" || basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-life-ring"></i>
|
<i class="nav-icon fas fa-life-ring"></i>
|
||||||
<p>Tickets</p>
|
<p>Tickets</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a href="scheduled_tickets.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "scheduled_tickets.php") { echo "active"; } ?>">
|
|
||||||
<i class="nav-icon fas fa-sync"></i>
|
|
||||||
<p>Scheduled Tickets</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="calendar_events.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "calendar_events.php") { echo "active"; } ?>">
|
<a href="calendar_events.php" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "calendar_events.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-calendar"></i>
|
<i class="nav-icon fas fa-calendar"></i>
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ $user_active_assigned_tickets = $row['total_tickets_assigned'];
|
|||||||
<a href="?status=Closed"><strong><?php echo $total_tickets_closed; ?></strong> Closed</a>
|
<a href="?status=Closed"><strong><?php echo $total_tickets_closed; ?></strong> Closed</a>
|
||||||
</small>
|
</small>
|
||||||
</h3>
|
</h3>
|
||||||
|
<button type="button" class="btn btn-dark dropdown-toggle ml-1" data-toggle="dropdown"></button>
|
||||||
|
<div class="dropdown-menu">
|
||||||
|
<a class="dropdown-item text-dark" href="scheduled_tickets.php">Scheduled Tickets</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class='card-tools'>
|
<div class='card-tools'>
|
||||||
<div class="float-left">
|
<div class="float-left">
|
||||||
|
|||||||
Reference in New Issue
Block a user