mirror of https://github.com/itflow-org/itflow
Fix Exports while in Client Overview some were failing due to missing client_id var and some were not logging the client_id if in the client section
This commit is contained in:
parent
e8a3309822
commit
6b0855cff8
|
|
@ -8,7 +8,9 @@
|
|||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<?php if($client_url) { ?>
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<?php } ?>
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -975,6 +975,7 @@ if (isset($_POST['export_assets_csv'])) {
|
|||
$client_name = $client_row['client_name'];
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0; // for Logging
|
||||
}
|
||||
|
||||
// Get records from database
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ if (isset($_POST['export_certificates_csv'])) {
|
|||
$client_query = "AND certificate_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM certificates WHERE certificate_archived_at IS NULL $client_query ORDER BY certificate_name ASC");
|
||||
|
|
@ -260,7 +261,7 @@ if (isset($_POST['export_certificates_csv'])) {
|
|||
}
|
||||
|
||||
// Logging
|
||||
logAction("Certificate", "Export", "$session_name exported $num_rows certificate(s) to a CSV file");
|
||||
logAction("Certificate", "Export", "$session_name exported $num_rows certificate(s) to a CSV file", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -1216,6 +1216,7 @@ if (isset($_POST['export_contacts_csv'])) {
|
|||
$client_query = "AND contact_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0; //Logging
|
||||
}
|
||||
|
||||
//Contacts
|
||||
|
|
@ -1252,7 +1253,7 @@ if (isset($_POST['export_contacts_csv'])) {
|
|||
}
|
||||
|
||||
//Logging
|
||||
logAction("Contact", "Export", "$session_name exported $num_rows contact(s) to a CSV file");
|
||||
logAction("Contact", "Export", "$session_name exported $num_rows contact(s) to a CSV file", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@ if (isset($_POST['export_credentials_csv'])) {
|
|||
$client_query = "AND credential_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
//get records from database
|
||||
|
|
@ -360,7 +361,7 @@ if (isset($_POST['export_credentials_csv'])) {
|
|||
}
|
||||
|
||||
// Logging
|
||||
logAction("Credential", "Export", "$session_name exported $num_rows credential(s) to a CSV file");
|
||||
logAction("Credential", "Export", "$session_name exported $num_rows credential(s) to a CSV file", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -336,6 +336,7 @@ if (isset($_POST['export_domains_csv'])) {
|
|||
$client_query = "WHERE domain_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains $client_query ORDER BY domain_name ASC");
|
||||
|
|
@ -371,7 +372,7 @@ if (isset($_POST['export_domains_csv'])) {
|
|||
}
|
||||
|
||||
// Logging
|
||||
logAction("Domain", "Export", "$session_name exported $num_rows domain(s)");
|
||||
logAction("Domain", "Export", "$session_name exported $num_rows domain(s)", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ if(isset($_POST['export_locations_csv'])){
|
|||
$client_query = "AND location_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
//Locations
|
||||
|
|
@ -406,7 +407,7 @@ if(isset($_POST['export_locations_csv'])){
|
|||
}
|
||||
|
||||
// Logging
|
||||
logAction("Location", "Export", "$session_name exported $num_rows location(s) to a CSV file");
|
||||
logAction("Location", "Export", "$session_name exported $num_rows location(s) to a CSV file", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ if (isset($_POST['export_networks_csv'])) {
|
|||
$client_query = "AND network_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0;
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL $client_query ORDER BY network_name ASC");
|
||||
|
|
@ -195,7 +196,7 @@ if (isset($_POST['export_networks_csv'])) {
|
|||
}
|
||||
|
||||
// Logging
|
||||
logAction("Network", "Export", "$session_name deleted $num_rows network(s) to a CSV file");
|
||||
logAction("Network", "Export", "$session_name deleted $num_rows network(s) to a CSV file", $client_id);
|
||||
|
||||
exit;
|
||||
|
||||
|
|
|
|||
|
|
@ -215,21 +215,21 @@ if (isset($_POST['export_client_software_csv'])) {
|
|||
|
||||
enforceUserPermission('module_support');
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
if (isset($_POST['client_id'])) {
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$client_query = "WHERE software_client_id = $client_id";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_id = 0; //Logging
|
||||
}
|
||||
|
||||
//get records from database
|
||||
$sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM software $client_query ORDER BY software_name ASC");
|
||||
|
||||
$num_rows = mysqli_num_rows($sql);
|
||||
|
||||
if ($num_rows > 0) {
|
||||
$delimiter = ",";
|
||||
$filename = $client_name . "-Software-" . date('Y-m-d') . ".csv";
|
||||
$filename = "Software-" . date('Y-m-d') . ".csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
|
|||
Loading…
Reference in New Issue