Add key controller to add/update keys , add bakcend skin param

This commit is contained in:
2016-02-19 21:33:06 +01:00
parent 84e2badd34
commit 4aa17e5210
10 changed files with 83 additions and 19 deletions

View File

@@ -41,7 +41,16 @@ class KeyToggleForm extends Model
}
public function toggleKey(){
$this->keyModel = Key::find()->andWhere(['rfid_key' => $this->key])->one();
$query= Key::find();
$query->andWhere(['or',
['and',[ 'in','key.number' , [$this->key]],"trim(coalesce(key.number, '')) <>'' " ],
['and', ['in','key.rfid_key' ,[ $this->key ] ],"trim(coalesce(key.rfid_key, '')) <>'' "],
]);
$this->keyModel = $query->one();
if ( isset($this->keyModel) ){
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
if ( count($assignments) > 0){