Feature: You can now select/deselect entities for client Data PDF Export Closes #178

This commit is contained in:
johnnyq 2023-02-25 21:00:51 -05:00
parent 7d24a7a1a4
commit 3e255fb8ae
3 changed files with 225 additions and 23 deletions

View File

@ -0,0 +1,186 @@
<div class="modal" id="exportClientPDFModal" 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-file-pdf mr-2"></i>Export PDF</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="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white">
<ul class="list-group">
<div class="row">
<div class="col-sm-6">
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="contacts" name="export_contacts" value="1" checked>
<label for="contacts" class="custom-control-label">
<i class='fas fa-fw fa-users mr-2'></i>Contacts
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="locations" name="export_locations" value="1" checked>
<label for="locations" class="custom-control-label">
<i class='fas fa-fw fa-map-marker-alt mr-2'></i>Locations
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="assets" name="export_assets" value="1" checked>
<label for="assets" class="custom-control-label">
<i class='fas fa-fw fa-desktop mr-2'></i>Assets
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="software" name="export_software" value="1" checked>
<label for="software" class="custom-control-label">
<i class='fas fa-fw fa-cube mr-2'></i>Software / Licenses
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="logins" name="export_logins" value="1">
<label for="logins" class="custom-control-label">
<i class='fas fa-fw fa-key mr-2'></i>Logins/Passwords
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="networks" name="export_networks" value="1" checked>
<label for="networks" class="custom-control-label">
<i class='fas fa-fw fa-network-wired mr-2'></i>networks
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="certificates" name="export_certificates" value="1" checked>
<label for="certificates" class="custom-control-label">
<i class='fas fa-fw fa-lock mr-2'></i>Certificates
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="domains" name="export_domains" value="1" checked>
<label for="domains" class="custom-control-label">
<i class='fas fa-fw fa-globe mr-2'></i>Domains
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="tickets" name="export_tickets" value="1" checked>
<label for="tickets" class="custom-control-label">
<i class='fas fa-fw fa-life-ring mr-2'></i>Tickets
</label>
</div>
</li>
</div>
<div class="col-sm-6">
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="scheduled_tickets" name="export_scheduled_tickets" value="1" checked>
<label for="scheduled_tickets" class="custom-control-label">
<i class='fas fa-fw fa-clock mr-2'></i>Scheduled Tickets
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="vendors" name="export_vendors" value="1" checked>
<label for="vendors" class="custom-control-label">
<i class='fas fa-fw fa-building mr-2'></i>Vendors
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="invoices" name="export_invoices" value="1" checked>
<label for="invoices" class="custom-control-label">
<i class='fas fa-fw fa-file-invoice mr-2'></i>Invoices
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="recurring" name="export_recurring" value="1" checked>
<label for="recurring" class="custom-control-label">
<i class='fas fa-fw fa-sync mr-2'></i>Recurring Invoices
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="quotes" name="export_quotes" value="1" checked>
<label for="quotes" class="custom-control-label">
<i class='fas fa-fw fa-file mr-2'></i>Quotes
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="payments" name="export_payments" value="1" checked>
<label for="payments" class="custom-control-label">
<i class='fas fa-fw fa-credit-card mr-2'></i>Payments
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="trips" name="export_trips" value="1" checked>
<label for="trips" class="custom-control-label">
<i class='fas fa-fw fa-route mr-2'></i>Trips
</label>
</div>
</li>
<li class="list-group-item">
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" id="logs" name="export_logs" value="1" checked>
<label for="logs" class="custom-control-label">
<i class='fas fa-fw fa-eye mr-2'></i>Audit Log
</label>
</div>
</li>
</div>
</div>
</ul>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="export_client_pdf" class="btn btn-primary text-bold"><i class="fa fa-fw fa-download mr-2"></i>Export</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>

View File

