add id_account to door log, add key import to backend with no menu

This commit is contained in:
2016-02-16 21:42:13 +01:00
parent 6221945bb7
commit 0ce6958e0b
11 changed files with 312 additions and 138 deletions

View File

@@ -30,7 +30,7 @@ class DoorLogSearch extends DoorLog
public function rules()
{
return [
[[ 'direction', 'type'], 'integer'],
[[ 'direction', 'type' ,'id_customer','id_account'], 'integer'],
[['created_at'], 'safe'],
[['searchCardNumber','searchCustomerName','searchKeyName'], 'safe'],
// [[ 'start', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
@@ -81,11 +81,13 @@ class DoorLogSearch extends DoorLog
'customer.id_customer as customer_id_customer',
'door_log.direction as door_log_direction',
'door_log.created_at as door_log_created_at',
'door_log.source_app as door_log_source_app'
'door_log.source_app as door_log_source_app',
'account.name as account_name'
]);
$query->from('door_log');
$query->innerJoin('card','card.id_card = door_log.id_card');
$query->leftJoin('key','key.id_key = door_log.id_key');
$query->leftJoin('account','account.id_account = door_log.id_account');
$query->leftJoin('customer','customer.id_customer = door_log.id_customer');
$dataProvider = new ActiveDataProvider([
@@ -125,6 +127,10 @@ class DoorLogSearch extends DoorLog
'door_log_type' =>[
'asc' => ['door_log.type' => SORT_ASC ],
'desc' => ['door_log.type' => SORT_DESC],
],
'account_name' =>[
'asc' => ['account.name' => SORT_ASC ],
'desc' => ['account.name' => SORT_DESC],
]
],
]
@@ -139,15 +145,9 @@ class DoorLogSearch extends DoorLog
}
$query->andFilterWhere([
// 'id_door_log' => $this->id_door_log,
// 'id_card' => $this->id_card,
// 'id_customer' => $this->id_customer,
// 'id_key' => $this->id_key,
'direction' => $this->direction,
'id_customer' => $this->id_customer
// 'type' => $this->type,
// 'created_at' => $this->created_at,
'door_log.direction' => $this->direction,
'door_log.id_customer' => $this->id_customer,
'account.id_account' => $this->id_account,
]);
$query->andFilterWhere(['>=', 'door_log.created_at', $this->timestampStart]);