From 1ed20217d17a447fae3f8ab8fb52e6218ac71663 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 22 Feb 2022 11:42:08 -0500 Subject: [PATCH] Added Department name on client PDF Export and contact CSV export --- cron.php | 2 +- post.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cron.php b/cron.php index e79f4fcf..14a0b3ff 100644 --- a/cron.php +++ b/cron.php @@ -189,7 +189,7 @@ while($row = mysqli_fetch_array($sql_companies)){ } } - // PAST DUE INVOICE ALERTS + // PAST DUE INVOICE Notifications //$invoiceAlertArray = [$config_invoice_overdue_reminders]; $invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620]; diff --git a/post.php b/post.php index c149a77d..0fdfff4e 100644 --- a/post.php +++ b/post.php @@ -4148,7 +4148,7 @@ if(isset($_GET['export_client_contacts_csv'])){ $client_name = $row['client_name']; //Contacts - $sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC"); + $sql = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN departments ON contact_department_id = department_id WHERE contact_client_id = $client_id ORDER BY contact_name ASC"); if($sql->num_rows > 0){ $delimiter = ","; $filename = $client_name . "-Contacts-" . date('Y-m-d') . ".csv"; @@ -4157,12 +4157,12 @@ if(isset($_GET['export_client_contacts_csv'])){ $f = fopen('php://memory', 'w'); //set column headers - $fields = array('Name', 'Title', 'Email', 'Phone', 'Mobile', 'Notes'); + $fields = array('Name', 'Title', 'Department', 'Email', 'Phone', 'Mobile', 'Notes'); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer while($row = $sql->fetch_assoc()){ - $lineData = array($row['contact_name'], $row['contact_title'], $row['contact_email'], $row['contact_phone'], $row['contact_mobile'], $row['contact_notes']); + $lineData = array($row['contact_name'], $row['contact_title'], $row['department_name'], $row['contact_email'], $row['contact_phone'], $row['contact_mobile'], $row['contact_notes']); fputcsv($f, $lineData, $delimiter); } @@ -6602,7 +6602,7 @@ if(isset($_GET['export_client_pdf'])){ $contact_email = $row['contact_email']; $client_website = $row['client_website']; - $sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC"); + $sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN departments ON contact_department_id = department_id WHERE contact_client_id = $client_id ORDER BY contact_name ASC"); $sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC"); $sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC"); if(isset($_GET['passwords'])){ @@ -6743,6 +6743,7 @@ if(isset($_GET['export_client_pdf'])){ } $contact_mobile = formatPhoneNumber($row['contact_mobile']); $contact_email = $row['contact_email']; + $department_name = $row['department_name']; ?> [ @@ -6754,6 +6755,10 @@ if(isset($_GET['export_client_pdf'])){ text: , style: 'item' }, + { + text: , + style: 'item' + }, { text: , style: 'item'