add some key_required property related fix

This commit is contained in:
2017-03-23 18:29:29 +01:00
parent 57e578540c
commit 2b5f5f60fd
2 changed files with 14 additions and 11 deletions

View File

@@ -130,7 +130,7 @@ class CardController extends \backend\controllers\BackendController {
] );
}
} else {
return $this->render ( 'create', [
return $this->render ( 'create', [
'model' => $model
] );
}
@@ -269,7 +269,7 @@ class CardController extends \backend\controllers\BackendController {
$i++;
}else{
// $failed [] = $item;
$sql = "insert into card (number,status,type,created_at,updated_at, rfid_key) values(";
$sql = "insert into card (number,status,type,created_at,updated_at, rfid_key) values( ";
$sql .= " '" .$item['number'] . "'" ;
$sql .= " ," . Card::STATUS_ACTIVE ;
$sql .= " ," . Card::TYPE_RFID;
@@ -383,7 +383,6 @@ class CardController extends \backend\controllers\BackendController {
public function actionRecalculate(){
if (Yii::$app->request->isPost) {
$connection = \Yii::$app->db;
$command = $connection->createCommand( Ticket::$SQL_UPDATE );
@@ -395,14 +394,18 @@ class CardController extends \backend\controllers\BackendController {
$result = $command->execute();
\Yii::info("Door flag cleared: " . $result );
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
$result = $command->execute();
\Yii::info("Key flag fixed: " . $result );
if ( Helper::isKeyRequired()){
\Yii::info("Fixing flag key " );
$command = $connection->createCommand( Card::$SQL_FIX_KEY_STATUS );
$result = $command->execute();
\Yii::info("Fixing flag key ready: " . $result );
}else{
\Yii::info("Clearing flag key " );
$command = $connection->createCommand( Card::$SQL_CLEAR_KEY_STATUS );
$result = $command->execute();
\Yii::info("Clearing flag key ready: " . $result );
}
}
return $this->render("recalculate");
}