From 7166a31d99ac058651586f1a11acdc3ecda6d733 Mon Sep 17 00:00:00 2001 From: Viktor Pedersen <viktor@dsv.su.se> Date: Wed, 8 Sep 2021 11:12:44 +0200 Subject: [PATCH] testing new matching functionality --- include/Product.php | 5 ++++- include/User.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/Product.php b/include/Product.php index c4f342b..d84ec1d 100644 --- a/include/Product.php +++ b/include/Product.php @@ -110,7 +110,7 @@ class Product extends Entity { return true; } - public function matches($terms) { + public function matches($terms, $matchAll=false) { $terms = $this->specify_search($terms, array('brand', 'name', 'serial', @@ -140,6 +140,9 @@ class Product extends Entity { } } } + if($matchAll && array_diff_assoc($terms, $matches)) { + return array(); + } return $matches; } diff --git a/include/User.php b/include/User.php index aee33f5..18a619d 100644 --- a/include/User.php +++ b/include/User.php @@ -47,7 +47,7 @@ class User extends Entity { return true; } - public function matches($terms) { + public function matches($terms, $matchAll=false) { $terms = $this->specify_search($terms, array('name', 'email', 'notes')); @@ -75,6 +75,9 @@ class User extends Entity { break; } } + if($matchAll && array_diff_assoc($terms, $matches)) { + return array(); + } return $matches; }