user card search fix 5

This commit is contained in:
Kavalar 2023-05-04 18:21:23 +03:00
parent 14e2025e73
commit 90eadd4830

View File

@ -4,6 +4,7 @@ namespace backend\modules\card\models;
use backend\modules\employee\models\Manager; use backend\modules\employee\models\Manager;
use backend\modules\employee\models\ManagerEmployee; use backend\modules\employee\models\ManagerEmployee;
use common\classes\Debug;
use common\models\User; use common\models\User;
use Yii; use Yii;
use yii\base\Model; use yii\base\Model;
@ -50,7 +51,7 @@ class UserCardSearch extends UserCard
if (Yii::$app->user->can('show_all_profiles')) { if (Yii::$app->user->can('show_all_profiles')) {
$query = UserCard::find(); $query = UserCard::find();
} else { } else {
$manager = Manager::findOne(Yii::$app->user->id); $manager = Manager::findOne(['user_id' => Yii::$app->user->id]);
if (!$manager){ if (!$manager){
$query = UserCard::find()->where(['id' => 0]); $query = UserCard::find()->where(['id' => 0]);
return new ActiveDataProvider(['query' => $query]); return new ActiveDataProvider(['query' => $query]);
@ -61,7 +62,7 @@ class UserCardSearch extends UserCard
->select('employee_id') ->select('employee_id')
->column(); ->column();
$query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]); $query = UserCard::find()->where(['in', 'user_card.id_user', $employeeIdList]);
} }
} }