fix move out , if usage count reached max usage count
fix gui: card number will be loaded only if form is empty
This commit is contained in:
parent
3d8516c50f
commit
cb1b2e2d13
@ -363,25 +363,8 @@ class KeyDoorManager extends BaseObject
|
|||||||
Yii::info("$ctx->requestId: active ticket count:" . count($activeTickets));
|
Yii::info("$ctx->requestId: active ticket count:" . count($activeTickets));
|
||||||
/** @var Ticket $ticket */
|
/** @var Ticket $ticket */
|
||||||
$ticket = null;
|
$ticket = null;
|
||||||
if (isset($activeTickets) && count($activeTickets) > 0) {
|
|
||||||
for ( $i = 0; ($i < count($activeTickets)) && !isset($ticket); $i++){
|
|
||||||
/**@var $currentTicket Ticket **/
|
|
||||||
$currentTicket = $activeTickets[$i];
|
|
||||||
if ( $currentTicket->usage_count < $currentTicket->max_usage_count){
|
|
||||||
$ticket = $currentTicket;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isset($ticket)) {
|
|
||||||
throw new FitnessException(
|
|
||||||
"$ctx->requestId: No active ticket found for:" . $ctx->card->number,
|
|
||||||
FitnessException::TYPE_BAD_REQUEST,
|
|
||||||
"NOT_FOUND_ACTIVE_TICKET",
|
|
||||||
$ctx
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$ctx->ticket = $ticket;
|
|
||||||
Yii::info("$ctx->requestId: ticket {$ticket->id_ticket} loaded in sec " . $stopWatch->split());
|
|
||||||
|
|
||||||
// load customer
|
// load customer
|
||||||
$customer = $ctx->card->customer;
|
$customer = $ctx->card->customer;
|
||||||
@ -400,6 +383,27 @@ class KeyDoorManager extends BaseObject
|
|||||||
// if direction is in, check if usage count must be increased
|
// if direction is in, check if usage count must be increased
|
||||||
if ($ctx->direction == DoorLog::$DIRECTION_IN) {
|
if ($ctx->direction == DoorLog::$DIRECTION_IN) {
|
||||||
|
|
||||||
|
if (isset($activeTickets) && count($activeTickets) > 0) {
|
||||||
|
for ( $i = 0; ($i < count($activeTickets)) && !isset($ticket); $i++){
|
||||||
|
/**@var $currentTicket Ticket **/
|
||||||
|
$currentTicket = $activeTickets[$i];
|
||||||
|
if ( $currentTicket->usage_count < $currentTicket->max_usage_count){
|
||||||
|
$ticket = $currentTicket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($ticket)) {
|
||||||
|
throw new FitnessException(
|
||||||
|
"$ctx->requestId: No active ticket found for:" . $ctx->card->number,
|
||||||
|
FitnessException::TYPE_BAD_REQUEST,
|
||||||
|
"NOT_FOUND_ACTIVE_TICKET",
|
||||||
|
$ctx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ctx->ticket = $ticket;
|
||||||
|
Yii::info("$ctx->requestId: ticket {$ticket->id_ticket} loaded in sec " . $stopWatch->split());
|
||||||
|
|
||||||
// Key required
|
// Key required
|
||||||
if (!isset($ctx->key)) {
|
if (!isset($ctx->key)) {
|
||||||
throw new FitnessException(
|
throw new FitnessException(
|
||||||
@ -544,7 +548,26 @@ class KeyDoorManager extends BaseObject
|
|||||||
$ctx->virtualKey->save(false);
|
$ctx->virtualKey->save(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set ticket move out counter
|
if (isset($activeTickets) && count($activeTickets) > 0) {
|
||||||
|
for ( $i = 0; ($i < count($activeTickets)) && !isset($ticket); $i++){
|
||||||
|
/**@var $currentTicket Ticket **/
|
||||||
|
$currentTicket = $activeTickets[$i];
|
||||||
|
if ( $currentTicket->count_move_out < $currentTicket->max_usage_count && $currentTicket->count_move_out != $currentTicket->usage_count){
|
||||||
|
$ticket = $currentTicket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($ticket)) {
|
||||||
|
throw new FitnessException(
|
||||||
|
"$ctx->requestId: No active ticket found for:" . $ctx->card->number,
|
||||||
|
FitnessException::TYPE_BAD_REQUEST,
|
||||||
|
"NOT_FOUND_ACTIVE_TICKET",
|
||||||
|
$ctx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$ctx->ticket = $ticket;
|
||||||
|
|
||||||
$ticket->count_move_out = $ticket->usage_count;
|
$ticket->count_move_out = $ticket->usage_count;
|
||||||
if (!$ctx->verifyOnly) {
|
if (!$ctx->verifyOnly) {
|
||||||
$ticket->save(false);
|
$ticket->save(false);
|
||||||
|
|||||||
@ -24,6 +24,7 @@ use yii\web\HttpException;
|
|||||||
* @property string $end
|
* @property string $end
|
||||||
* @property integer $max_usage_count
|
* @property integer $max_usage_count
|
||||||
* @property integer $usage_count
|
* @property integer $usage_count
|
||||||
|
* @property integer $count_move_out
|
||||||
* @property integer $status
|
* @property integer $status
|
||||||
* @property integer $price_brutto
|
* @property integer $price_brutto
|
||||||
* @property integer $part eddig a részletig kell kifizetve lenni
|
* @property integer $part eddig a részletig kell kifizetve lenni
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
FITNESS_REST_ALLOW_VERIFY_ONLY=true
|
FITNESS_REST_ALLOW_VERIFY_ONLY=true
|
||||||
#DOOR_ENTRY_STRATEGY=door_pass
|
#DOOR_ENTRY_STRATEGY=door_pass
|
||||||
FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER=0
|
FITNESS_WORD_TYPED_LISTENER_ALLOWED_ONLY_FOR_EMPTY_CUSTOMER=1
|
||||||
@ -26,7 +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' ?>
|
var isWordTypedListenerAllowedOnlyForEmptyCustomer = <?= \common\components\Helper::isWordTypedListenerAllowedOnlyForEmptyCustomer() ? 'true' : 'false' ?>;
|
||||||
</script>
|
</script>
|
||||||
<?php $this->head() ?>
|
<?php $this->head() ?>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -40,12 +40,17 @@ function addDocumentKeypressedListener(){
|
|||||||
$( document ).on( "wordtyped", function( event, data ) {
|
$( document ).on( "wordtyped", function( event, data ) {
|
||||||
var word;
|
var word;
|
||||||
word = data.word;
|
word = data.word;
|
||||||
|
console.info("word typed",word);
|
||||||
|
console.info("isWordTypedListenerAllowedOnlyForEmptyCustomer",isWordTypedListenerAllowedOnlyForEmptyCustomer);
|
||||||
if ( word && word.length > 0){
|
if ( word && word.length > 0){
|
||||||
var redirectAllowed = true;
|
var redirectAllowed = true;
|
||||||
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
|
if ( isWordTypedListenerAllowedOnlyForEmptyCustomer ){
|
||||||
if ( location.href !== reception_card_url ){
|
let params = new URLSearchParams(location.search)
|
||||||
|
let cardNumber = params.get("number");
|
||||||
|
|
||||||
|
if ( cardNumber && cardNumber.length > 0){
|
||||||
redirectAllowed = false;
|
redirectAllowed = false;
|
||||||
console.info("disalbling customer redirect. reason: isWordTypedListenerAllowedOnlyForEmptyCustomer = true")
|
console.info("redirect disabled! number param exists", word, cardNumber );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( redirectAllowed){
|
if ( redirectAllowed){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user