diff --git a/classes/Export.php b/classes/Export.php
index 95f3828..8f05a18 100644
--- a/classes/Export.php
+++ b/classes/Export.php
@@ -37,8 +37,10 @@ class Export extends Base {
// Create Export Request
// =====================
- public function createExportRequest() {
+ public function createExportRequest($subscription_serial = 0, $export_type = "", $report_type = "") {
+ $this->debug($_POST);
+
$subscription_serial = filter_input(INPUT_POST, "subscription_serial", FILTER_SANITIZE_NUMBER_INT) ?: 0;
$subscription = (new Subscriptions())->getSubscription($subscription_serial);
diff --git a/classes/PermitFacts.php b/classes/PermitFacts.php
index a9038fe..3030ce9 100644
--- a/classes/PermitFacts.php
+++ b/classes/PermitFacts.php
@@ -87,479 +87,358 @@ class PermitFacts extends Base {
$this->displayContent($content);
}
- // =================================
- // Return a Permit Facts Page Object
- // =================================
+// =================================
+// Return a Permit Facts Page Object
+// =================================
public function getPermitFactsPage($user_subscription_start_date, $user_subscription_end_date) {
set_time_limit(0);
- // Sanitize inputs
- $permitfact_company = filter_input(INPUT_POST, "permitfact_company") ?: "";
- $permitfact_project_name = filter_input(INPUT_POST, "permitfact_project_name") ?: "";
- $permitfact_project_zip = filter_input(INPUT_POST, "permitfact_project_zip") ?: "";
- $permitfact_project_city = filter_input(INPUT_POST, "permitfact_project_city") ?: "";
- $permitfact_county = filter_input(INPUT_POST, "permitfact_county") ?: "";
- $permitfact_project_type = filter_input(INPUT_POST, "permitfact_project_type") ?: "";
- $permitfact_work_type = filter_input(INPUT_POST, "permitfact_work_type") ?: "";
- $permitfact_building_type = filter_input(INPUT_POST, "permitfact_building_type") ?: "";
- $permitfact_size_from = filter_input(INPUT_POST, "permitfact_size_from") ?: "";
- $permitfact_size_to = filter_input(INPUT_POST, "permitfact_size_to") ?: "";
- $permitfact_value_from = filter_input(INPUT_POST, "permitfact_value_from") ?: "";
- $permitfact_value_to = filter_input(INPUT_POST, "permitfact_value_to") ?: "";
- $permitfact_permit_date_from = filter_input(INPUT_POST, "permitfact_permit_date_from") ?: "";
- $permitfact_permit_date_to = filter_input(INPUT_POST, "permitfact_permit_date_to") ?: "";
- $permitfact_entry_date_from = filter_input(INPUT_POST, "permitfact_entry_date_from") ?: "";
- $permitfact_entry_date_to = filter_input(INPUT_POST, "permitfact_entry_date_to") ?: "";
-
- // Determine real date range based upon users subscription start date
-
- if ($user_subscription_start_date <= date('Y-m-d', strtotime('-1 year'))) {
- $user_subscription_start_date = date('Y-m-d', strtotime('-1 year'));
- }
-
- $permitfact_permit_date_from = ($permitfact_permit_date_from == "") ? null : date("Y-m-d", strtotime($permitfact_permit_date_from));
- $permitfact_permit_date_to = ($permitfact_permit_date_to == "") ? null : date("Y-m-d", strtotime($permitfact_permit_date_to));
- $permitfact_entry_date_from = ($permitfact_entry_date_from == "") ? null : date("Y-m-d", strtotime($permitfact_entry_date_from));
- $permitfact_entry_date_to = ($permitfact_entry_date_to == "") ? null : date("Y-m-d", strtotime($permitfact_entry_date_to));
-
- // Pagination settings
- $pagination = filter_input(INPUT_POST, "pagination") ?: "";
- $this->pagination_size = filter_input(INPUT_POST, "permitfacts_per_page", FILTER_SANITIZE_NUMBER_INT) ?: $this->pagination_size;
-
- // Connect to DB
$connection = $this->connect();
- // Record Count
- $SQL = "select count(*) as count
- from view_permitfacts
- where view_permitfacts.permitfact_entry_date between :user_subscription_start_date and :user_subscription_end_date ";
+ $post = function ($name) {
+ return trim((string) (filter_input(INPUT_POST, $name) ?: ""));
+ };
- if ($permitfact_company !== '') {
- $SQL .= " and permitfact_company regexp :permitfact_company ";
+ $dateOrNull = function ($value) {
+ if ($value === "") {
+ return null;
+ }
+
+ $timestamp = strtotime($value);
+ return $timestamp ? date("Y-m-d", $timestamp) : null;
+ };
+
+ $numberOrNull = function ($value) {
+ $value = str_replace([",", "$"], "", trim((string) $value));
+ return is_numeric($value) ? $value : null;
+ };
+
+ $addInClause = function (&$where, &$params, $column, $rawValue, $prefix) {
+
+ if ($rawValue === "") {
+ return;
+ }
+
+ $items = array_filter(array_map(function ($item) {
+ return trim($item, " \t\n\r\0\x0B'\"");
+ }, explode(",", $rawValue)));
+
+ if (empty($items)) {
+ return;
+ }
+
+ $placeholders = [];
+
+ foreach ($items as $index => $item) {
+ $param = ":{$prefix}_{$index}";
+ $placeholders[] = $param;
+ $params[$param] = $item;
+ }
+
+ $where[] = "{$column} IN (" . implode(", ", $placeholders) . ")";
+ };
+
+ // ----------------------------
+ // Subscription Date Restriction
+ // ----------------------------
+
+ $oneYearAgo = date("Y-m-d", strtotime("-1 year"));
+
+ if ($user_subscription_start_date <= $oneYearAgo) {
+ $user_subscription_start_date = $oneYearAgo;
}
- if ($permitfact_project_name !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_name regexp :permitfact_project_name ";
+ // -----------
+ // POST Values
+ // -----------
+
+ $permitfact_company = $post("permitfact_company");
+ $permitfact_project_name = $post("permitfact_project_name");
+ $permitfact_project_zip = $post("permitfact_project_zip");
+ $permitfact_project_city = $post("permitfact_project_city");
+ $permitfact_county = $post("permitfact_county");
+ $permitfact_project_type = $post("permitfact_project_type");
+ $permitfact_work_type = $post("permitfact_work_type");
+ $permitfact_building_type = $post("permitfact_building_type");
+
+ $permitfact_size_from = $numberOrNull($post("permitfact_size_from"));
+ $permitfact_size_to = $numberOrNull($post("permitfact_size_to"));
+ $permitfact_value_from = $numberOrNull($post("permitfact_value_from"));
+ $permitfact_value_to = $numberOrNull($post("permitfact_value_to"));
+
+ $permitfact_permit_date_from = $dateOrNull($post("permitfact_permit_date_from"));
+ $permitfact_permit_date_to = $dateOrNull($post("permitfact_permit_date_to"));
+ $permitfact_entry_date_from = $dateOrNull($post("permitfact_entry_date_from"));
+ $permitfact_entry_date_to = $dateOrNull($post("permitfact_entry_date_to"));
+
+ $pagination = $post("pagination");
+
+ $this->pagination_size = filter_input(INPUT_POST, "permitfacts_per_page", FILTER_SANITIZE_NUMBER_INT) ?: $this->pagination_size;
+
+ // -----------------
+ // Build SQL Filters
+ // -----------------
+
+ $where = [];
+ $params = [];
+
+ /*
+ * This is the required subscription gate.
+ * It always limits records by entry date.
+ */
+ $where[] = "view_permitfacts.permitfact_entry_date BETWEEN :user_subscription_start_date AND :user_subscription_end_date";
+
+ $params[":user_subscription_start_date"] = $user_subscription_start_date;
+ $params[":user_subscription_end_date"] = $user_subscription_end_date;
+
+ if ($permitfact_company !== "") {
+ $where[] = "view_permitfacts.permitfact_company REGEXP :permitfact_company";
+ $params[":permitfact_company"] = $permitfact_company;
}
- if ($permitfact_project_zip !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_zip = :permitfact_project_zip ";
+ if ($permitfact_project_name !== "") {
+ $where[] = "view_permitfacts.permitfact_project_name REGEXP :permitfact_project_name";
+ $params[":permitfact_project_name"] = $permitfact_project_name;
}
- if ($permitfact_project_city !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_city in ($permitfact_project_city) ";
+ if ($permitfact_project_zip !== "") {
+ $where[] = "view_permitfacts.permitfact_project_zip = :permitfact_project_zip";
+ $params[":permitfact_project_zip"] = $permitfact_project_zip;
}
-// if ($permitfact_project_city !== '') {
-// $SQL .= " and view_permitfacts.permitfact_city in ($permitfact_project_city) ";
-// } else {
-// $cities = (new Cities())->getSubscriptionCities($_SESSION['subscription_serial']);
-//
-// $cityNames = [];
-//
-// foreach ($cities as $city) {
-// $cityNames[] = " " . (string) $city->subscriptioncity_city . " ";
-// }
-//
-// $permitfact_project_city = ' ' . implode(', ', $cityNames) . ' ';
-//
-// $SQL .= " and view_permitfacts.permitfact_city in ($permitfact_project_city) ";
-// }
+ $addInClause($where, $params, "view_permitfacts.permitfact_project_city", $permitfact_project_city, "city");
- if ($permitfact_county !== '') {
- $SQL .= " and view_permitfacts.permitfact_county in ($permitfact_county) ";
+ if ($permitfact_county !== "") {
+
+ $addInClause($where, $params, "view_permitfacts.permitfact_county", $permitfact_county, "county");
} else {
- $counties = (new Counties())->getSubscriptionCounties($_SESSION['subscription_serial']);
- $countyNames = [];
+ $counties = (new Counties())->getSubscriptionCounties($_SESSION["subscription_serial"]);
+
+ $countyList = [];
foreach ($counties as $county) {
- $countyNames[] = " " . (string) $county->subscriptioncounty_county . " ";
+ $countyList[] = (string) $county->subscriptioncounty_county;
}
- $permitfact_county = ' ' . implode(', ', $countyNames) . ' ';
-
- $SQL .= " and view_permitfacts.permitfact_county in ($permitfact_county) ";
- }
-
-
- if ($permitfact_project_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_type in ($permitfact_project_type) ";
- }
-
- if ($permitfact_work_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_work_type in ($permitfact_work_type) ";
- }
-
- if ($permitfact_building_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_building_type in ($permitfact_building_type) ";
- }
-
- if ($permitfact_size_from !== '' && $permitfact_size_to !== '') {
- $SQL .= " and view_permitfacts.permitfact_size between '{$permitfact_size_from}' and '{$permitfact_size_to}' ";
- } elseif ($permitfact_size_from != '') {
- $SQL .= " and view_permitfacts.permitfact_size = '{$permitfact_size_from}' ";
- } elseif ($permitfact_size_to != '') {
- $SQL .= " and view_permitfacts.permitfact_size = '{$permitfact_size_to}' ";
- }
-
- if ($permitfact_value_from !== '' && $permitfact_value_to !== '') {
- $SQL .= " and view_permitfacts.permitfact_value between '{$permitfact_value_from}' and '{$permitfact_value_to}' ";
- } elseif ($permitfact_value_from != '') {
- $SQL .= " and view_permitfacts.permitfact_value = '{$permitfact_value_from}' ";
- } elseif ($permitfact_value_to != '') {
- $SQL .= " and view_permitfacts.permitfact_value = '{$permitfact_value_to}' ";
- }
-
- // =======================
- // Permit Date Logic Start
- // =======================
-
- $permitFrom = $permitfact_permit_date_from; // null or Y-m-d
- $permitTo = $permitfact_permit_date_to; // null or Y-m-d
-
- $subStart = $user_subscription_start_date; // Y-m-d
- $subEnd = $user_subscription_end_date; // Y-m-d
- // ---- Enforce subscription window for permit dates (only if user provided them) ----
- if ($permitFrom !== null) {
- if ($permitFrom < $subStart || $permitFrom > $subEnd) {
- $this->displayNotice("The Permit Issue 'from' date or date range {$this->current_user_name} selected is outside your authorized access period.");
- return;
+ if (!empty($countyList)) {
+ $addInClause(
+ $where,
+ $params,
+ "view_permitfacts.permitfact_county",
+ implode(",", $countyList),
+ "sub_county"
+ );
}
}
- if ($permitTo !== null) {
- if ($permitTo < $subStart || $permitTo > $subEnd) {
- $this->displayNotice("The Permit Issue 'to' date or date range {$this->current_user_name} selected is outside your authorized access period.");
- return;
- }
- }
+ $addInClause($where, $params, "view_permitfacts.permitfact_project_type", $permitfact_project_type, "project_type");
+ $addInClause($where, $params, "view_permitfacts.permitfact_work_type", $permitfact_work_type, "work_type");
+ $addInClause($where, $params, "view_permitfacts.permitfact_building_type", $permitfact_building_type, "building_type");
- // ---- Build the permit date filter logic ----
- if ($permitFrom !== null && $permitTo !== null) {
+ // -----------
+ // Size Filter
+ // -----------
- // If user reversed the dates, swap them
- if ($permitFrom > $permitTo) {
- $tmp = $permitFrom;
- $permitFrom = $permitTo;
- $permitTo = $tmp;
+ if ($permitfact_size_from !== null && $permitfact_size_to !== null) {
+
+ if ($permitfact_size_from > $permitfact_size_to) {
+ [$permitfact_size_from, $permitfact_size_to] = [$permitfact_size_to, $permitfact_size_from];
}
- $SQL .= " AND view_permitfacts.permitfact_permit_date BETWEEN '{$permitFrom}' AND '{$permitTo}'";
- } elseif ($permitFrom !== null) {
+ $where[] = "view_permitfacts.permitfact_size BETWEEN :permitfact_size_from AND :permitfact_size_to";
+ $params[":permitfact_size_from"] = $permitfact_size_from;
+ $params[":permitfact_size_to"] = $permitfact_size_to;
+ } elseif ($permitfact_size_from !== null) {
- // User entered only "From" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_permit_date = '{$permitFrom}'";
- } elseif ($permitTo !== null) {
+ $where[] = "view_permitfacts.permitfact_size >= :permitfact_size_from";
+ $params[":permitfact_size_from"] = $permitfact_size_from;
+ } elseif ($permitfact_size_to !== null) {
- // User entered only "To" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_permit_date = '{$permitTo}'";
+ $where[] = "view_permitfacts.permitfact_size <= :permitfact_size_to";
+ $params[":permitfact_size_to"] = $permitfact_size_to;
}
- // =====================
- // Permit Date Logic End
- // =====================
- // ======================
- // Entry Date Logic Start
- // ======================
+ // -----------
+ // Value Filter
+ // -----------
- $entryFrom = $permitfact_entry_date_from; // null or Y-m-d
- $entryTo = $permitfact_entry_date_to; // null or Y-m-d
+ if ($permitfact_value_from !== null && $permitfact_value_to !== null) {
- $subStart = $user_subscription_start_date; // Y-m-d
- $subEnd = $user_subscription_end_date; // Y-m-d
- // ---- Enforce subscription window for entry dates (only if user provided them) ----
- if ($entryFrom !== null) {
- if ($entryFrom < $subStart || $entryFrom > $subEnd) {
- $this->displayNotice("The Entry 'from' date or date range {$this->current_user_name} selected is outside your authorized access period.");
- return;
- }
- }
-
- if ($entryTo !== null) {
- if ($entryTo < $subStart || $entryTo > $subEnd) {
- $this->displayNotice("The Entry 'to' date or date range {$this->current_user_name} selected is outside your authorized access period.");
- return;
- }
- }
-
- // ---- Build the entry date filter logic ----
- if ($entryFrom !== null && $entryTo !== null) {
-
- // If user reversed the dates, swap them
- if ($entryFrom > $entryTo) {
- $tmp = $entryFrom;
- $entryFrom = $entryTo;
- $entryTo = $tmp;
+ if ($permitfact_value_from > $permitfact_value_to) {
+ [$permitfact_value_from, $permitfact_value_to] = [$permitfact_value_to, $permitfact_value_from];
}
- $SQL .= " AND view_permitfacts.permitfact_entry_date BETWEEN '{$entryFrom}' AND '{$entryTo}'";
- } elseif ($entryFrom !== null) {
+ $where[] = "view_permitfacts.permitfact_value BETWEEN :permitfact_value_from AND :permitfact_value_to";
+ $params[":permitfact_value_from"] = $permitfact_value_from;
+ $params[":permitfact_value_to"] = $permitfact_value_to;
+ } elseif ($permitfact_value_from !== null) {
- // User entered only "From" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_entry_date = '{$entryFrom}'";
- } elseif ($entryTo !== null) {
+ $where[] = "view_permitfacts.permitfact_value >= :permitfact_value_from";
+ $params[":permitfact_value_from"] = $permitfact_value_from;
+ } elseif ($permitfact_value_to !== null) {
- // User entered only "To" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_entry_date = '{$entryTo}'";
- }
-
- // ====================
- // Entry Date Logic End
- // ====================
-
- $statement = $connection->prepare($SQL);
-
- if ($permitfact_company !== '') {
- $statement->bindValue(":permitfact_company", $permitfact_company, PDO::PARAM_STR);
+ $where[] = "view_permitfacts.permitfact_value <= :permitfact_value_to";
+ $params[":permitfact_value_to"] = $permitfact_value_to;
}
- if ($permitfact_project_name !== '') {
- $statement->bindValue(":permitfact_project_name", $permitfact_project_name, PDO::PARAM_STR);
+ // ------------------
+ // Permit Date Filter
+ // ------------------
+ // This is optional and works WITH the entry-date subscription gate.
+
+ if ($permitfact_permit_date_from !== null && $permitfact_permit_date_to !== null) {
+
+ if ($permitfact_permit_date_from > $permitfact_permit_date_to) {
+ [$permitfact_permit_date_from, $permitfact_permit_date_to] = [
+ $permitfact_permit_date_to,
+ $permitfact_permit_date_from
+ ];
+ }
+
+ $where[] = "view_permitfacts.permitfact_permit_date BETWEEN :permit_date_from AND :permit_date_to";
+ $params[":permit_date_from"] = $permitfact_permit_date_from;
+ $params[":permit_date_to"] = $permitfact_permit_date_to;
+ } elseif ($permitfact_permit_date_from !== null) {
+
+ $where[] = "view_permitfacts.permitfact_permit_date = :permit_date_from";
+ $params[":permit_date_from"] = $permitfact_permit_date_from;
+ } elseif ($permitfact_permit_date_to !== null) {
+
+ $where[] = "view_permitfacts.permitfact_permit_date = :permit_date_to";
+ $params[":permit_date_to"] = $permitfact_permit_date_to;
}
- if ($permitfact_project_zip !== '') {
- $statement->bindValue(":permitfact_project_zip", $permitfact_project_zip, PDO::PARAM_STR);
+ // -----------------
+ // Entry Date Filter
+ // -----------------
+ // This further narrows the already-required subscription entry-date gate.
+
+ if ($permitfact_entry_date_from !== null && $permitfact_entry_date_to !== null) {
+
+ if ($permitfact_entry_date_from > $permitfact_entry_date_to) {
+ [$permitfact_entry_date_from, $permitfact_entry_date_to] = [
+ $permitfact_entry_date_to,
+ $permitfact_entry_date_from
+ ];
+ }
+
+ $where[] = "view_permitfacts.permitfact_entry_date BETWEEN :entry_date_from AND :entry_date_to";
+ $params[":entry_date_from"] = $permitfact_entry_date_from;
+ $params[":entry_date_to"] = $permitfact_entry_date_to;
+ } elseif ($permitfact_entry_date_from !== null) {
+
+ $where[] = "view_permitfacts.permitfact_entry_date >= :entry_date_from";
+ $params[":entry_date_from"] = $permitfact_entry_date_from;
+ } elseif ($permitfact_entry_date_to !== null) {
+
+ $where[] = "view_permitfacts.permitfact_entry_date <= :entry_date_to";
+ $params[":entry_date_to"] = $permitfact_entry_date_to;
}
- $statement->bindValue(":user_subscription_start_date", $user_subscription_start_date, PDO::PARAM_STR);
- $statement->bindValue(":user_subscription_end_date", $user_subscription_end_date, PDO::PARAM_STR);
+ $whereSQL = implode(" AND ", $where);
+
+ // ------------
+ // Record Count
+ // ------------
+
+ $countSQL = "
+ SELECT COUNT(*) AS count
+ FROM view_permitfacts
+ WHERE {$whereSQL}
+ ";
+
+ $statement = $connection->prepare($countSQL);
+
+ foreach ($params as $param => $value) {
+ $statement->bindValue($param, $value, PDO::PARAM_STR);
+ }
$statement->execute();
$recordset = $statement->fetch(PDO::FETCH_ASSOC);
$count = $recordset ? (int) $recordset["count"] : 0;
- // === PAGINATION LOGIC ===
+ // ----------
+ // Pagination
+ // ----------
+
+ $totalPages = max(1, (int) ceil($count / $this->pagination_size));
+
switch ($pagination) {
- case "first": $this->pagination_page = 1;
+ case "first":
+ $this->pagination_page = 1;
break;
- case "previous": $this->pagination_page = max($this->pagination_page - 1, 1);
+
+ case "previous":
+ $this->pagination_page = max($this->pagination_page - 1, 1);
break;
- case "next": $this->pagination_page = min($this->pagination_page + 1, ceil($count / $this->pagination_size));
+
+ case "next":
+ $this->pagination_page = min($this->pagination_page + 1, $totalPages);
break;
- case "last": $this->pagination_page = (int) ceil($count / $this->pagination_size);
+
+ case "last":
+ $this->pagination_page = $totalPages;
+ break;
+
+ default:
+ $this->pagination_page = max(1, min($this->pagination_page, $totalPages));
break;
}
$offset = max(0, ($this->pagination_page - 1) * $this->pagination_size);
- $start = $offset + 1;
- $end = min($count, $start + $this->pagination_size - 1);
+ $start = $count > 0 ? $offset + 1 : 0;
+ $end = min($count, $offset + $this->pagination_size);
- // === DATA QUERY ===
- $SQL = "select view_permitfacts.*
- from view_permitfacts
- where view_permitfacts.permitfact_entry_date between :user_subscription_start_date and :user_subscription_end_date ";
+ // ----------
+ // Data Query
+ // ----------
- if ($permitfact_company !== '') {
- $SQL .= " and view_permitfacts.permitfact_company regexp :permitfact_company ";
+ $dataSQL = "
+ SELECT view_permitfacts.*
+ FROM view_permitfacts
+ WHERE {$whereSQL}
+ ORDER BY view_permitfacts.permitfact_entry_date DESC,
+ view_permitfacts.permitfact_permit_date DESC
+ ";
+
+ if ($pagination !== "off") {
+ $dataSQL .= "
+ LIMIT :limit
+ OFFSET :offset
+ ";
}
- if ($permitfact_project_name !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_name regexp :permitfact_project_name ";
+ $statement = $connection->prepare($dataSQL);
+
+ foreach ($params as $param => $value) {
+ $statement->bindValue($param, $value, PDO::PARAM_STR);
}
- if ($permitfact_project_zip !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_zip = :permitfact_project_zip ";
- }
-
- if ($permitfact_project_city !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_city in ($permitfact_project_city) ";
- }
-
-// if ($permitfact_project_city !== '') {
-// $SQL .= " and view_permitfacts.permitfact_city in ($permitfact_project_city) ";
-// } else {
-// $cities = (new Cities())->getSubscriptionCities($_SESSION['subscription_serial']);
-//
-// $cityNames = [];
-//
-// foreach ($cities as $city) {
-// $cityNames[] = " " . (string) $city->subscriptioncity_city . " ";
-// }
-//
-// $permitfact_project_city = ' ' . implode(', ', $cityNames) . ' ';
-//
-// $SQL .= " and view_permitfacts.permitfact_city in ($permitfact_project_city) ";
-// }
-
- if ($permitfact_county !== '') {
- $SQL .= " and view_permitfacts.permitfact_county in ($permitfact_county) ";
- } else {
- $counties = (new Counties())->getSubscriptionCounties($_SESSION['subscription_serial']);
-
- $countyNames = [];
-
- foreach ($counties as $county) {
- $countyNames[] = " " . (string) $county->subscriptioncounty_county . " ";
- }
-
- $permitfact_county = ' ' . implode(', ', $countyNames) . ' ';
-
- $SQL .= " and view_permitfacts.permitfact_county in ($permitfact_county) ";
- }
-
-
- if ($permitfact_project_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_project_type in ($permitfact_project_type) ";
- }
-
- if ($permitfact_work_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_work_type in ($permitfact_work_type) ";
- }
-
- if ($permitfact_building_type !== '') {
- $SQL .= " and view_permitfacts.permitfact_building_type in ($permitfact_building_type) ";
- }
-
- if ($permitfact_size_from !== '' && $permitfact_size_to !== '') {
- $SQL .= " and view_permitfacts.permitfact_size between '{$permitfact_size_from}' and '{$permitfact_size_from}' ";
- } elseif ($permitfact_size_from != '') {
- $SQL .= " and view_permitfacts.permitfact_size = '{$permitfact_size_from}' ";
- } elseif ($permitfact_size_to != '') {
- $SQL .= " and view_permitfacts.permitfact_size = '{$permitfact_size_from}' ";
- }
-
- if ($permitfact_value_from !== '' && $permitfact_value_to !== '') {
- $SQL .= " and view_permitfacts.permitfact_value between '{$permitfact_value_from}' and '{$permitfact_value_to}' ";
- } elseif ($permitfact_value_from !== '') {
- $SQL .= " and view_permitfacts.permitfact_value = '{$permitfact_value_to}' ";
- } elseif ($permitfact_value_to !== '') {
- $SQL .= " and view_permitfacts.permitfact_value = '{$permitfact_value_to}' ";
- }
-
- // =======================
- // Permit Date Logic Start
- // =======================
- $permitFrom = $permitfact_permit_date_from; // null or Y-m-d
- $permitTo = $permitfact_permit_date_to; // null or Y-m-d
-
- $subStart = $user_subscription_start_date; // Y-m-d
- $subEnd = $user_subscription_end_date; // Y-m-d
- // ---- Enforce subscription window for permit dates (only if user provided them) ----
- if ($permitFrom !== null) {
- if ($permitFrom < $subStart || $permitFrom > $subEnd) {
- return;
- }
- }
-
- if ($permitTo !== null) {
- if ($permitTo < $subStart || $permitTo > $subEnd) {
- return;
- }
- }
-
- // ---- Build the permit date filter logic ----
- if ($permitFrom !== null && $permitTo !== null) {
-
- // If user reversed the dates, swap them
- if ($permitFrom > $permitTo) {
- $tmp = $permitFrom;
- $permitFrom = $permitTo;
- $permitTo = $tmp;
- }
-
- $SQL .= " AND view_permitfacts.permitfact_permit_date BETWEEN '{$permitFrom}' AND '{$permitTo}'";
- } elseif ($permitFrom !== null) {
-
- // User entered only "From" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_permit_date = '{$permitFrom}'";
- } elseif ($permitTo !== null) {
-
- // User entered only "To" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_permit_date = '{$permitTo}'";
- }
-
- // ======================
- // Permit Date Logic End
- // ======================
- // ======================
- // Entry Date Logic Start
- // ======================
-
- $entryFrom = $permitfact_entry_date_from; // null or Y-m-d
- $entryTo = $permitfact_entry_date_to; // null or Y-m-d
-
- $subStart = $user_subscription_start_date; // Y-m-d
- $subEnd = $user_subscription_end_date; // Y-m-d
- // ---- Enforce subscription window for entry dates (only if user provided them) ----
- if ($entryFrom !== null) {
- if ($entryFrom < $subStart || $entryFrom > $subEnd) {
- return;
- }
- }
-
- if ($entryTo !== null) {
- if ($entryTo < $subStart || $entryTo > $subEnd) {
- return;
- }
- }
-
- // ---- Build the entry date filter logic ----
- if ($entryFrom !== null && $entryTo !== null) {
-
- // If user reversed the dates, swap them
- if ($entryFrom > $entryTo) {
- $tmp = $entryFrom;
- $entryFrom = $entryTo;
- $entryTo = $tmp;
- }
-
- $SQL .= " AND view_permitfacts.permitfact_entry_date BETWEEN '{$entryFrom}' AND '{$entryTo}'";
- } elseif ($entryFrom !== null) {
-
- // User entered only "From" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_entry_date = '{$entryFrom}'";
- } elseif ($entryTo !== null) {
-
- // User entered only "To" => treat as a specific date
- $SQL .= " AND view_permitfacts.permitfact_entry_date = '{$entryTo}'";
- }
-
- // ====================
- // Entry Date Logic End
- // ====================
-
- if ($pagination !== 'off') {
- $SQL .= " limit :limit
- offset :offset";
- }
-
-
- $statement = $connection->prepare($SQL);
-
- if ($permitfact_company !== '') {
- $statement->bindValue(":permitfact_company", $permitfact_company, PDO::PARAM_STR);
- }
-
- if ($permitfact_project_name !== '') {
- $statement->bindValue(":permitfact_project_name", $permitfact_project_name, PDO::PARAM_STR);
- }
-
- if ($permitfact_project_zip !== '') {
- $statement->bindValue(":permitfact_project_zip", $permitfact_project_zip, PDO::PARAM_STR);
- }
-
- $statement->bindValue(":user_subscription_start_date", $user_subscription_start_date, PDO::PARAM_STR);
- $statement->bindValue(":user_subscription_end_date", $user_subscription_end_date, PDO::PARAM_STR);
-
- if ($pagination !== 'off') {
- $statement->bindValue(":limit", $this->pagination_size, PDO::PARAM_INT);
- $statement->bindValue(":offset", $offset, PDO::PARAM_INT);
+ if ($pagination !== "off") {
+ $statement->bindValue(":limit", (int) $this->pagination_size, PDO::PARAM_INT);
+ $statement->bindValue(":offset", (int) $offset, PDO::PARAM_INT);
}
$statement->execute();
$permitfacts = $this->getTableXML("permitfacts", $statement);
- // Add searched entry_dates for search history
+ if (!isset($permitfacts->record)) {
+ $permitfacts->addChild("record");
+ }
- $permitfacts->record->permitfact_entry_date_from = !empty($entryFrom) ? date('m/d/Y', strtotime($entryFrom)) : date('m/d/Y', strtotime($user_subscription_start_date));
- $permitfacts->record->permitfact_entry_date_to = !empty($entryTo) ? date('m/d/Y', strtotime($entryTo)) : date('m/d/Y', strtotime($user_subscription_end_date));
+ $permitfacts->record->permitfact_entry_date_from = !empty($permitfact_entry_date_from) ? date("m/d/Y", strtotime($permitfact_entry_date_from)) : date("m/d/Y", strtotime($user_subscription_start_date));
+
+ $permitfacts->record->permitfact_entry_date_to = !empty($permitfact_entry_date_to) ? date("m/d/Y", strtotime($permitfact_entry_date_to)) : date("m/d/Y", strtotime($user_subscription_end_date));
+
+ $permitfacts->record->permitfact_permit_date_from = !empty($permitfact_permit_date_from) ? date("m/d/Y", strtotime($permitfact_permit_date_from)) : "";
+
+ $permitfacts->record->permitfact_permit_date_to = !empty($permitfact_permit_date_to) ? date("m/d/Y", strtotime($permitfact_permit_date_to)) : "";
- // Insert Pagination Attributes
$permitfacts->addAttribute("count", $count);
$permitfacts->addAttribute("start", $start);
$permitfacts->addAttribute("end", $end);
diff --git a/classes/PlanningAndZoningFacts.php b/classes/PlanningAndZoningFacts.php
index a4073f7..7e0c7a9 100644
--- a/classes/PlanningAndZoningFacts.php
+++ b/classes/PlanningAndZoningFacts.php
@@ -114,21 +114,21 @@ class PlanningAndZoningFacts extends Base {
public function getPZFactsPage($user_subscription_start_date, $user_subscription_end_date) {
- // ---------------------------
+ // -----------------------
// Read + normalize inputs
- // ---------------------------
- $pzfact_project_name = trim((string) filter_input(INPUT_POST, "pzfact_project_name")) ?: "";
- $pzfact_project_city = trim((string) filter_input(INPUT_POST, "pzfact_project_city")) ?: "";
- $pzfact_county = trim((string) filter_input(INPUT_POST, "pzfact_county")) ?: "";
- $pzfact_project_type = trim((string) filter_input(INPUT_POST, "pzfact_project_type")) ?: "";
- $pzfact_action_code = trim((string) filter_input(INPUT_POST, "pzfact_action_code")) ?: "";
- $pzfact_acres_from = trim((string) filter_input(INPUT_POST, "pzfact_acres_from")) ?: "";
- $pzfact_acres_to = trim((string) filter_input(INPUT_POST, "pzfact_acres_to")) ?: "";
- $pzfact_entry_date_from = trim((string) filter_input(INPUT_POST, "pzfact_entry_date_from")) ?: "";
- $pzfact_entry_date_to = trim((string) filter_input(INPUT_POST, "pzfact_entry_date_to")) ?: "";
+ // --------------------------
+ $pzfact_project_name = trim((string) filter_input(INPUT_POST, "pzfact_project_name")) ?: "";
+ $pzfact_project_city = trim((string) filter_input(INPUT_POST, "pzfact_project_city")) ?: "";
+ $pzfact_county = trim((string) filter_input(INPUT_POST, "pzfact_county")) ?: "";
+ $pzfact_project_type = trim((string) filter_input(INPUT_POST, "pzfact_project_type")) ?: "";
+ $pzfact_action_code = trim((string) filter_input(INPUT_POST, "pzfact_action_code")) ?: "";
+ $pzfact_acres_from = trim((string) filter_input(INPUT_POST, "pzfact_acres_from")) ?: "";
+ $pzfact_acres_to = trim((string) filter_input(INPUT_POST, "pzfact_acres_to")) ?: "";
+ $pzfact_entry_date_from = trim((string) filter_input(INPUT_POST, "pzfact_entry_date_from")) ?: "";
+ $pzfact_entry_date_to = trim((string) filter_input(INPUT_POST, "pzfact_entry_date_to")) ?: "";
// Pagination
- $pagination = trim((string) filter_input(INPUT_POST, "pagination")) ?: "";
+ $pagination = trim((string) filter_input(INPUT_POST, "pagination")) ?: "";
$this->pagination_size = filter_input(INPUT_POST, "pzfacts_per_page", FILTER_SANITIZE_NUMBER_INT) ?: $this->pagination_size;
// --------------------------------------------------------------
@@ -150,7 +150,7 @@ class PlanningAndZoningFacts extends Base {
// Normalize entry dates to Y-m-d or null
// --------------------------------------
$entryFrom = ($pzfact_entry_date_from === "") ? null : date("Y-m-d", strtotime($pzfact_entry_date_from));
- $entryTo = ($pzfact_entry_date_to === "") ? null : date("Y-m-d", strtotime($pzfact_entry_date_to));
+ $entryTo = ($pzfact_entry_date_to === "") ? null : date("Y-m-d", strtotime($pzfact_entry_date_to));
// -------
// Connect
@@ -223,15 +223,15 @@ class PlanningAndZoningFacts extends Base {
// Acres filter (numeric; bind params)
if ($pzfact_acres_from !== '' && $pzfact_acres_to !== '') {
- $clauses[] = "view_pzfacts.pzfact_acres BETWEEN :acres_from AND :acres_to";
+ $clauses[] = "view_pzfacts.pzfact_acres BETWEEN :acres_from AND :acres_to";
$params[':acres_from'] = (float) $pzfact_acres_from;
- $params[':acres_to'] = (float) $pzfact_acres_to;
+ $params[':acres_to'] = (float) $pzfact_acres_to;
} elseif ($pzfact_acres_from !== '') {
- $clauses[] = "view_pzfacts.pzfact_acres = :acres_eq";
- $params[':acres_eq'] = (float) $pzfact_acres_from;
+ $clauses[] = "view_pzfacts.pzfact_acres = :acres_eq";
+ $params[':acres_eq'] = (float) $pzfact_acres_from;
} elseif ($pzfact_acres_to !== '') {
- $clauses[] = "view_pzfacts.pzfact_acres = :acres_eq";
- $params[':acres_eq'] = (float) $pzfact_acres_to;
+ $clauses[] = "view_pzfacts.pzfact_acres = :acres_eq";
+ $params[':acres_eq'] = (float) $pzfact_acres_to;
}
// -----------------------------------------------------
@@ -252,9 +252,9 @@ class PlanningAndZoningFacts extends Base {
// Swap if reversed
if ($entryFrom > $entryTo) {
- $tmp = $entryFrom;
+ $tmp = $entryFrom;
$entryFrom = $entryTo;
- $entryTo = $tmp;
+ $entryTo = $tmp;
}
// Enforce subscription window with your existing policy (reject + notice)
@@ -294,9 +294,9 @@ class PlanningAndZoningFacts extends Base {
$recordset = $stmtCount->fetch(PDO::FETCH_ASSOC);
$count = $recordset ? (int) $recordset["count"] : 0;
- // ---------------------------
+ // ----------------
// Pagination logic
- // ---------------------------
+ // ----------------
switch ($pagination) {
case "first":
$this->pagination_page = 1;
@@ -321,9 +321,12 @@ class PlanningAndZoningFacts extends Base {
// ----------
$sqlData = "SELECT view_pzfacts.*
FROM view_pzfacts
- {$whereSql}
- LIMIT :limit
- OFFSET :offset";
+ {$whereSql}";
+
+ if ($pagination !== 'off') {
+ $sqlData .= " limit :limit
+ offset :offset";
+ }
$stmtData = $connection->prepare($sqlData);
@@ -333,8 +336,10 @@ class PlanningAndZoningFacts extends Base {
$stmtData->bindValue($k, $v, $type);
}
- $stmtData->bindValue(":limit", (int) $this->pagination_size, PDO::PARAM_INT);
- $stmtData->bindValue(":offset", (int) $offset, PDO::PARAM_INT);
+ if ($pagination !== 'off') {
+ $stmtData->bindValue(":limit", (int) $this->pagination_size, PDO::PARAM_INT);
+ $stmtData->bindValue(":offset", (int) $offset, PDO::PARAM_INT);
+ }
$stmtData->execute();
diff --git a/classes/Migrate_BusinessFacts.php b/classes/migrations/Migrate_BusinessFacts.php
similarity index 100%
rename from classes/Migrate_BusinessFacts.php
rename to classes/migrations/Migrate_BusinessFacts.php
diff --git a/classes/Migrate_PZFacts.php b/classes/migrations/Migrate_PZFacts.php
similarity index 100%
rename from classes/Migrate_PZFacts.php
rename to classes/migrations/Migrate_PZFacts.php
diff --git a/classes/Migrate_PermitFacts.php b/classes/migrations/Migrate_PermitFacts.php
similarity index 100%
rename from classes/Migrate_PermitFacts.php
rename to classes/migrations/Migrate_PermitFacts.php
diff --git a/classes/Migrate_Users.php b/classes/migrations/Migrate_Users.php
similarity index 100%
rename from classes/Migrate_Users.php
rename to classes/migrations/Migrate_Users.php
diff --git a/js/autologout.js b/js/autologout.js
index bd77962..64833df 100644
--- a/js/autologout.js
+++ b/js/autologout.js
@@ -2,7 +2,7 @@ let logoutTimer;
function startLogoutTimer() {
// Set the timeout to 30 minutes (adjust as needed)
- const timeoutInMinutes = 15;
+ const timeoutInMinutes = 60;
const timeoutInMillis = timeoutInMinutes * 60 * 1000;
// Clear any existing timer to avoid duplicates
diff --git a/js/searchPZFacts.js b/js/searchPZFacts.js
index d2ac1cd..1558462 100644
--- a/js/searchPZFacts.js
+++ b/js/searchPZFacts.js
@@ -184,6 +184,7 @@ $(document).ready(function () {
$sessionStorage.action = "Export_PZFactsToExcel.export";
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
+ $sessionStorage.pagination = "off";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
@@ -206,6 +207,7 @@ $(document).ready(function () {
$sessionStorage.action = "Export_PZFactsToCSV.export";
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
+ $sessionStorage.pagination = "off";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
@@ -229,6 +231,7 @@ $(document).ready(function () {
$sessionStorage.action = "Print_PZFactsPDF.print";
$sessionStorage.subscription_reference = $sessionStorage.subscription_serial;
+ $sessionStorage.pagination = "off";
sessionStorage.setItem($application, JSON.stringify($sessionStorage));
diff --git a/reports/Export_AllPermitFactsToCSV.php b/reports/Export_AllPermitFactsToCSV.php
index 93c6324..9e8a888 100644
--- a/reports/Export_AllPermitFactsToCSV.php
+++ b/reports/Export_AllPermitFactsToCSV.php
@@ -61,7 +61,7 @@ class Export_AllPermitFactsToCSV extends Base {
// Add CSV headers
$header_array = [
- 'permitfact_serial', 'permitfact_entry_date_verbose', 'permitfact_permit_number', 'permitfact_permit_date_verbose', 'permitfact_project_address', 'permitfact_project_name',
+ 'permitfact_legacy_id', 'permitfact_entry_date_verbose', 'permitfact_permit_number', 'permitfact_permit_date_verbose', 'permitfact_project_address', 'permitfact_project_name',
'permitfact_project_type_verbose', 'project_city_verbose', 'permitfact_project_state', 'permitfact_project_zip', 'permitfact_company', 'permitfact_address',
'permitfact_city_verbose', 'permitfact_state', 'permitfact_zip', 'permitfact_phone', 'permitfact_size', 'permitfact_value', 'permitfact_work_type_verbose',
'permitfact_building_type_verbose', 'permitfact_county_name_verbose', 'permitfact_lot_block', 'permitfact_dist_ll', 'permitfact_owner_name', 'permitfact_owner_address',
diff --git a/reports/Export_PermitFactsToCSV.php b/reports/Export_PermitFactsToCSV.php
index 5903748..d30c310 100644
--- a/reports/Export_PermitFactsToCSV.php
+++ b/reports/Export_PermitFactsToCSV.php
@@ -60,16 +60,24 @@ class Export_PermitFactsToCSV extends Base {
// Add CSV headers
+ $header_array_legacy = [
+ 'PermitFactsID', 'EntryDate', 'PermitNum', 'PermitDate', 'ProjectAddr', 'ProjectName',
+ 'ProjectType', 'ProjectCity', 'ProjectState', 'ProjectZip', 'Company', 'Address',
+ 'City', 'State', 'Zip', 'Phone', 'Size', 'Value', 'WorkType',
+ 'BldgType', 'County', 'Lot_BLK', 'Dist_LL', 'OwnerName', 'OwnerAddress',
+ 'OwnerCity', 'OwnerState', 'OwnerZip', 'OwnerPhone'
+ ];
+
+ fputcsv($output, $header_array_legacy, ',', '"', '\\');
+
$header_array = [
- 'permitfact_serial', 'permitfact_entry_date_verbose', 'permitfact_permit_number', 'permitfact_permit_date_verbose', 'permitfact_project_address', 'permitfact_project_name',
+ 'permitfact_legacy_id', 'permitfact_entry_date_verbose', 'permitfact_permit_number', 'permitfact_permit_date_verbose', 'permitfact_project_address', 'permitfact_project_name',
'permitfact_project_type_verbose', 'project_city_verbose', 'permitfact_project_state', 'permitfact_project_zip', 'permitfact_company', 'permitfact_address',
'permitfact_city_verbose', 'permitfact_state', 'permitfact_zip', 'permitfact_phone', 'permitfact_size', 'permitfact_value', 'permitfact_work_type_verbose',
'permitfact_building_type_verbose', 'permitfact_county_name_verbose', 'permitfact_lot_block', 'permitfact_dist_ll', 'permitfact_owner_name', 'permitfact_owner_address',
'owner_city_verbose', 'permitfact_owner_state', 'permitfact_owner_zip', 'permitfact_owner_phone'
];
- fputcsv($output, $header_array, ',', '"', '\\');
-
foreach ($permits->record as $permit) {
$row = [];
diff --git a/reports/Export_PermitFactsToExcel.php b/reports/Export_PermitFactsToExcel.php
index 0b0b39c..54f9974 100644
--- a/reports/Export_PermitFactsToExcel.php
+++ b/reports/Export_PermitFactsToExcel.php
@@ -87,7 +87,7 @@ class Export_PermitFactsToExcel extends Base {
$spreadsheet->getActiveSheet()->getStyle("A1:AA1")->getFont()->setBold(true);
$spreadsheet->getActiveSheet()->getStyle("A1:AA1")->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB("D3D3D3");
- $spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "permitfact_serial")
+ $spreadsheet->setActiveSheetIndex(0)->setCellValue("A1", "permitfact_legacy_id")
->setCellValue("B1", "Entry Date")
->setCellValue("C1", "Permit Number")
->setCellValue("D1", "Permit Date")
@@ -150,7 +150,7 @@ class Export_PermitFactsToExcel extends Base {
foreach ($permitfacts as $permitfact) {
- $spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permitfact->permitfact_serial);
+ $spreadsheet->getActiveSheet()->setCellValue("A" . $row, (string) $permitfact->permitfact_legacy_id);
$spreadsheet->getActiveSheet()->setCellValue("B" . $row, (string) $permitfact->permitfact_entry_date_verbose);
$spreadsheet->getActiveSheet()->setCellValue("C" . $row, (string) $permitfact->permitfact_permit_number);
$spreadsheet->getActiveSheet()->setCellValue("D" . $row, (string) $permitfact->permitfact_permit_date_verbose);
diff --git a/reports/Print_AllPermitFactsPDF.php b/reports/Print_AllPermitFactsPDF.php
index 9d3ea03..24eb924 100644
--- a/reports/Print_AllPermitFactsPDF.php
+++ b/reports/Print_AllPermitFactsPDF.php
@@ -201,7 +201,7 @@ class PermitFacts_Print extends TCPDF {
$d = [
// Left Side of Card
- 'permitfact_serial' => trim((string) $permit['permitfact_serial']),
+ 'permitfact_legacy_id' => trim((string) $permit['permitfact_legacy_id']),
'permitfact_project_name' => trim((string) $permit['permitfact_project_name']),
'permitfact_permit_number' => trim((string) $permit['permitfact_permit_number']),
'permitfact_project_address' => trim((string) $permit['permitfact_project_address']),
diff --git a/reports/Print_PZFactsPDF.php b/reports/Print_PZFactsPDF.php
index 887c208..a1f9595 100644
--- a/reports/Print_PZFactsPDF.php
+++ b/reports/Print_PZFactsPDF.php
@@ -89,7 +89,7 @@ class PZFacts_Print extends TCPDF {
$userssubscription = (new Users())->getUserSubscription($this->usersubscription_serial);
$user_subscription_start_date = $userssubscription->record->usersubscription_start_date;
- $user_subscription_end_date = $userssubscription->record->usersubscription_end_date;
+ $user_subscription_end_date = $userssubscription->record->usersubscription_end_date;
$planningzoningfacts = (new PlanningAndZoningFacts())->getPZFactsPage($user_subscription_start_date, $user_subscription_end_date);
@@ -185,14 +185,14 @@ class PZFacts_Print extends TCPDF {
$curY = $this->GetY() + 1;
};
- $row2('Project Description:', $d['pzfact_project_description'], 'Project Type:', $d['pzfact_project_type']);
- $row2('Architect/Engineer: ', $d['pzfact_professional_name'], 'Estimated Project Value:', $d['pzfact_dollar_value']);
- $row2('', '', 'District:', $d['pzfact_district']);
- $row2('Owner Name: ', $d['pzfact_owner_name'], 'Land Lot:', $d['pzfact_land_lot']);
- $row2('Owner Address: ', $d['pzfact_owner_address'], 'Action Code:', $d['pzfact_action_code']);
- $row2('Owner Phone: ', $d['pzfact_owner_phone'], 'Action Date:', $d['pzfact_action_date']);
- $row2('', '', 'Lot Acres:', $d['pzfact_acres']);
- $row2('', '', '', '');
+ $row2('Project Description:', $d['pzfact_project_description'], 'Project Type:', $d['pzfact_project_type']);
+ $row2('Architect/Engineer: ', $d['pzfact_professional_name'], 'Estimated Project Value:', $d['pzfact_dollar_value']);
+ $row2('', '', 'District:', $d['pzfact_district']);
+ $row2('Owner Name: ', $d['pzfact_owner_name'], 'Land Lot:', $d['pzfact_land_lot']);
+ $row2('Owner Address: ', $d['pzfact_owner_address'], 'Action Code:', $d['pzfact_action_code']);
+ $row2('Owner Phone: ', $d['pzfact_owner_phone'], 'Action Date:', $d['pzfact_action_date']);
+ $row2('', '', 'Lot Acres:', $d['pzfact_acres']);
+ $row2('', '', '', '');
$row1('Status:', $d['pzfact_status']);
};
@@ -203,19 +203,19 @@ class PZFacts_Print extends TCPDF {
$marginL = 10;
$marginT = 20; // below header area
- $pageW = $this->getPageWidth();
- $pageH = $this->getPageHeight();
+ $pageW = $this->getPageWidth();
+ $pageH = $this->getPageHeight();
$usableW = $pageW - ($marginL * 2);
$usableH = $pageH - $marginT - 12; // leave footer space
- $gapY = 6;
+ $gapY = 6;
// Two rows per page
- $cardW = $usableW;
- $cardH = ($usableH - $gapY) / 2;
+ $cardW = $usableW;
+ $cardH = ($usableH - $gapY) / 2;
- $index = 0;
+ $index = 0;
foreach ($planningzoningfacts->record as $planningzoningfact) {
diff --git a/reports/Print_PermitFactsPDF.php b/reports/Print_PermitFactsPDF.php
index 60e0dfd..63274a9 100644
--- a/reports/Print_PermitFactsPDF.php
+++ b/reports/Print_PermitFactsPDF.php
@@ -221,7 +221,7 @@ class PermitFacts_Print extends TCPDF {
$d = [
// Left Side of Card
- 'permitfact_serial' => trim((string) $permit->permitfact_serial),
+ 'permitfact_legacy_id' => trim((string) $permit->permitfact_legacy_id),
'permitfact_project_name' => trim((string) $permit->permitfact_project_name),
'permitfact_permit_number' => trim((string) $permit->permitfact_permit_number),
'permitfact_project_address' => trim((string) $permit->permitfact_project_address),
diff --git a/xml/settings.xml b/xml/settings.xml
index 3e1490e..305bbc3 100644
--- a/xml/settings.xml
+++ b/xml/settings.xml
@@ -6,16 +6,16 @@
-
-