Skip to content
Snippets Groups Projects
Commit 923e4bc2 authored by Thomas Hackl's avatar Thomas Hackl
Browse files

check already queried database fields and don't query again, re #175

parent 0fc3b5a2
No related branches found
No related tags found
No related merge requests found
......@@ -313,8 +313,13 @@ class UserFilterField
$parameters = [$userId];
// Additional requirements given...
if (is_array($additional)) {
// Don't use the same database field twice as this can only get ugly.
$usedFields = [$this->userDataDbField];
foreach ($additional as $a_condition) {
if ($a_condition->id != $this->id && $this->userDataDbTable == $a_condition->userDataDbTable) {
if ($a_condition->id != $this->id && $this->userDataDbTable == $a_condition->userDataDbTable &&
!in_array($a_condition->userDataDbField, $usedFields)) {
$query .= " AND `" . $a_condition->userDataDbField . "` " . $a_condition->compareOperator . "?";
$parameters[] = $a_condition->value;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment