From be51ff4bfd6127eb3138b98be3677f39e801e3ad Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 19 Jan 2023 11:04:43 +0530 Subject: [PATCH] Code optimizations --- controllers/admin/AdminStatsController.php | 8 +++----- modules/dashguestcycle/dashguestcycle.php | 10 +++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 3b8a944e5..bdf9fce35 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1161,22 +1161,20 @@ class AdminStatsControllerCore extends AdminStatsTabController FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`) WHERE hbd.`is_refunded` = 0 AND hbd.`date_to` = "'.pSQL($date).' 00:00:00" - AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.' - AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT. + AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); $result = Db::getInstance()->executeS($sql); return $result; } - public static function getInHouseInfoByDate($date, $idHotel = null) + public static function getInHousesInfo($idHotel = null) { $sql = 'SELECT hbd.*, CONCAT(c.`firstname`, " ", c.`lastname`) AS customer_name, DATEDIFF(hbd.`date_to`, hbd.`date_from`) AS los FROM `'._DB_PREFIX_.'htl_booking_detail` hbd LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = hbd.`id_customer`) - WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN.' - AND hbd.`id_status` != '.(int) HotelBookingDetail::STATUS_CHECKED_OUT. + WHERE hbd.`is_refunded` = 0 AND hbd.`id_status` = '.(int) HotelBookingDetail::STATUS_CHECKED_IN. (!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel, 'hbd') : ''); $result = Db::getInstance()->executeS($sql); diff --git a/modules/dashguestcycle/dashguestcycle.php b/modules/dashguestcycle/dashguestcycle.php index 0eadea29b..1b0843fc4 100644 --- a/modules/dashguestcycle/dashguestcycle.php +++ b/modules/dashguestcycle/dashguestcycle.php @@ -62,7 +62,7 @@ class DashGuestCycle extends Module return $this->display(__FILE__, 'dashboard-top.tpl'); } - public function hookDashboardZoneTwo($params) + public function hookDashboardZoneTwo() { return $this->display(__FILE__, 'dashboard-zone-two.tpl'); } @@ -108,7 +108,7 @@ class DashGuestCycle extends Module $tableCurrentDepartures = $this->getTableDeparturesByDate($dateToday, $params['id_hotel']); $dataValue['dgc_count_upcoming_departures'] = count($tableCurrentDepartures['body']); - $tableCurrentInHouse = $this->getTableInHouseByDate($dateToday, $params['id_hotel']); + $tableCurrentInHouse = $this->getTableInHouses($params['id_hotel']); $dataValue['dgc_count_current_in_house'] = count($tableCurrentInHouse['body']); $tableNewBookings = $this->getTableNewBookingsByDate($dateToday, $params['id_hotel']); @@ -248,7 +248,7 @@ class DashGuestCycle extends Module return array('header' => array_values($header), 'body' => $body); } - public function getTableInHouseByDate($date, $idHotel) + public function getTableInHouses($idHotel) { $header = array( 'name' => array('title' => $this->l('Customer Name'), 'class' => 'text-left'), @@ -265,10 +265,10 @@ class DashGuestCycle extends Module unset($header['hotel']); } - $inHouseInfos = AdminStatsController::getInHouseInfoByDate($date, $idHotel); + $inHousesInfo = AdminStatsController::getInHousesInfo($idHotel); $body = array(); - foreach ($inHouseInfos as $inHouseInfo) { + foreach ($inHousesInfo as $inHouseInfo) { $tr = array(); $tr[] = array( 'value' => ''.Tools::htmlentitiesUTF8($inHouseInfo['customer_name']).'',