diff --git a/backend/components/ContractManager.php b/backend/components/ContractManager.php new file mode 100644 index 0000000..652e2be --- /dev/null +++ b/backend/components/ContractManager.php @@ -0,0 +1,162 @@ + $id_ticket_installment_request]); + + if (!isset($request)) { + throw new NotFoundHttpException("ticket_installment_request not found #" . $id_ticket_installment_request); + } + + // if status does not support open, return + if (!( + $request->status == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL + || $request->status == TicketInstallmentRequest::$STATUS_CANCELED + || $request->status == TicketInstallmentRequest::$STATUS_REJECTED + ) + ) { + $this->info("request can't be opened with status " . TicketInstallmentRequest::toStatusName($request->status)); + return; + } + + $contract = Contract::findOne($request->id_contract); + + if (!isset($contract)) { + throw new NotFoundHttpException("contract not found #" . $id_ticket_installment_request); + } + + $this->openTicketInstallmentRequest($contract, $request); + + $this->putToCart($contract, $request); + + } + + /** + * If status is + * TicketInstallmentRequest::$STATUS_ACCEPTED: nothing to do, automatic purchase was successful + * TicketInstallmentRequest::$STATUS_PENDING: nothing to do, automatic purchase was successful + * TicketInstallmentRequest::$STATUS_MARKED_TO_SEND: nothing to do, automatic purchase was successful + * TicketInstallmentRequest::$STATUS_SENT: nothing to do, automatic purchase was successful + * TicketInstallmentRequest::$STATUS_SENT: nothing to do, automatic purchase was successful + * + * @param $contract \common\models\Contract + * @param $part \common\models\TicketInstallmentRequest + * @throws \Exception + * @throws \Throwable + */ + public function openTicketInstallmentRequest($contract, $part) + { + $statusChanged = false; + if ($part->status == TicketInstallmentRequest::$STATUS_CANCELED) { + $part->status = TicketInstallmentRequest::$STATUS_PENDING; + $part->request_processed_at = null; + $statusChanged = true; + } + + if ($part->status == TicketInstallmentRequest::$STATUS_REJECTED) { + $part->status = TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL; + $statusChanged = true; + } + + + if ($statusChanged) { + $part->save(false); + if (!$contract->isFlagActive()) { + $contract->flag = Contract::$FLAG_ACTIVE; + $contract->save(false); + } + } + + } + + /** + * @param $contract + * @param $part + * @throws \Exception + */ + private function putToCart($contract, $part) + { + /** @var \common\models\Ticket $ticket */ + $ticket = Ticket::findOne(['id_ticket' => $part->id_ticket]); + + if (isset($ticket)) { + $this->info("Ticket found: " . $ticket->id_ticket . "/" . $ticket->ticketType->name); + + // inactivate ticket + if ($ticket->status != Ticket::STATUS_INACTIVE) { + $ticket->status = Ticket::STATUS_INACTIVE; + $ticket->save(false); + } + + // set transfer status to not paid + /** @var \common\models\Transfer $transfer */ + $transfer = $ticket->transfer; + if ($transfer->status != Transfer::STATUS_NOT_PAID) { + // clean up transfer paid status + $statusOriginal = $transfer->status; + $transfer->status = Transfer::STATUS_NOT_PAID; + $transfer->paid_at = null; + $transfer->paid_by = null; + $transfer->payment_method = null; + $transfer->save(false); + + $this->info("Restore transfer: "); + $this->info($transfer->id_transfer); + $this->info(Transfer::toStatusName($statusOriginal) . "->" . Ticket::toStatusName($transfer->status)); + } + + // check shopping cart + $cart = ShoppingCart::findOne(['id_transfer' => $transfer->id_transfer]); + // put transfer into cart if it is not there + if (!isset($cart)) { + $cart = new ShoppingCart(); + $cart->id_customer = $contract->customer->id_customer; + $cart->id_transfer = $transfer->id_transfer; + if (!$cart->save(false)) { + /** @noinspection SpellCheckingInspection */ + $E_FAILED_TO_SAVE = "Vendég kosár hozzárendelés sikertelen!"; + \Yii::error($E_FAILED_TO_SAVE); + throw new \Exception($E_FAILED_TO_SAVE); + } + } + + } + } + + private function info($message) + { + \Yii::info($message); + } + +} diff --git a/backend/controllers/ContractController.php b/backend/controllers/ContractController.php index 090a8e2..d181de4 100644 --- a/backend/controllers/ContractController.php +++ b/backend/controllers/ContractController.php @@ -2,15 +2,14 @@ namespace backend\controllers; +use backend\components\ContractManager; use Yii; use common\models\Contract; use backend\models\ContractSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; -use yii\filters\VerbFilter; use backend\models\ContractCustomerSearch; use common\models\Customer; -use yii\db\Query; use backend\models\ContractRequestSearch; use common\models\TicketInstallmentRequest; use common\models\Ticket; @@ -64,6 +63,7 @@ class ContractController extends Controller { /** * Lists all Contract models. * + * @param $id * @return mixed * @throws NotFoundHttpException */ @@ -197,17 +197,21 @@ class ContractController extends Controller { ], [ 'id_contract' => $model->id_contract ] ); - $ticket = Ticket::find ()->andWhere ( [ + + /** @var \common\models\Ticket $ticket */ + $ticket = Ticket::find ()->andWhere ( [ 'id_contract' => $model->id_contract ] )->one (); - - $transfer = Transfer::find ()->andWhere ( [ + + + /** @var \common\models\Transfer $transfer */ + $transfer = Transfer::find ()->andWhere ( [ 'type' => Transfer::TYPE_TICKET ] )->andWhere ( [ 'id_object' => $ticket->id_ticket ] )->one (); - $transfer->storno (); + $transfer->storno(); $tx->commit (); // $tx->rollBack(); @@ -239,8 +243,7 @@ class ContractController extends Controller { 'contract' => $contract ] ); - // $searchModel->contract = $contract; - + $dataProvider = $searchModel->search ( Yii::$app->request->queryParams ); return $this->render ( 'details', [ @@ -249,6 +252,16 @@ class ContractController extends Controller { 'dataProvider' => $dataProvider ] ); } + + /** + * @param $id + * @throws NotFoundHttpException + * @throws \Throwable + */ + public function actionRequestToCart($id){ + $contractManager = new ContractManager(); + $contractManager->openRequestAndPutItItoCart($id); + } /** * Finds the Contract model based on its primary key value. diff --git a/backend/controllers/TicketInstallmentRequestController.php b/backend/controllers/TicketInstallmentRequestController.php index 6352b33..1821ee3 100644 --- a/backend/controllers/TicketInstallmentRequestController.php +++ b/backend/controllers/TicketInstallmentRequestController.php @@ -2,9 +2,11 @@ namespace backend\controllers; +use backend\components\ContractManager; use Yii; use common\models\TicketInstallmentRequest; use backend\models\TicketInstallmentRequestSearch; +use yii\helpers\Url; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; @@ -58,7 +60,7 @@ class TicketInstallmentRequestController extends Controller { $searchModel = new TicketInstallmentRequestSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - + Url::remember('',"ticket-installment-request/index"); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -84,29 +86,31 @@ class TicketInstallmentRequestController extends Controller 'dataProvider' => $dataProvider, ]); } - - - public function actionAccept( $id ) + + + /** + * @param $id + * @return \yii\web\Response + * @throws NotFoundHttpException + */ + public function actionAccept($id ) { $model = $this->findModel($id); - + if ( !$model->isStatusAccepted() ){ $model->applyStatus(TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL,true); \Yii::$app->session->setFlash('success',"Megbízás teljesítve"); } -// else{ - -// } - -// echo "asdff"; - + return $this->redirect(['ticket-installment-request/view', 'id' => $model->id_ticket_installment_request, ]); } + /** * Lists pending TicketInstallmentRequest models. * @return mixed + * @throws \Exception */ public function actionDownloadGiro() { @@ -132,6 +136,7 @@ class TicketInstallmentRequestController extends Controller * Displays a single TicketInstallmentRequest model. * @param integer $id * @return mixed + * @throws NotFoundHttpException */ public function actionView($id) { @@ -163,6 +168,7 @@ class TicketInstallmentRequestController extends Controller * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed + * @throws NotFoundHttpException */ public function actionUpdate($id) { @@ -182,6 +188,8 @@ class TicketInstallmentRequestController extends Controller * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed + * @throws NotFoundHttpException + * @throws \yii\db\StaleObjectException */ public function actionDelete($id) { @@ -192,10 +200,23 @@ class TicketInstallmentRequestController extends Controller public function actionTest( ) { - return $this->render('test'); } + /** + * @param $id + * @return string + * @throws NotFoundHttpException + * @throws \Throwable + */ + public function actionPutToCart($id ) + { + + $contractManager = new ContractManager(); + $contractManager->openRequestAndPutItItoCart($id); + return $this->redirect( Url::previous("ticket-installment-request/index")); + } + /** * Finds the TicketInstallmentRequest model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. diff --git a/backend/models/InventoryItemForm.php b/backend/models/InventoryItemForm.php index 69f4651..ff7d9f1 100644 --- a/backend/models/InventoryItemForm.php +++ b/backend/models/InventoryItemForm.php @@ -3,15 +3,12 @@ namespace backend\models; use common\models\Waste; -use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */ - Yii; use yii\base\Model; use common\models\Inventory; use yii\base\Exception; use common\models\Product; use common\models\InventoryGroup; use common\models\InventoryItem; -use yii\db\Expression; use yii\db\Query; use common\models\Procurement; use common\models\Transfer; @@ -93,8 +90,12 @@ class InventoryItemForm extends Model{ } } } - - public function save(){ + + /** + * @return bool + * @throws \Exception + */ + public function save(){ $this->loadLastInventory(); $this->loadLastInventoryItem(); @@ -162,9 +163,6 @@ class InventoryItemForm extends Model{ $query->andWhere([ '>', 'procurement.created_at' ,$this->last_inventory_item->created_at]); } - //$query->andWhere([ '>', 'procurement.created_at' ,$this->inventory->created_at]); - - if ( $this->type == 'product') { $query->andWhere(['product.id_product' => $this->product->id_product]); }else{ @@ -253,8 +251,11 @@ class InventoryItemForm extends Model{ $this->last_inventory_item = $query->one(); } } - - public function read(){ + + /** + * @throws Exception + */ + public function read(){ $this->loadInventory(); @@ -264,11 +265,14 @@ class InventoryItemForm extends Model{ $this->buildProductList(); } - - public function loadInventory(){ + + /** + * @throws Exception + */ + public function loadInventory(){ $this->inventory = Inventory::findOne($this->id_inventory); if ( !isset( $this->inventory) ){ - throw new Exception("Nem található a leltár objektum"); + throw new Exception("Nem található a leltár "); } } public function loadLastInventory(){ diff --git a/backend/views/ticket-installment-request/_index_view.php b/backend/views/ticket-installment-request/_index_view.php index f07aac2..5adf002 100644 --- a/backend/views/ticket-installment-request/_index_view.php +++ b/backend/views/ticket-installment-request/_index_view.php @@ -1,181 +1,192 @@ - - - + + +
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Megbízás azonosító - - - - Megbízás státusza - - - - Megbízás összege - - -
- Megbízás esedékességének dátuma - - formatter->asDatetime( $model['request_request_target_time_at'] );?> - - Megbízás elindításának ideje - - formatter->asDatetime( $model['request_sent_at'] );?> - - Megbízás feldoglozásának ideje - - formatter->asDatetime( $model['request_processed_at'] );?> -
- Megbízás prioritása - - - - Köteg azonosító - - - - Szerződés azonosító - - -
- Vendég azonosító - - - - Vendég neve - - - - Kártyaszám - - -
- Bérlet azonosító - - - - Bérlet típus - - - - Bérlet státusza - - -
- Bérlet érvényességének kezdete - - formatter->asDate( $model['ticket_start'] ) ;?> - - Bérlet érvényességének vége - - formatter->asDate( $model['ticket_end'] ) ;?> - - -
- Tétel sorszám - - - - - - -
-
- $model['ugiro_id_ugiro']] ,[ 'class' => 'btn btn-primary']); - } - echo Html::a("Megbízás részletek",['ticket-installment-request/view', 'id' => $model['request_id_ticket_installment_request']] ,[ 'class' => 'btn btn-primary']); - if ( !empty( $model['ticket_id_ticket'] )){ - echo Html::a("Szerződés megbízásai",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_contract]' => $model['request_id_contract']] ,[ 'class' => 'btn btn-primary']); - } - ?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Megbízás azonosító + + + + Megbízás státusza + + + + Megbízás összege + + +
+ Megbízás esedékességének dátuma + + formatter->asDatetime($model['request_request_target_time_at']); ?> + + Megbízás elindításának ideje + + formatter->asDatetime($model['request_sent_at']); ?> + + Megbízás feldoglozásának ideje + + formatter->asDatetime($model['request_processed_at']); ?> +
+ Megbízás prioritása + + + + Köteg azonosító + + + + Szerződés azonosító + + +
+ Vendég azonosító + + + + Vendég neve + + + + Kártyaszám + + +
+ Bérlet azonosító + + + + Bérlet típus + + + + Bérlet státusza + + +
+ Bérlet érvényességének kezdete + + formatter->asDate($model['ticket_start']); ?> + + Bérlet érvényességének vége + + formatter->asDate($model['ticket_end']); ?> + + +
+ Tétel sorszám + + + + + + +
+
+ $model['ugiro_id_ugiro']], ['class' => 'btn btn-primary']); + } + echo Html::a("Megbízás részletek", ['ticket-installment-request/view', 'id' => $model['request_id_ticket_installment_request']], ['class' => 'btn btn-primary']); + if (!empty($model['ticket_id_ticket'])) { + echo Html::a("Szerződés megbízásai", ['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_contract]' => $model['request_id_contract']], ['class' => 'btn btn-primary']); + } + if (TicketInstallmentRequest::canBePutToCustomerCart($model['request_status'])) { + echo Html::a("Kosárba helyez", ['ticket-installment-request/put-to-cart' , 'id' => $model['request_id_ticket_installment_request']], + [ + 'class' => 'btn btn-danger', + 'data-method' => 'POST' + ] + ); + } + ?> +
+
+
-
-
-
\ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 7748701..28b0949 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +-0.1.12 + - add ticket installment request reopen + - inventory no inactive products + - warning for expires soon -0.1.11 - add rest application and ge -0.1.10 @@ -300,4 +304,4 @@ -0.0.2 alpha verzió -0.0.1 - alap alkalmazás \ No newline at end of file + alap alkalmazás diff --git a/common/config/params.php b/common/config/params.php index df281ef..706dc79 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -5,7 +5,7 @@ return [ 'supportEmail' => 'rocho02@gmail.com', 'infoEmail' => 'info@rocho-net.hu', 'user.passwordResetTokenExpire' => 3600, - 'version' => 'v0.1.11', + 'version' => 'v0.1.12', 'company' => 'movar',//gyor 'company_name' => "Freimann Kft.", 'product_visiblity' => 'account',// on reception which products to display. account or global @@ -61,5 +61,8 @@ return [ 'key_toggle_door_log_enabled' => false, //if key required for entry trough the door 'key_required' => true, - 'ticket_type_door_allowed_check_on' => false + 'ticket_type_door_allowed_check_on' => false, + 'warn_ticket_expire_in_days_count' => 3, + 'warn_ticket_expire_in_usage_count' => 3, + 'inventory.products.only.active' => true ]; diff --git a/common/models/Inventory.php b/common/models/Inventory.php index aea60ec..460fd2c 100644 --- a/common/models/Inventory.php +++ b/common/models/Inventory.php @@ -71,7 +71,7 @@ class Inventory extends \common\models\BaseFitnessActiveRecord } - public function validateOnlyClosed($attribute,$params){ + public function validateOnlyClosed( ){ $opened = Inventory::find()->andWhere(['status' => Inventory::$STATUS_OPEN])->all(); if ( count($opened) > 0 ){ $this->addError("name","Kérem előbb zárjon le minden másik leltárt"); @@ -93,21 +93,31 @@ class Inventory extends \common\models\BaseFitnessActiveRecord ] ], parent::behaviors()); } - + + /** + * @param $insert + * @param $changedAttributes + * @throws \Exception + */ public function afterSave($insert, $changedAttributes){ if ( $insert ){ $query = Product::find(); if ( isset($this->id_account) && is_numeric($this->id_account)){ $query->andWhere(['id_account' => $this->id_account]); - } + + if ( \Yii::$app->params['inventory.products.only.active']) { + $query->andWhere( ['status' => Product::STATUS_ACTIVE] ); + } + $products = $query->all(); $inventoryGroups = InventoryGroup::find()->all(); - - - foreach ($products as $product){ + + + /** @var \common\models\Product $product */ + foreach ($products as $product){ $form = new InventoryItemForm( [ 'inventory' => $this, @@ -118,8 +128,9 @@ class Inventory extends \common\models\BaseFitnessActiveRecord ); $form->save(); } - - foreach ($inventoryGroups as $group){ + + /** @var \common\models\InventoryGroup $group */ + foreach ($inventoryGroups as $group){ $form = new InventoryItemForm( [ 'inventory' => $this, diff --git a/common/models/Ticket.php b/common/models/Ticket.php index 9c65928..31d8b72 100644 --- a/common/models/Ticket.php +++ b/common/models/Ticket.php @@ -36,6 +36,8 @@ use common\components\Helper; * * @property \common\models\Card card * @property \common\models\Ticket transfer + * @property \common\models\TicketType ticketType + * @property \common\models\Discount discount */ class Ticket extends \common\models\BaseFitnessActiveRecord { @@ -424,5 +426,47 @@ class Ticket extends \common\models\BaseFitnessActiveRecord public function afterDelete(){ Card::updateCardFlagTicket($this->id_card);; } - + + /** + * @throws \Exception + */ + public function getMinutesUntilExpire(){ + $end = new \DateTime( $this->end ); + $today = new \DateTime(); + $today->setTime(0,0); + + if ( $today > $end ){ + return -1; + } + + $seconds = $end->getTimestamp() - $today->getTimestamp(); + $minutes = $seconds /60; + return $minutes; + } + + /** + * @throws \Exception + */ + public function getDaysUntilExpire(){ + $minutes = $this->getMinutesUntilExpire(); + $days = $minutes / 60 /24; + return $days; + } + + /** + * Get free usage count. + * @return bool|int + */ + public function getOpenUsageCount(){ + if ( !isset($this->max_usage_count) || $this->max_usage_count <= 0){ + return false; + } + $usageCount = $this->usage_count; + if ( !isset($usageCount) ){ + $usageCount = 0; + } + return max($this->max_usage_count - $usageCount,0); + } + + } diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php index ffacd06..a55e5f4 100644 --- a/common/models/TicketInstallmentRequest.php +++ b/common/models/TicketInstallmentRequest.php @@ -342,5 +342,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord public function getStatusName(){ return static::toStatusName($this->status); } - + + public static function canBePutToCustomerCart($status){ + return $status == TicketInstallmentRequest::$STATUS_CANCELED + || + $status == TicketInstallmentRequest::$STATUS_REJECTED + || + $status == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL; + } } diff --git a/console/controllers/ContractController.php b/console/controllers/ContractController.php index 316f244..306b0fd 100644 --- a/console/controllers/ContractController.php +++ b/console/controllers/ContractController.php @@ -2,6 +2,7 @@ namespace console\controllers; +use backend\components\ContractManager; use common\models\Card; use common\models\Contract; use common\models\Customer; @@ -15,6 +16,17 @@ use yii\console\Exception; class ContractController extends Controller { + + /** + * @param $requestId + * @throws \Throwable + * @throws \yii\web\NotFoundHttpException + */ + public function actionRequestToCart($requestId){ + $contractManager = new ContractManager(); + $contractManager->openRequestAndPutItItoCart($requestId); + } + /** * @param $cardNumber * @throws Exception @@ -84,15 +96,15 @@ class ContractController extends Controller ); } else if ($part->isStatusAccepted()) { $this->info("loading ticket: #" .$part->id_ticket); + /** @var \common\models\Ticket $ticket */ $ticket = null; - try{ - /** @var \common\models\Ticket $ticket */ - // $ticket = Ticket::findOne(['id_ticket' => $part->id_ticket]); + try { + $ticket = Ticket::findOne(['id_ticket' => $part->id_ticket]); }catch (\Throwable $e){ \Yii::info("Failed to load ticket: " . $e->getMessage()); } if (isset($ticket)) { - $this->info("Ticket found: " . $ticket->id_ticket . "/" . $ticket->ticetType->name); + $this->info("Ticket found: " . $ticket->id_ticket . "/" . $ticket->ticketType->name); if ($ticket->status == Ticket::STATUS_DELETED) { $ticket->status = Ticket::STATUS_ACTIVE; $ticket->save(false); @@ -148,4 +160,4 @@ class ContractController extends Controller echo $msg . "\n"; } -} \ No newline at end of file +} diff --git a/frontend/views/common/_reception_ticket.php b/frontend/views/common/_reception_ticket.php index 70fd006..4997a8c 100644 --- a/frontend/views/common/_reception_ticket.php +++ b/frontend/views/common/_reception_ticket.php @@ -9,7 +9,8 @@ use yii\helpers\Url; ?> -tickets) > 0 ){ $ticket = $model->tickets[0]; @@ -36,8 +37,6 @@ if ( isset($model->card)){ echo " - "; echo Yii::$app->formatter->asDate($ticket->end); echo Html::endTag("div"); - - }else{ echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]); echo Html::beginTag("strong",[ ]); @@ -45,6 +44,66 @@ if ( isset($model->card)){ echo Html::endTag("strong"); echo Html::endTag("div"); } + + //// ////////////////////////////////// + /// Warn if expires soon + /// /////////////////////////////////// + $propertyWarnTicketExpireInDaysCount = \Yii::$app->params['warn_ticket_expire_in_days_count']; + $propertyWarnTicketExpireInUsageCount = \Yii::$app->params['warn_ticket_expire_in_usage_count']; + $showWarningExpires = false; + + // expires in days + if ( $propertyWarnTicketExpireInDaysCount > 0 ){ + $warnMessageTicketExpireInDaysCountTemplate = "A bérlet már csak {day} érvényes"; + $expiresInDays = $ticket->getDaysUntilExpire(); + $warnMessageTicketExpire = $expiresInDays; + if ( $expiresInDays <= $propertyWarnTicketExpireInDaysCount ){ + $showWarningExpires = true; + $variables = array( + '{day}' => $expiresInDays > 0 ? " $expiresInDays napig" : "ma", + ); + $warnMessageTicketExpire = strtr($warnMessageTicketExpireInDaysCountTemplate, $variables); + } + } + + //// ////////////////////////////////// + /// Warn if open usage count is low + /// /////////////////////////////////// + $showWaringUsageCount = false; + if ($propertyWarnTicketExpireInUsageCount > 0) { + $openUsageCount = $ticket->getOpenUsageCount(); + if ($openUsageCount !== false && ($propertyWarnTicketExpireInUsageCount >= $openUsageCount)) { + $showWaringUsageCount = true; + $warnMessageTicketUsageCountTemplate = "A bérleten már csak {count} alkalom van"; + $variables = array( + '{count}' => $openUsageCount, + ); + $warnMessageTicketUsageCount = strtr($warnMessageTicketUsageCountTemplate, $variables); + } + } + + //// ////////////////////////////////// + /// if any warning is there, display + /// the warning box + /// /////////////////////////////////// + if ( $showWarningExpires || $showWaringUsageCount) { + ?> +
+ A bérlet hamarosan lejár + "; + echo $warnMessageTicketExpire; + } + if ( $showWaringUsageCount){ + echo "
"; + echo $warnMessageTicketUsageCount; + } + ?> +
+ "alert alert-danger", "role"=>"alert"]); echo "Kártya korlátozás:";