From c5850bda46bd560c16b3ee90b9d715ccf3bdec04 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Thu, 4 May 2023 18:05:24 +0300 Subject: [PATCH] user card search fix 3 --- backend/modules/card/models/UserCardSearch.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php index 9999d45..d119172 100755 --- a/backend/modules/card/models/UserCardSearch.php +++ b/backend/modules/card/models/UserCardSearch.php @@ -52,14 +52,16 @@ class UserCardSearch extends UserCard } else { $manager = Manager::findOne(Yii::$app->user->id); if (!$manager){ - return false; + $query = UserCard::find()->where(['id' => 0]); } - $employeeIdList = ManagerEmployee::find() - ->where(['manager_id' => $manager->id]) - ->select('employee_id') - ->column(); + else { + $employeeIdList = ManagerEmployee::find() + ->where(['manager_id' => $manager->id]) + ->select('employee_id') + ->column(); - $query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]); + $query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]); + } } $query->distinct()