change version to v.0.0.14 , add admin menu changes, add collection change

This commit is contained in:
Roland Schneider 2016-01-03 19:16:44 +01:00
parent 76ec26039f
commit dcb4e862b3
6 changed files with 59 additions and 8 deletions

View File

@ -4,6 +4,7 @@ namespace backend\components;
use Yii; use Yii;
use common\models\Order; use common\models\Order;
use yii\helpers\Html; use yii\helpers\Html;
use common\components\RoleDefinition;
class AdminMenuStructure{ class AdminMenuStructure{
@ -43,18 +44,22 @@ class AdminMenuStructure{
///////////////////////////// /////////////////////////////
// Beállítások // Beállítások
///////////////////////////// /////////////////////////////
if ( RoleDefinition::isAdmin()){
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']]; $items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
$items[] = ['label' => 'Jogosultságok', 'url' =>['/user/role']]; $items[] = ['label' => 'Jogosultságok', 'url' =>['/user/role']];
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl, $this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
'items' => $items 'items' => $items
]; ];
}
///////////////////////////// /////////////////////////////
// Törszadatok // Törszadatok
///////////////////////////// /////////////////////////////
$items = []; $items = [];
$items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']]; $items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']];
$items[] = ['label' => 'Kasszák', 'url' =>['/account/index']]; if ( RoleDefinition::isAdmin()){
$items[] = ['label' => 'Kasszák', 'url' =>['/account/index']];
}
$items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index'] ]; $items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index'] ];
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ]; $items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ]; $items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];

View File

@ -7,6 +7,7 @@ use yii\base\Model;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use common\models\AccountState; use common\models\AccountState;
use common\components\RoleDefinition; use common\components\RoleDefinition;
use common\models\Account;
/** /**
* AccountStateSearch represents the model behind the search form about `common\models\AccountState`. * AccountStateSearch represents the model behind the search form about `common\models\AccountState`.
@ -54,10 +55,16 @@ class AccountStateSearch extends AccountState
{ {
$query = AccountState::find(); $query = AccountState::find();
$query->innerJoinWith('account');
if ( !RoleDefinition::isAdmin() ){ if ( !RoleDefinition::isAdmin() ){
$query->innerJoin("user_account_assignment",'account_state.id_account = user_account_assignment.id_account' ); $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(['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([ $dataProvider = new ActiveDataProvider([
@ -76,13 +83,13 @@ class AccountStateSearch extends AccountState
$query->orderBy(['created_at' => SORT_DESC]); $query->orderBy(['created_at' => SORT_DESC]);
$query->andFilterWhere([ $query->andFilterWhere([
'id_user' => $this->id_user, 'account_state.id_user' => $this->id_user,
'id_account' => $this->id_account, 'account_state.id_account' => $this->id_account,
'type' => $this->type, 'account_state.type' => $this->type,
]); ]);
$query->andFilterWhere([ '>=', 'created_at', $this->timestampStart ] ); $query->andFilterWhere([ '>=', 'account_state.created_at', $this->timestampStart ] );
$query->andFilterWhere([ '<', 'created_at', $this->timestampEnd ] ); $query->andFilterWhere([ '<', 'account_state.created_at', $this->timestampEnd ] );
return $dataProvider; return $dataProvider;
} }

View File

@ -8,6 +8,7 @@ use yii\data\ActiveDataProvider;
use common\models\Collection; use common\models\Collection;
use common\components\Helper; use common\components\Helper;
use common\components\RoleDefinition; use common\components\RoleDefinition;
use common\models\Account;
/** /**
* CollectionSearch represents the model behind the search form about `common\models\Collection`. * CollectionSearch represents the model behind the search form about `common\models\Collection`.
@ -57,10 +58,19 @@ class CollectionSearch extends Collection
{ {
$query = Collection::find(); $query = Collection::find();
$query->innerJoinWith('account');
if ( !RoleDefinition::isAdmin() ){ if ( !RoleDefinition::isAdmin() ){
$query->innerJoin("user_account_assignment",'collection.id_account = user_account_assignment.id_account' ); $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(['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([ $dataProvider = new ActiveDataProvider([

View File

@ -1,3 +1,7 @@
-0.0.14
- add hidden account
- add cart payout/delete per row
-
-0.0.13 -0.0.13
- add new profile rocho-net - add new profile rocho-net
-0.0.12 -0.0.12

View File

@ -3,5 +3,5 @@ return [
'adminEmail' => 'rocho02@gmail.com', 'adminEmail' => 'rocho02@gmail.com',
'supportEmail' => 'rocho02@gmail.com', 'supportEmail' => 'rocho02@gmail.com',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.13' 'version' => 'v0.0.14'
]; ];

View File

@ -69,6 +69,22 @@ class Collection extends \common\models\BaseFitnessActiveRecord
]; ];
} }
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 * @inheritdoc
*/ */
@ -116,9 +132,18 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
$query = new Query(); $query = new Query();
$query->innerJoin("account",'account.id_account = collection.id_account' );
if ( !RoleDefinition::isAdmin() ){ if ( !RoleDefinition::isAdmin() ){
$query->innerJoin("user_account_assignment",'collection.id_account = user_account_assignment.id_account' ); $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(['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( [ $query->addSelect( [
@ -129,7 +154,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
$query->from('collection'); $query->from('collection');
$query->andFilterWhere([ $query->andFilterWhere([
'id_account' => $idAccount, 'collection.id_account' => $idAccount,
]); ]);
$query->andFilterWhere(['collection.id_user' => $idUser]); $query->andFilterWhere(['collection.id_user' => $idUser]);