From 903ea1667c1977fb3d1c1bedd2cf07701e66a5f5 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Tue, 21 Nov 2023 12:27:25 +0530 Subject: [PATCH] Remove new function --- .../AdminHotelRoomsBookingController.php | 30 ++++++++----------- .../hotel_rooms_booking/helpers/view/view.tpl | 2 +- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index e9da36ac2..868dc10e3 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -29,8 +29,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $this->context = Context::getContext(); parent::__construct(); - - $this->hasBookingProducts = false; } public function initCart() @@ -88,16 +86,20 @@ class AdminHotelRoomsBookingController extends ModuleAdminController { parent::initProcess(); - $this->hasBookingProducts = $this->getHasBookingProducts(); + $objHotelBranchInformation = new HotelBranchInformation(); + $activeHotels = $objHotelBranchInformation->getAllHotels(true); - if ($this->hasBookingProducts) { + if ($activeHotels) { $this->initCart(); } } public function postProcess() { - if ($this->hasBookingProducts) { + $objHotelBranchInformation = new HotelBranchInformation(); + $activeHotels = $objHotelBranchInformation->getAllHotels(true); + + if ($activeHotels) { if (Tools::getValue('date_from')) { $date_from = Tools::getValue('date_from'); } else { @@ -115,8 +117,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController if (Tools::getValue('id_hotel')) { $id_hotel = Tools::getValue('id_hotel'); } else { - $obj_htl_info = new HotelBranchInformation(); - if ($htl_info = $obj_htl_info->hotelBranchesInfo(false, 1)) { + if ($htl_info = $objHotelBranchInformation->hotelBranchesInfo(false, 1)) { // filter hotels as per accessed hotels $htl_info = HotelBranchInformation::filterDataByHotelAccess( $htl_info, @@ -239,14 +240,6 @@ class AdminHotelRoomsBookingController extends ModuleAdminController parent::postprocess(); } - public function getHasBookingProducts() - { - $objHotelBranchInformation = new HotelBranchInformation(); - $allHotels = $objHotelBranchInformation->getAllHotels(true); - - return is_array($allHotels) && count($allHotels); - } - public function initContent() { // $this->show_toolbar = false; @@ -298,8 +291,11 @@ class AdminHotelRoomsBookingController extends ModuleAdminController public function renderView() { - $this->tpl_view_vars['has_booking_products'] = $this->hasBookingProducts; - if ($this->hasBookingProducts) { + $objHotelBranchInformation = new HotelBranchInformation(); + $activeHotels = $objHotelBranchInformation->getAllHotels(true); + + $this->tpl_view_vars['has_active_hotels'] = $activeHotels; + if ($activeHotels) { $this->tpl_view_vars['id_cart'] = $this->context->cart->id; $this->tpl_view_vars['id_guest'] = $this->context->cookie->id_guest; $this->initSearchFormData(); diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl index c9e4e96de..be428cae5 100644 --- a/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_rooms_booking/helpers/view/view.tpl @@ -1,5 +1,5 @@
- {if isset($has_booking_products) && $has_booking_products && $hotel_list|count > 0} + {if isset($has_active_hotels) && $has_active_hotels && $hotel_list|count > 0}