add app param 'key_required'
This commit is contained in:
@@ -344,6 +344,10 @@ class Helper {
|
||||
public static function isUserCartOn() {
|
||||
return \Yii::$app->params ['user_cart_on'] == true;
|
||||
}
|
||||
|
||||
public static function isKeyRequired() {
|
||||
return \Yii::$app->params ['key_required'] == true;
|
||||
}
|
||||
|
||||
public static function getProductSaleDefaultFocus() {
|
||||
return \Yii::$app->params ['product_sale_default_focus'] ;
|
||||
|
||||
@@ -58,6 +58,7 @@ return [
|
||||
/**
|
||||
* if true, key in/out events will generate doorlog events
|
||||
*/
|
||||
'key_toggle_door_log_enabled' => false
|
||||
|
||||
'key_toggle_door_log_enabled' => false,
|
||||
//if key required for entry trough the door
|
||||
'key_required' => true
|
||||
];
|
||||
|
||||
@@ -57,6 +57,10 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
WHERE c1.type <> 50
|
||||
";
|
||||
|
||||
public static $SQL_CLEAR_KEY_STATUS = "
|
||||
UPDATE card set flag = ( flag & ~(1 << 2 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||
";
|
||||
|
||||
public static $SQL_CLEARS_STATUS_DOOR_IN = "
|
||||
UPDATE card set flag = ( flag & ~(1 << 1 ) ) WHERE card.type <> 50 and card.id_card = :id
|
||||
";
|
||||
@@ -239,9 +243,14 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
||||
}
|
||||
|
||||
public function setFlagsHasKey($hasKey){
|
||||
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
||||
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
if (Helper::isKeyRequired()){
|
||||
$this->flag = $hasKey ? ( $this->flag & ~(1 << Card::$FLAG_KEY) ) : ( $this->flag | 1 << Card::$FLAG_KEY );
|
||||
$this->flag_out = $hasKey ? ( $this->flag_out | 1 << Card::$FLAG_KEY ) : ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||
/** @noinspection PhpUndefinedClassInspection */
|
||||
}else{
|
||||
$this->flag = ( $this->flag & ~(1 << Card::$FLAG_KEY) );
|
||||
$this->flag_out = ( $this->flag_out & ~(1 << Card::$FLAG_KEY) );
|
||||
}
|
||||
\Yii::info("flag has key: ".$this->flag .";".$this->flag_out);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user