add feature word_typed_listener_allowed_only_for_empty_customerf

This commit is contained in:
Schneider Roland 2023-03-24 17:08:51 +01:00
parent beb3c3944e
commit 89fe6a37c1
4 changed files with 35 additions and 17 deletions

View File

@ -552,4 +552,11 @@ class Helper {
return Helper::getArrayValue(\Yii::$app->params ,'door_pass_validity_interval_minutes','10'); return Helper::getArrayValue(\Yii::$app->params ,'door_pass_validity_interval_minutes','10');
} }
public static function isWordTypedListenerAllowedOnlyForEmptyCustomer(){
$key = "word_typed_listener_allowed_only_for_empty_customer";
// return Helper::getArrayValue(\Yii::$app->params ,$key,'0') === '1';
return true;
}
} }

View File

@ -1,5 +1,6 @@
<?php <?php
$REST_ALLOW_VERIFY_ONLY=getenv('FITNESS_REST_ALLOW_VERIFY_ONLY'); $REST_ALLOW_VERIFY_ONLY=getenv('FITNESS_REST_ALLOW_VERIFY_ONLY');
$FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER=getenv('FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER');
return [ return [
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
@ -23,5 +24,6 @@ return [
'reception_show_stock' => false, 'reception_show_stock' => false,
'login_admin_email' => false, 'login_admin_email' => false,
'warn_ticket_expire_in_usage_count' => 10, 'warn_ticket_expire_in_usage_count' => 10,
'rest_allow_verify_only' => $REST_ALLOW_VERIFY_ONLY === 'true' 'rest_allow_verify_only' => $REST_ALLOW_VERIFY_ONLY === 'true',
'word_typed_listener_allowed_only_for_empty_customer' => $FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER,
]; ];

View File

@ -26,6 +26,7 @@ AppAsset::register($this);
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<script> <script>
var reception_card_url = '<?php echo Url::toRoute('customer/reception');?>'; var reception_card_url = '<?php echo Url::toRoute('customer/reception');?>';
var isWordTypedListenerAllowedOnlyForEmptyCustomer = <?= \common\components\Helper::isWordTypedListenerAllowedOnlyForEmptyCustomer() ? 'true' : 'false' ?>
</script> </script>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>

View File

@ -41,8 +41,16 @@ function addDocumentKeypressedListener(){
var word; var word;
word = data.word; word = data.word;
if ( word && word.length > 0){ if ( word && word.length > 0){
var redirectAllowed = true;
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
if ( location.href !== reception_card_url ){
redirectAllowed = false;
console.info("disalbling customer redirect. reason: isWordTypedListenerAllowedOnlyForEmptyCustomer = true")
}
}
if ( redirectAllowed){
location.href= reception_card_url +'&number=' + word; location.href= reception_card_url +'&number=' + word;
}
} }