From b807262a990b321b2e070ff8291bc62270a416c5 Mon Sep 17 00:00:00 2001 From: SoHardKI Date: Thu, 4 Jul 2019 12:29:42 +0300 Subject: [PATCH] add_orderby_small_fixes --- backend/modules/balance/models/BalanceSearch.php | 3 ++- backend/modules/card/models/UserCardSearch.php | 2 ++ backend/modules/card/views/user-card/update.php | 4 +--- backend/modules/company/models/CompanySearch.php | 3 ++- backend/modules/company/views/company/index.php | 6 +++--- backend/modules/hh/models/HhJobSearch.php | 1 + backend/modules/hh/models/HhSearch.php | 1 + backend/modules/project/models/ProjectSearch.php | 1 + backend/modules/settings/models/AdditionalFieldsSearch.php | 2 +- 9 files changed, 14 insertions(+), 9 deletions(-) diff --git a/backend/modules/balance/models/BalanceSearch.php b/backend/modules/balance/models/BalanceSearch.php index 6a93ca1..0e83d7f 100644 --- a/backend/modules/balance/models/BalanceSearch.php +++ b/backend/modules/balance/models/BalanceSearch.php @@ -54,7 +54,8 @@ class BalanceSearch extends Balance */ public function search($params) { - $query = Balance::find(); + $query = Balance::find()->distinct(); + $query->leftJoin('fields_value_new','fields_value_new.item_id=balance.id AND fields_value_new.item_type=3'); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ diff --git a/backend/modules/card/models/UserCardSearch.php b/backend/modules/card/models/UserCardSearch.php index f51a1c0..cfe1241 100755 --- a/backend/modules/card/models/UserCardSearch.php +++ b/backend/modules/card/models/UserCardSearch.php @@ -82,6 +82,8 @@ class UserCardSearch extends UserCard $query->andFilterWhere(['skill.id' => $this->skills]); + $query->orderBy('user_card.created_at DESC'); + return $dataProvider; } } diff --git a/backend/modules/card/views/user-card/update.php b/backend/modules/card/views/user-card/update.php index 917119b..6d547a2 100755 --- a/backend/modules/card/views/user-card/update.php +++ b/backend/modules/card/views/user-card/update.php @@ -5,15 +5,13 @@ use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $model backend\modules\card\models\UserCard */ -$this->title = 'Update User Card: ' . $model->id; +$this->title = $model->fio; $this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = 'Update'; ?>
-

title) ?>

- render('_form', [ 'model' => $model, ]) ?> diff --git a/backend/modules/company/models/CompanySearch.php b/backend/modules/company/models/CompanySearch.php index e7ef47e..51eac9d 100755 --- a/backend/modules/company/models/CompanySearch.php +++ b/backend/modules/company/models/CompanySearch.php @@ -13,6 +13,7 @@ use backend\modules\company\models\Company; */ class CompanySearch extends Company { +// public $status; /** * {@inheritdoc} */ @@ -43,7 +44,6 @@ class CompanySearch extends Company public function search($params) { $query = Company::find()->joinWith('project'); - // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ @@ -69,6 +69,7 @@ class CompanySearch extends Company $query->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'description', $this->description]); + $query->orderBy('created_at DESC'); return $dataProvider; } diff --git a/backend/modules/company/views/company/index.php b/backend/modules/company/views/company/index.php index d667e7b..527afd1 100755 --- a/backend/modules/company/views/company/index.php +++ b/backend/modules/company/views/company/index.php @@ -42,13 +42,13 @@ $this->params['breadcrumbs'][] = $this->title; //'description:ntext', //'status_id', [ - 'attribute' => 'status', + 'attribute' => 'status_id', 'value' => function($model){ - return isset($model->status0->name) ? $model->status0->name : 'Не задано'; + return isset($model->status->name) ? $model->status->name : 'Не задано'; }, 'filter' => kartik\select2\Select2::widget([ 'model' => $searchModel, - 'attribute' => 'status', + 'attribute' => 'status_id', 'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_COMPANY), 'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'], 'pluginOptions' => [ diff --git a/backend/modules/hh/models/HhJobSearch.php b/backend/modules/hh/models/HhJobSearch.php index 5b5fb40..37b2e81 100755 --- a/backend/modules/hh/models/HhJobSearch.php +++ b/backend/modules/hh/models/HhJobSearch.php @@ -71,6 +71,7 @@ class HhJobSearch extends HhJob ->andFilterWhere(['like', 'url', $this->url]) ->andFilterWhere(['like', 'salary_currency', $this->salary_currency]) ->andFilterWhere(['like', 'address', $this->address]); + $query->orderBy('dt_add DESC'); return $dataProvider; } diff --git a/backend/modules/hh/models/HhSearch.php b/backend/modules/hh/models/HhSearch.php index cac4970..abc098d 100755 --- a/backend/modules/hh/models/HhSearch.php +++ b/backend/modules/hh/models/HhSearch.php @@ -67,6 +67,7 @@ class HhSearch extends Hh $query->andFilterWhere(['like', 'url', $this->url]) ->andFilterWhere(['like', 'title', $this->title]) ->andFilterWhere(['like', 'photo', $this->photo]); + $query->orderBy('dt_add DESC'); return $dataProvider; } diff --git a/backend/modules/project/models/ProjectSearch.php b/backend/modules/project/models/ProjectSearch.php index 65d9c3a..d06dacc 100755 --- a/backend/modules/project/models/ProjectSearch.php +++ b/backend/modules/project/models/ProjectSearch.php @@ -67,6 +67,7 @@ class ProjectSearch extends Project $query->andFilterWhere(['like', 'name', $this->name]) ->andFilterWhere(['like', 'description', $this->description]); + $query->orderBy('created_at DESC'); return $dataProvider; } diff --git a/backend/modules/settings/models/AdditionalFieldsSearch.php b/backend/modules/settings/models/AdditionalFieldsSearch.php index 7a08973..15efbc5 100755 --- a/backend/modules/settings/models/AdditionalFieldsSearch.php +++ b/backend/modules/settings/models/AdditionalFieldsSearch.php @@ -63,7 +63,7 @@ class AdditionalFieldsSearch extends AdditionalFields ]); $query->andFilterWhere(['like', 'name', $this->name]); -// Debug::dd($query->createCommand()->rawSql); + return $dataProvider; } }