From 9412ba14e40b88b84ef5c97395802fc0bbe95614 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 17 Dec 2015 09:39:55 -0700 Subject: [PATCH 1/3] Move the is_numeric($search) to it's own condition --- .../com_patchtester/PatchTester/Model/PullsModel.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index b03148d..fac0f10 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -128,10 +128,14 @@ class PullsModel extends \JModelDatabase if (!empty($search)) { - if (stripos($search, 'id:') === 0 || is_numeric($search)) + if (stripos($search, 'id:') === 0) { $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } + elseif (is_numeric($search)) + { + $query->where('(' . $db->quoteName('a.id') . ' LIKE ' . (int) $search. ')'); + } else { $search = $db->quote('%' . $db->escape($search, true) . '%'); From 9b83c614a430711bcc0eb61c094963d051256f00 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 17 Dec 2015 09:49:36 -0700 Subject: [PATCH 2/3] Fix concat spacing --- .../components/com_patchtester/PatchTester/Model/PullsModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index fac0f10..1630ddc 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -134,7 +134,7 @@ class PullsModel extends \JModelDatabase } elseif (is_numeric($search)) { - $query->where('(' . $db->quoteName('a.id') . ' LIKE ' . (int) $search. ')'); + $query->where('(' . $db->quoteName('a.id') . ' LIKE ' . (int) $search . ')'); } else { From 8052c08aaa9c2b239c7874b60200f3457cc23052 Mon Sep 17 00:00:00 2001 From: photodude Date: Thu, 17 Dec 2015 09:52:59 -0700 Subject: [PATCH 3/3] Correct for search with partial --- .../components/com_patchtester/PatchTester/Model/PullsModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php index 1630ddc..20f7a62 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullsModel.php @@ -134,7 +134,7 @@ class PullsModel extends \JModelDatabase } elseif (is_numeric($search)) { - $query->where('(' . $db->quoteName('a.id') . ' LIKE ' . (int) $search . ')'); + $query->where('(' . $db->quoteName('a.id') . ' LIKE "% ' . (int) $search . '%")'); } else {