Add CSV Escaping to the Sample Export CSV Files

This commit is contained in:
johnnyq
2025-12-02 15:18:20 -05:00
parent e1a579387f
commit a430bb917e
5 changed files with 19 additions and 6 deletions

View File

@@ -700,6 +700,8 @@ if (isset($_POST["import_clients_csv"])) {
if (isset($_GET['download_clients_csv_template'])) {
$delimiter = ",";
$enclosure = '"';
$escape = '\\'; // backsla
$filename = "Clients-Template.csv";
//create a file pointer
@@ -707,7 +709,7 @@ if (isset($_GET['download_clients_csv_template'])) {
//set column headers
$fields = array('Client Name', 'Industry', 'Referral', 'Website', 'Primary Location Name', 'Location Phone', 'Location Address', 'City', 'State', 'Postal Code', 'Country', 'Primary Contact Name', 'Title', 'Contact Phone', 'Extension', 'Contact Mobile', 'Contact Email', 'Hourly Rate', 'Currency', 'Payment Terms', 'Tax ID', 'Abbreviation');
fputcsv($f, $fields, $delimiter);
fputcsv($f, $fields, $delimiter, $enclosure, $escape);
//move back to beginning of file
fseek($f, 0);