From 48dbb3ec4cf2eec833ac3dd28651eff084f6a546 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 13 Jan 2022 14:07:51 -0500 Subject: [PATCH] More Define canned date if not set. Prevents undefined errors Same as a48e302 --- campaigns.php | 6 ++++++ expenses.php | 6 ++++++ invoices.php | 7 ++++++- logs.php | 6 ++++++ payments.php | 9 +++++---- quotes.php | 8 +++++++- recurring.php | 6 ++++++ revenues.php | 6 ++++++ tickets.php | 2 +- transfers.php | 6 ++++++ trips.php | 6 ++++++ 11 files changed, 61 insertions(+), 7 deletions(-) diff --git a/campaigns.php b/campaigns.php index a50b96f4..4d9f506a 100644 --- a/campaigns.php +++ b/campaigns.php @@ -36,6 +36,12 @@ $disp = "ASC"; } + if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; + } + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/expenses.php b/expenses.php index 56cf37aa..a842cbed 100644 --- a/expenses.php +++ b/expenses.php @@ -69,6 +69,12 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtt = "9999-00-00"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Rebuild URL $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o))); diff --git a/invoices.php b/invoices.php index 389e1b37..859b521e 100644 --- a/invoices.php +++ b/invoices.php @@ -87,6 +87,12 @@ $disp = "ASC"; } + if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; + } + //Invoice status from GET if(isset($_GET['status']) && ($_GET['status']) == 'Draft'){ $status = 'Draft'; @@ -100,7 +106,6 @@ $status = '%'; } - //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/logs.php b/logs.php index 4cf7a5f2..ac0f5d6a 100644 --- a/logs.php +++ b/logs.php @@ -36,6 +36,12 @@ if(isset($_GET['o'])){ $disp = "ASC"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/payments.php b/payments.php index 29b345ac..e1dd0a61 100644 --- a/payments.php +++ b/payments.php @@ -36,11 +36,12 @@ if(isset($_GET['o'])){ $disp = "ASC"; } -if (empty($_GET['canned_date'])) { - //Prevents lots of undefined variable errors. - // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 - $_GET['canned_date'] = 'custom'; +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; } + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/quotes.php b/quotes.php index b2103220..94012fcc 100644 --- a/quotes.php +++ b/quotes.php @@ -38,6 +38,12 @@ if(isset($_GET['o'])){ $disp = "ASC"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); @@ -174,7 +180,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $quote_currency_code = $row['quote_currency_code']; $quote_created_at = $row['quote_created_at']; $client_id = $row['client_id']; - $client_name = $row['client_name']; + $client_name = htmlentities($row['client_name']); $client_email = $row['client_email']; $client_currency_code = $row['client_currency_code']; $category_id = $row['category_id']; diff --git a/recurring.php b/recurring.php index c4197c01..e860481c 100644 --- a/recurring.php +++ b/recurring.php @@ -69,6 +69,12 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtt = "9999-00-00"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Rebuild URL $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o))); diff --git a/revenues.php b/revenues.php index f58446ec..56e2185f 100644 --- a/revenues.php +++ b/revenues.php @@ -36,6 +36,12 @@ if(isset($_GET['o'])){ $disp = "ASC"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/tickets.php b/tickets.php index 04afcd19..4655832e 100644 --- a/tickets.php +++ b/tickets.php @@ -53,7 +53,7 @@ //Date Filter - if (empty($_GET['canned_date'])) { + if(empty($_GET['canned_date'])){ //Prevents lots of undefined variable errors. // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 $_GET['canned_date'] = 'custom'; diff --git a/transfers.php b/transfers.php index 745d862b..d061e776 100644 --- a/transfers.php +++ b/transfers.php @@ -39,6 +39,12 @@ if(isset($_GET['o'])){ $disp = "ASC"; } +if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; +} + //Date Filter if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){ $dtf = mysqli_real_escape_string($mysqli,$_GET['dtf']); diff --git a/trips.php b/trips.php index ed24e67f..ac5b337e 100644 --- a/trips.php +++ b/trips.php @@ -69,6 +69,12 @@ $dtt = "9999-00-00"; } + if(empty($_GET['canned_date'])){ + //Prevents lots of undefined variable errors. + // $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00 + $_GET['canned_date'] = 'custom'; + } + //Rebuild URL $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));