From 8b1e37414824a27670fe1f3c685afc4e2c3a6be4 Mon Sep 17 00:00:00 2001 From: "johnny@pittpc.com" Date: Sat, 27 Mar 2021 16:07:42 -0400 Subject: [PATCH] Fix #180 - No Company logo breaks Invoice/Quotes --- guest_view_invoice.php | 8 ++++++-- guest_view_quote.php | 8 ++++++-- invoice.php | 7 +++++-- quote.php | 8 ++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 5c0444ba..0f2fde85 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -61,7 +61,9 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ } $company_email = $row['company_email']; $company_logo = $row['company_logo']; - $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + if(!empty($company_logo)){ + $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + } $config_invoice_footer = $row['config_invoice_footer']; $config_stripe_enable = $row['config_stripe_enable']; $config_stripe_publishable = $row['config_stripe_publishable']; @@ -533,10 +535,12 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ // Header { columns: [ + { image: '', width: 120 }, + [ { @@ -911,4 +915,4 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ } ?> - \ No newline at end of file + diff --git a/guest_view_quote.php b/guest_view_quote.php index 2d09c7b2..e532b16c 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -60,7 +60,9 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){ } $company_email = $row['company_email']; $company_logo = $row['company_logo']; - $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + if(!empty($company_logo)){ + $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + } $quote_footer = $row['quote_footer']; $ip = get_ip(); @@ -279,10 +281,12 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){ // Header { columns: [ + { image: '', width: 120 }, + [ { @@ -609,4 +613,4 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){ echo "GTFO"; } ?> - { image: '', width: 120 }, + [ { diff --git a/quote.php b/quote.php index 9e46e13a..bab0dbec 100644 --- a/quote.php +++ b/quote.php @@ -60,7 +60,9 @@ if(isset($_GET['quote_id'])){ $company_email = $row['company_email']; $company_website = $row['company_website']; $company_logo = $row['company_logo']; - $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + if(!empty($company_logo)){ + $company_logo_base64 = base64_encode(file_get_contents($row['company_logo'])); + } $sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE quote_id = $quote_id ORDER BY history_id DESC"); @@ -418,11 +420,13 @@ var docDefinition = { // Header { columns: [ + { image: '', width: 120 }, - + + [ { text: 'QUOTE',