чистка мусора

This commit is contained in:
maxim
2021-09-06 16:40:05 +03:00
parent 1fc92ac773
commit 1875dacfbb
3 changed files with 7 additions and 13 deletions

View File

@ -2,7 +2,6 @@
namespace backend\modules\reports\models;
use common\classes\Debug;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Reports;
@ -14,8 +13,6 @@ use common\models\Reports;
class ReportsSearch extends Reports
{
public $fio;
public $month;
public $year;
/**
* {@inheritdoc}
@ -66,6 +63,12 @@ class ReportsSearch extends Reports
if (isset($params['date']) and preg_match("/^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/", $params['date']) and !isset($params['id'])) {
$this->created_at = $params['date'];
}
if (isset($params['year'])) {
$query->andFilterWhere(['=', 'YEAR(reports.created_at)', $params['year']]);
}
if (isset($params['month'])) {
$query->andFilterWhere(['=', 'MONTH(reports.created_at)', $params['month']]);
}
// if (!$this->validate()) {
// // uncomment the following line if you do not want to return any records when validation fails
@ -77,7 +80,6 @@ class ReportsSearch extends Reports
// grid filtering conditions
// Debug::dd($params['date']);
$query->andFilterWhere([
'user_card.id' => $this->id,
@ -88,9 +90,7 @@ class ReportsSearch extends Reports
$query->andFilterWhere(['like', 'today', $this->today])
->andFilterWhere(['like', 'difficulties', $this->difficulties])
->andFilterWhere(['like', 'tomorrow', $this->tomorrow])
->andFilterWhere(['like', 'user_card.fio', $this->fio])
->andFilterWhere(['=', 'YEAR(reports.created_at)', $this->year])
->andFilterWhere(['=', 'MONTH(reports.created_at)', $this->month]);
->andFilterWhere(['like', 'user_card.fio', $this->fio]);
return $dataProvider;