Use hotelBranchesInfo() to get active hotels
This commit is contained in:
@@ -569,11 +569,9 @@ class HotelBranchInformation extends ObjectModel
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
public function getAllHotels($activeOnly = false)
|
||||
public function getAllHotels()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_branch_info` hbi'.($activeOnly ? ' WHERE hbi.`active` = 1' : '')
|
||||
);
|
||||
return Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'htl_branch_info`');
|
||||
}
|
||||
|
||||
//Overrided ObjectModet::update() to update all the dependencies of the hotel
|
||||
|
||||
@@ -29,6 +29,15 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
$this->context = Context::getContext();
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$objHotelBranchInformation = new HotelBranchInformation();
|
||||
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(false, 1);
|
||||
// filter hotels as per accessed hotels
|
||||
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 1);
|
||||
|
||||
if ($hotelBranchesInfo) {
|
||||
$this->initCart();
|
||||
}
|
||||
}
|
||||
|
||||
public function initCart()
|
||||
@@ -82,24 +91,14 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
return $objCart;
|
||||
}
|
||||
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
$objHotelBranchInformation = new HotelBranchInformation();
|
||||
$activeHotels = $objHotelBranchInformation->getAllHotels(true);
|
||||
|
||||
if ($activeHotels) {
|
||||
$this->initCart();
|
||||
}
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
$objHotelBranchInformation = new HotelBranchInformation();
|
||||
$activeHotels = $objHotelBranchInformation->getAllHotels(true);
|
||||
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(false, 1);
|
||||
// filter hotels as per accessed hotels
|
||||
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 1);
|
||||
|
||||
if ($activeHotels) {
|
||||
if ($hotelBranchesInfo) {
|
||||
if (Tools::getValue('date_from')) {
|
||||
$date_from = Tools::getValue('date_from');
|
||||
} else {
|
||||
@@ -292,14 +291,15 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
|
||||
public function renderView()
|
||||
{
|
||||
$objHotelBranchInformation = new HotelBranchInformation();
|
||||
$activeHotels = $objHotelBranchInformation->getAllHotels(true);
|
||||
$hotelBranchesInfo = $objHotelBranchInformation->hotelBranchesInfo(false, 1);
|
||||
// filter hotels as per accessed hotels
|
||||
$hotelBranchesInfo = HotelBranchInformation::filterDataByHotelAccess($hotelBranchesInfo, $this->context->employee->id_profile, 1);
|
||||
|
||||
$this->tpl_view_vars['has_active_hotels'] = $activeHotels;
|
||||
if ($activeHotels) {
|
||||
if ($hotelBranchesInfo) {
|
||||
$this->tpl_view_vars['id_cart'] = $this->context->cart->id;
|
||||
$this->tpl_view_vars['id_guest'] = $this->context->cookie->id_guest;
|
||||
$this->initSearchFormData();
|
||||
if (count($this->tpl_view_vars['hotel_list'])) {
|
||||
if (count($hotelBranchesInfo)) {
|
||||
if ($this->booking_product) {
|
||||
$this->assignRoomBookingForm();
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="row">
|
||||
{if isset($has_active_hotels) && $has_active_hotels && $hotel_list|count > 0}
|
||||
{if $hotel_list|count > 0}
|
||||
<div class="col-sm-4">
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
|
||||
Reference in New Issue
Block a user