From c7185d986b6fcf034c327cd3f018316d5f685313 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Wed, 12 Mar 2025 14:24:04 +0000 Subject: [PATCH] Update ConstructionConsent.php --- .../ConstructionConsent/ConstructionConsent.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php index 39bd972f1..1a31b94d0 100644 --- a/application/ConstructionConsent/ConstructionConsent.php +++ b/application/ConstructionConsent/ConstructionConsent.php @@ -409,6 +409,7 @@ class ConstructionConsent extends mfBaseModel { GROUP BY ConstructionConsent.id $having ORDER BY $order"; +// die($sql); if(is_array($limit) && count($limit)) { if(is_numeric($limit['start']) && is_numeric($limit['count'])) { @@ -580,10 +581,15 @@ class ConstructionConsent extends mfBaseModel { } } - if (array_key_exists("cwo", $filter)) { - $where .= " AND EXISTS - (SELECT 1 FROM ConstructionConsentOwner co WHERE co.constructionconsent_id = ConstructionConsent.id AND - LOWER(CONCAT(co.FIRST_NAME, ' ', co.LAST_NAME)) LIKE LOWER('%".$filter['cwo']."%')"; + if (array_key_exists("cwo", $filter) && !empty($filter['cwo'])) { + $where .= " + AND EXISTS ( + SELECT 1 + FROM ConstructionConsentOwner co + WHERE co.constructionconsent_id = ConstructionConsent.id + AND LOWER(CONCAT(co.firstname, ' ', co.lastname)) LIKE LOWER('%".$filter['cwo']."%') + ) + "; }