mirror of
https://github.com/itflow-org/itflow
synced 2026-08-10 09:37:15 +00:00
Fix Client PDF Export
This commit is contained in:
@@ -328,7 +328,7 @@ if (isset($_POST['restore_user'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_users'])) {
|
||||
if (isExportRequest('export_users')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="contacts" name="include_contacts" value="1" checked>
|
||||
<label for="contacts" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-users mr-2'></i>Contacts
|
||||
</label>
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="locations" name="include_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>
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="assets" name="include_assets" value="1" checked>
|
||||
<label for="assets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-desktop mr-2'></i>Assets
|
||||
</label>
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="software" name="include_software" value="1" checked>
|
||||
<label for="software" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-cube mr-2'></i>Software / Licenses
|
||||
</label>
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="credentials" name="export_credentials" value="1">
|
||||
<input class="custom-control-input" type="checkbox" id="credentials" name="include_credentials" value="1">
|
||||
<label for="credentials" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-key mr-2'></i>Credentials
|
||||
</label>
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="networks" name="include_networks" value="1" checked>
|
||||
<label for="networks" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-network-wired mr-2'></i>Networks
|
||||
</label>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="certificates" name="include_certificates" value="1" checked>
|
||||
<label for="certificates" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-lock mr-2'></i>Certificates
|
||||
</label>
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="domains" name="include_domains" value="1" checked>
|
||||
<label for="domains" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-globe mr-2'></i>Domains
|
||||
</label>
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="tickets" name="include_tickets" value="1" checked>
|
||||
<label for="tickets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-life-ring mr-2'></i>Tickets
|
||||
</label>
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="recurring_tickets" name="export_recurring_tickets" value="1" checked>
|
||||
<input class="custom-control-input" type="checkbox" id="recurring_tickets" name="include_recurring_tickets" value="1" checked>
|
||||
<label for="recurring_tickets" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-clock mr-2'></i>Recurring Tickets
|
||||
</label>
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="vendors" name="include_vendors" value="1" checked>
|
||||
<label for="vendors" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-building mr-2'></i>Vendors
|
||||
</label>
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="invoices" name="include_invoices" value="1" checked>
|
||||
<label for="invoices" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-file-invoice mr-2'></i>Invoices
|
||||
</label>
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
<li class="list-group-item">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="recurring_invoices" name="export_recurring_invoices" value="1" checked>
|
||||
<input class="custom-control-input" type="checkbox" id="recurring_invoices" name="include_recurring_invoices" value="1" checked>
|
||||
<label for="recurring_invoices" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-sync mr-2'></i>Recurring Invoices
|
||||
</label>
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="quotes" name="include_quotes" value="1" checked>
|
||||
<label for="quotes" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-file mr-2'></i>Quotes
|
||||
</label>
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="payments" name="include_payments" value="1" checked>
|
||||
<label for="payments" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-credit-card mr-2'></i>Payments
|
||||
</label>
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="trips" name="include_trips" value="1" checked>
|
||||
<label for="trips" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-route mr-2'></i>Trips
|
||||
</label>
|
||||
@@ -165,7 +165,7 @@
|
||||
|
||||
<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>
|
||||
<input class="custom-control-input" type="checkbox" id="logs" name="include_logs" value="1" checked>
|
||||
<label for="logs" class="custom-control-label">
|
||||
<i class='fas fa-fw fa-eye mr-2'></i>Audit Log
|
||||
</label>
|
||||
|
||||
@@ -1316,7 +1316,7 @@ if (isset($_GET['download_assets_csv_template'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_assets'])) {
|
||||
if (isExportRequest('export_assets')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
@@ -2056,7 +2056,7 @@ if (isset($_GET['download_client_asset_interfaces_csv_template'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_asset_interfaces'])) {
|
||||
if (isExportRequest('export_asset_interfaces')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ if (isset($_POST['bulk_delete_certificates'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_certificates'])) {
|
||||
if (isExportRequest('export_certificates')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ if (isset($_GET['delete_client'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_clients'])) {
|
||||
if (isExportRequest('export_clients')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
@@ -1192,26 +1192,26 @@ if (isset($_POST["export_client_pdf"])) {
|
||||
$company_logo = escapeHtml($row['company_logo']);
|
||||
|
||||
$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_contacts = intval($_POST["include_contacts"] ?? 0);
|
||||
$export_locations = intval($_POST["include_locations"] ?? 0);
|
||||
$export_assets = intval($_POST["include_assets"] ?? 0);
|
||||
$export_software = intval($_POST["include_software"] ?? 0);
|
||||
$export_credentials = 0;
|
||||
if (lookupUserPermission("module_credential") >= 1) {
|
||||
$export_credentials = intval($_POST["export_credentials"] ?? 0);
|
||||
$export_credentials = intval($_POST["include_credentials"] ?? 0);
|
||||
}
|
||||
$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_recurring_tickets = intval($_POST["export_recurring_tickets"]);
|
||||
$export_vendors = intval($_POST["export_vendors"]);
|
||||
$export_invoices = intval($_POST["export_invoices"]);
|
||||
$export_recurring_invoices = intval($_POST["export_recurring_invoices"]);
|
||||
$export_quotes = intval($_POST["export_quotes"]);
|
||||
$export_payments = intval($_POST["export_payments"]);
|
||||
$export_trips = intval($_POST["export_trips"]);
|
||||
$export_logs = intval($_POST["export_logs"]);
|
||||
$export_networks = intval($_POST["include_networks"] ?? 0);
|
||||
$export_certificates = intval($_POST["include_certificates"] ?? 0);
|
||||
$export_domains = intval($_POST["include_domains"] ?? 0);
|
||||
$export_tickets = intval($_POST["include_tickets"] ?? 0);
|
||||
$export_recurring_tickets = intval($_POST["include_recurring_tickets"] ?? 0);
|
||||
$export_vendors = intval($_POST["include_vendors"] ?? 0);
|
||||
$export_invoices = intval($_POST["include_invoices"] ?? 0);
|
||||
$export_recurring_invoices = intval($_POST["include_recurring_invoices"] ?? 0);
|
||||
$export_quotes = intval($_POST["include_quotes"] ?? 0);
|
||||
$export_payments = intval($_POST["include_payments"] ?? 0);
|
||||
$export_trips = intval($_POST["include_trips"] ?? 0);
|
||||
$export_logs = intval($_POST["include_logs"] ?? 0);
|
||||
|
||||
enforceClientAccess();
|
||||
|
||||
|
||||
@@ -1262,7 +1262,7 @@ if (isset($_GET['unlink_contact_from_file'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_contacts'])) {
|
||||
if (isExportRequest('export_contacts')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ if (isset($_POST['bulk_delete_credentials'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_credentials'])) {
|
||||
if (isExportRequest('export_credentials')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ if (isset($_POST['bulk_refresh_domains'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_domains'])) {
|
||||
if (isExportRequest('export_domains')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ if (isset($_POST['bulk_delete_expenses'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_expenses'])) {
|
||||
if (isExportRequest('export_expenses')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ if (isset($_POST['bulk_edit_income_method'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_income'])) {
|
||||
if (isExportRequest('export_income')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -657,7 +657,7 @@ if (isset($_GET['email_invoice'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_invoices'])) {
|
||||
if (isExportRequest('export_invoices')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ if (isset($_POST['bulk_delete_locations'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_locations'])) {
|
||||
if (isExportRequest('export_locations')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ if (isset($_POST['bulk_delete_networks'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_networks'])) {
|
||||
if (isExportRequest('export_networks')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ if (isset($_POST['bulk_delete_products'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_products'])) {
|
||||
if (isExportRequest('export_products')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -692,7 +692,7 @@ if (isset($_GET['mark_quote_invoiced'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_quotes'])) {
|
||||
if (isExportRequest('export_quotes')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -617,7 +617,7 @@ if (isset($_POST['set_recurring_payment'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_recurring_invoices'])) {
|
||||
if (isExportRequest('export_recurring_invoices')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ if (isset($_GET['delete_software'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_software'])) {
|
||||
if (isExportRequest('export_software')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -2741,7 +2741,7 @@ if (isset($_POST['add_quote_from_ticket'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_tickets'])) {
|
||||
if (isExportRequest('export_tickets')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if (!defined('FROM_POST_HANDLER')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['export_transactions'])) {
|
||||
if (isExportRequest('export_transactions')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ if (isset($_GET['delete_trip'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_trips'])) {
|
||||
if (isExportRequest('export_trips')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ if (isset($_POST['bulk_delete_vendors'])) {
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['export_vendors'])) {
|
||||
if (isExportRequest('export_vendors')) {
|
||||
|
||||
validateCSRFToken();
|
||||
|
||||
|
||||
@@ -348,6 +348,17 @@ function resolveExportFormat($format) {
|
||||
return ($format === 'pdf') ? 'pdf' : 'csv';
|
||||
}
|
||||
|
||||
/*
|
||||
* The gate every export handler opens on. Keying on isset() alone means any other
|
||||
* field that happens to share the trigger's name fires the export - the client PDF
|
||||
* pack's section checkboxes (export_assets=1, export_contacts=1, ...) did exactly
|
||||
* that, and since post.php loads every handler, the first match won and streamed a
|
||||
* CSV instead. Only 'csv' or 'pdf' - what renderExportButtons() posts - counts.
|
||||
*/
|
||||
function isExportRequest($trigger) {
|
||||
return isset($_POST[$trigger]) && in_array($_POST[$trigger], ['csv', 'pdf'], true);
|
||||
}
|
||||
|
||||
/*
|
||||
* PDF is capped - see EXPORT_PDF_MAX_ROWS. Call this after the row count is known
|
||||
* and before beginExport(); it redirects rather than returning on refusal.
|
||||
|
||||
Reference in New Issue
Block a user