-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate username #3
base: master
Are you sure you want to change the base?
Changes from 9 commits
06db0cf
7af7cfc
c1aed66
ac29e05
327b127
9bf4b20
3741c50
0af6658
6ff4a3d
9eb6cd4
824c1d4
97781b0
01c764e
36ae069
18c1a5f
94f52cd
aab31d5
cea972b
22066dc
b661802
24d6f7d
271c98a
d1d95a6
bd2ee1f
d970f82
58a43f3
b5953bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ public function search($params) | |
|
||
// grid filtering conditions | ||
$query->andFilterWhere([ | ||
'id' => $this->id, | ||
'bank_holiday.id' => $this->id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @makhatadze It would be better to use {{Model}}::tableName() instead of hardcoded 'bank_holiday'. |
||
'date' => $this->date, | ||
'created_at' => $this->created_at, | ||
'updated_at' => $this->updated_at, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ class UserSearch extends User | |
{ | ||
public function attributes() | ||
{ | ||
return ['id', 'fullName', 'username', 'email', 'status', 'created_at', 'updated_at', 'logged_at', 'position']; | ||
return ['id', 'fullName', 'department_id', 'username', 'email', 'status', 'created_at', 'updated_at', 'logged_at', 'position']; | ||
} | ||
|
||
/** | ||
|
@@ -27,10 +27,11 @@ public function attributes() | |
public function rules() | ||
{ | ||
return [ | ||
[['id', 'status', 'position'], 'integer'], | ||
[['created_at', 'updated_at', 'logged_at'], 'filter', 'filter' => 'strtotime', 'skipOnEmpty' => true], | ||
[['created_at', 'updated_at', 'logged_at'], 'default', 'value' => null], | ||
[['id', 'status', 'position', 'department_id'], 'integer'], | ||
[['updated_at', 'logged_at'], 'filter', 'filter' => 'strtotime', 'skipOnEmpty' => true], | ||
[['updated_at', 'logged_at'], 'default', 'value' => null], | ||
[['fullName', 'username', 'auth_key', 'password_hash', 'email'], 'safe'], | ||
[['created_at'], 'string'], | ||
]; | ||
} | ||
|
||
|
@@ -62,21 +63,27 @@ public function search($params) | |
'desc' => ["CONCAT(up.firstname, ' ', up.lastname)" => SORT_DESC], | ||
]; | ||
|
||
if (!( $this->load($params) && $this->validate() )) { | ||
|
||
if (!($this->load($params) && $this->validate())) { | ||
return $dataProvider; | ||
} | ||
|
||
|
||
$query->andFilterWhere([ | ||
'id' => $this->id, | ||
'up.id' => $this->id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @makhatadze It would be better to use {{Model}}::tableName() instead of hardcoded 'up'. |
||
'position' => $this->position, | ||
'status' => $this->status, | ||
'department_id' => $this->department_id | ||
]); | ||
|
||
if ($this->created_at !== null) { | ||
$query->andFilterWhere(['between', 'created_at', $this->created_at, $this->created_at + 3600 * 24]); | ||
if ($this->created_at) { | ||
|
||
$query->andFilterWhere([ | ||
'FROM_UNIXTIME(user.created_at, "%Y-%m-%d")' => $this->created_at | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @makhatadze It would be better to use User::tableName() instead of hardcoded 'user'. |
||
]); | ||
} | ||
|
||
if ($this->updated_at !== null) { | ||
if ($this->updated_at) { | ||
$query->andFilterWhere(['between', 'updated_at', $this->updated_at, $this->updated_at + 3600 * 24]); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,6 @@ | |
'roles' => $roles | ||
]) ?> | ||
|
||
<?php $this->registerJsFile('@web/js/user-form.js') ?> | ||
|
||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makhatadze ROLE_ADMINISTRATOR contains ROLE_MANAGER.
ROLE_MANAGER means access granted for ROLE_ADMINISTRATOR too.