change version to v.0.0.14 , add admin menu changes, add collection change
This commit is contained in:
@@ -7,6 +7,7 @@ use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\AccountState;
|
||||
use common\components\RoleDefinition;
|
||||
use common\models\Account;
|
||||
|
||||
/**
|
||||
* AccountStateSearch represents the model behind the search form about `common\models\AccountState`.
|
||||
@@ -54,10 +55,16 @@ class AccountStateSearch extends AccountState
|
||||
{
|
||||
$query = AccountState::find();
|
||||
|
||||
$query->innerJoinWith('account');
|
||||
|
||||
if ( !RoleDefinition::isAdmin() ){
|
||||
$query->innerJoin("user_account_assignment",'account_state.id_account = user_account_assignment.id_account' );
|
||||
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
|
||||
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
|
||||
|
||||
if ( RoleDefinition::isReception()){
|
||||
$query->andWhere(['transfer.id_user' => Yii::$app->user->id ]);
|
||||
}
|
||||
}
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
@@ -76,13 +83,13 @@ class AccountStateSearch extends AccountState
|
||||
$query->orderBy(['created_at' => SORT_DESC]);
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_user' => $this->id_user,
|
||||
'id_account' => $this->id_account,
|
||||
'type' => $this->type,
|
||||
'account_state.id_user' => $this->id_user,
|
||||
'account_state.id_account' => $this->id_account,
|
||||
'account_state.type' => $this->type,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere([ '>=', 'created_at', $this->timestampStart ] );
|
||||
$query->andFilterWhere([ '<', 'created_at', $this->timestampEnd ] );
|
||||
$query->andFilterWhere([ '>=', 'account_state.created_at', $this->timestampStart ] );
|
||||
$query->andFilterWhere([ '<', 'account_state.created_at', $this->timestampEnd ] );
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user