Various Issues have been resolved in this commit.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user