@ -85,11 +85,8 @@
<i class="fas fa-fw fa-edit mr-2"></i>Edit Client
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?export_client_pdf=<?php echo $client_id; ?>" target="_blank">
<i class="fas fa-fw fa-download mr-2"></i>Export Data PDF<br><small class="text-secondary">(without passwords)</small>
</a>
<a class="dropdown-item text-danger" href="post.php?export_client_pdf=<?php echo $client_id; ?>&passwords" target="_blank">
<i class="fas fa-fw fa-download mr-2"></i>Export Data PDF<br><small class="text-secondary">(with passwords)</small>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#exportClientPDFModal">
<i class="fas fa-fw fa-file-pdf mr-2"></i>Export Data
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_client=<?php echo $client_id; ?>">
@ -110,6 +107,7 @@
<?php
require_once("client_edit_modal.php");
require_once("client_download_pdf_modal.php");
require_once("client_delete_modal.php");
require_once("category_quick_add_modal.php");

View File

@ -8140,11 +8140,29 @@ if(isset($_GET['export_client_trips_csv'])){
}
if(isset($_GET['export_client_pdf'])){
if(isset($_POST['export_client_pdf'])){
validateAdminRole();
$client_id = intval($_GET['export_client_pdf']);
$client_id = intval($_POST['client_id']);
$export_contacts = intval($_POST['export_contacts']);
$export_locations = intval($_POST['export_locations']);
$export_assets = intval($_POST['export_assets']);
$export_software = intval($_POST['export_software']);
$export_logins = intval($_POST['export_logins']);
$export_networks = intval($_POST['export_networks']);
$export_certificates = intval($_POST['export_certificates']);
$export_domains = intval($_POST['export_domains']);
$export_tickets = intval($_POST['export_tickets']);
$export_scheduled_tickets = intval($_POST['export_scheduled_tickets']);
$export_vendors = intval($_POST['export_vendors']);
$export_invoices = intval($_POST['export_invoices']);
$export_recurring = intval($_POST['export_recurring']);
$export_quotes = intval($_POST['export_quotes']);
$export_payments = intval($_POST['export_payments']);
$export_trips = intval($_POST['export_trips']);
$export_logs = intval($_POST['export_logs']);
//get records from database
$sql = mysqli_query($mysqli,"SELECT * FROM clients
@ -8272,7 +8290,7 @@ if(isset($_GET['export_client_pdf'])){
},
//Contacts Start
<?php if(mysqli_num_rows($sql_contacts) > 0){ ?>
<?php if(mysqli_num_rows($sql_contacts) > 0 && $export_contacts == 1){ ?>
{
text: 'Contacts',
style: 'title'
@ -8361,7 +8379,7 @@ if(isset($_GET['export_client_pdf'])){
//Contact END
//Locations Start
<?php if(mysqli_num_rows($sql_locations) > 0){ ?>
<?php if(mysqli_num_rows($sql_locations) > 0 && $export_locations == 1){ ?>
{
text: 'Locations',
style: 'title'
@ -8420,7 +8438,7 @@ if(isset($_GET['export_client_pdf'])){
//Locations END
//Vendors Start
<?php if(mysqli_num_rows($sql_vendors) > 0){ ?>
<?php if(mysqli_num_rows($sql_vendors) > 0 && $export_vendors == 1){ ?>
{
text: 'Vendors',
style: 'title'
@ -8497,7 +8515,7 @@ if(isset($_GET['export_client_pdf'])){
//Logins Start
<?php if(isset($_GET['passwords'])){ ?>
<?php if(mysqli_num_rows($sql_logins) > 0){ ?>
<?php if(mysqli_num_rows($sql_logins) > 0 && $export_logins == 1){ ?>
{
text: 'Logins',
style: 'title'
@ -8576,7 +8594,7 @@ if(isset($_GET['export_client_pdf'])){
//Logins END
//Assets Start
<?php if(mysqli_num_rows($sql_assets) > 0){ ?>
<?php if(mysqli_num_rows($sql_assets) > 0 && $export_assets == 1){ ?>
{
text: 'Assets',
style: 'assetTitle'
@ -8585,7 +8603,7 @@ if(isset($_GET['export_client_pdf'])){
//Assets END
//Asset Workstations Start
<?php if(mysqli_num_rows($sql_asset_workstations) > 0){ ?>
<?php if(mysqli_num_rows($sql_asset_workstations) > 0 && $export_assets == 1){ ?>
{
text: 'Workstations',
style: 'assetSubTitle'
@ -8699,7 +8717,7 @@ if(isset($_GET['export_client_pdf'])){
//Asset Workstation END
//Assets Servers Start
<?php if(mysqli_num_rows($sql_asset_servers) > 0){ ?>
<?php if(mysqli_num_rows($sql_asset_servers) > 0 && $export_assets == 1){ ?>
{
text: 'Servers',
style: 'assetSubTitle'
@ -8804,7 +8822,7 @@ if(isset($_GET['export_client_pdf'])){
//Asset Servers END
//Asset VMs Start
<?php if(mysqli_num_rows($sql_asset_vms) > 0){ ?>
<?php if(mysqli_num_rows($sql_asset_vms) > 0 && $export_assets == 1){ ?>
{
text: 'Virtual Machines',
style: 'assetSubTitle'
@ -8877,7 +8895,7 @@ if(isset($_GET['export_client_pdf'])){
//Asset VMs END
//Assets Network Devices Start
<?php if(mysqli_num_rows($sql_asset_network) > 0){ ?>
<?php if(mysqli_num_rows($sql_asset_network) > 0 && $export_assets == 1){ ?>
{
text: 'Network Devices',
style: 'assetSubTitle'
@ -8982,7 +9000,7 @@ if(isset($_GET['export_client_pdf'])){
//Asset Network Devices END
//Asset Other Start
<?php if(mysqli_num_rows($sql_asset_other) > 0){ ?>
<?php if(mysqli_num_rows($sql_asset_other) > 0 && $export_assets == 1){ ?>
{
text: 'Other Devices',
style: 'assetSubTitle'
@ -9087,7 +9105,7 @@ if(isset($_GET['export_client_pdf'])){
//Asset Other END
//Software Start
<?php if(mysqli_num_rows($sql_software) > 0){ ?>
<?php if(mysqli_num_rows($sql_software) > 0 && $export_software == 1){ ?>
{
text: 'Software',
style: 'title'
@ -9152,7 +9170,7 @@ if(isset($_GET['export_client_pdf'])){
//Software END
//Networks Start
<?php if(mysqli_num_rows($sql_networks) > 0){ ?>
<?php if(mysqli_num_rows($sql_networks) > 0 && $export_networks == 1){ ?>
{
text: 'Networks',
style: 'title'
@ -9226,7 +9244,7 @@ if(isset($_GET['export_client_pdf'])){
//Networks END
//Domains Start
<?php if(mysqli_num_rows($sql_domains) > 0){ ?>
<?php if(mysqli_num_rows($sql_domains) > 0 && $export_domains == 1){ ?>
{
text: 'Domains',
style: 'title'
@ -9273,7 +9291,7 @@ if(isset($_GET['export_client_pdf'])){
//Domains END
//Certificates Start
<?php if(mysqli_num_rows($sql_certficates) > 0){ ?>
<?php if(mysqli_num_rows($sql_certficates) > 0 && $export_certificates == 1){ ?>
{
text: 'Certificates',
style: 'title'
@ -9387,8 +9405,8 @@ if(isset($_GET['export_client_pdf'])){
<?php
if(isset($_GET['logout'])){
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Logout', log_action = 'Success', log_description = '$session_name logged out', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
mysqli_query($mysqli, "UPDATE users SET user_php_session = '' WHERE user_id = '$session_user_id'");
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Logout', log_action = 'Success', log_description = '$session_name logged out', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
mysqli_query($mysqli, "UPDATE users SET user_php_session = '' WHERE user_id = $session_user_id");
setcookie("PHPSESSID", '', time() - 3600, "/");
unset($_COOKIE['PHPSESSID']);