change version to v.0.0.14 , add admin menu changes, add collection change
This commit is contained in:
@@ -68,6 +68,22 @@ class Collection extends \common\models\BaseFitnessActiveRecord
|
||||
[['start', 'end', 'created_at', 'updated_at'], 'safe']
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getAccount(){
|
||||
return $this->hasOne( Account::className(), ["id_account" =>"id_account" ] ) ;
|
||||
}
|
||||
|
||||
public function getAccountName(){
|
||||
$result = "";
|
||||
$account = $this->account;
|
||||
if (isset($account)){
|
||||
$result = $account->name;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -116,9 +132,18 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
|
||||
|
||||
$query = new Query();
|
||||
|
||||
$query->innerJoin("account",'account.id_account = collection.id_account' );
|
||||
|
||||
if ( !RoleDefinition::isAdmin() ){
|
||||
$query->innerJoin("user_account_assignment",'collection.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 ]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$query->addSelect( [
|
||||
@@ -129,7 +154,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
|
||||
$query->from('collection');
|
||||
|
||||
$query->andFilterWhere([
|
||||
'id_account' => $idAccount,
|
||||
'collection.id_account' => $idAccount,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['collection.id_user' => $idUser]);
|
||||
|
||||
Reference in New Issue
Block a user