From 9096f800590103139b06f300ddccb3e6073ac516 Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 28 Oct 2021 02:34:20 +0000 Subject: [PATCH 1/2] * Fix bug#15773 --- module/search/model.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/module/search/model.php b/module/search/model.php index 5fb8555fad..6ff5cd09be 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -136,7 +136,15 @@ class searchModel extends model } elseif($operator == "notinclude") { - $condition = ' NOT LIKE ' . $this->dbh->quote("%$value%"); + if($this->post->$fieldName == 'module') + { + $allModules = $this->loadModel('tree')->getAllChildId($value); + if($allModules) $condition = " NOT IN ('" . join("','", $allModules) . "')"; + } + else + { + $condition = ' NOT LIKE ' . $this->dbh->quote("%$value%"); + } } elseif($operator == 'belong') { From c061aac0e18136bb975aa63c0c8809edf6568210 Mon Sep 17 00:00:00 2001 From: zenggang Date: Thu, 28 Oct 2021 07:56:24 +0000 Subject: [PATCH 2/2] * Adjust code style --- module/search/model.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/module/search/model.php b/module/search/model.php index 6ff5cd09be..32e5939de1 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -132,14 +132,22 @@ class searchModel extends model $condition = ''; if($operator == "include") { - $condition = ' LIKE ' . $this->dbh->quote("%$value%"); + if($this->post->$fieldName == 'module') + { + $allModules = $this->loadModel('tree')->getAllChildId($value); + if($allModules) $condition = helper::dbIN($allModules); + } + else + { + $condition = ' LIKE ' . $this->dbh->quote("%$value%"); + } } elseif($operator == "notinclude") { if($this->post->$fieldName == 'module') { $allModules = $this->loadModel('tree')->getAllChildId($value); - if($allModules) $condition = " NOT IN ('" . join("','", $allModules) . "')"; + if($allModules) $condition = " NOT " . helper::dbIN($allModules); } else {