mirror of
https://github.com/itflow-org/itflow
synced 2026-03-02 03:44:53 +00:00
Updated All Exports to include your company name if exporting all and if exporting just from a client prepend the client name to file, introduced a sanitize_filename function and used it for the exports to always get a clean file name that works on every OS
This commit is contained in:
@@ -540,12 +540,12 @@ if(isset($_POST['export_quotes_csv'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$client_query = "WHERE quote_client_id = $client_id";
|
||||
// Get Client Name for logging
|
||||
$client_name = getFieldByID('clients', $client_id, 'client_name');
|
||||
$client_name = getFieldById('clients', $client_id, 'client_name');
|
||||
$file_name_prepend = "$client_name-";
|
||||
} else {
|
||||
$client_query = '';
|
||||
$client_name = '';
|
||||
$file_name_prepend = '';
|
||||
$file_name_prepend = "$session_company_name";
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes $client_query ORDER BY quote_number ASC");
|
||||
@@ -556,7 +556,7 @@ if(isset($_POST['export_quotes_csv'])){
|
||||
$delimiter = ",";
|
||||
$enclosure = '"';
|
||||
$escape = '\\'; // backslash
|
||||
$filename = $file_name_prepend . "Quotes-" . date('Y-m-d') . ".csv";
|
||||
$filename = sanitize_filename($file_name_prepend . "Quotes-" . date('Y-m-d_H-i-s') . ".csv");
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
||||
Reference in New Issue
Block a user