From e2c69b091ab37a8a9ff983a8a3b4b77559a7cb3f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 4 Jun 2025 10:59:44 +0530 Subject: [PATCH 01/10] Fixed: multiple requests are sent to admincustomer in case admin double clicks on the add new customer --- .../default/template/controllers/orders/form.tpl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 67e7ed00b..006dc6d77 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -885,9 +885,11 @@ }); } + let customerSearchAjax = ''; function searchCustomers() { - $.ajax({ + abortRunningAjax(customerSearchAjax);Add commentMore actions + customerSearchAjax = $.ajax({ type:"POST", url : "{$link->getAdminLink('AdminCustomers')}", async: true, @@ -927,6 +929,12 @@ }); } + function abortRunningAjax(ajaxVar) { + if (ajaxVar) { + ajaxVar.abort(); + } + } + function setupCustomer(idCustomer) { //$('#carts').show();// by webkul From 03bc902ea910cbc5844f25ca5fe9b970bd8eacc5 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 5 Jun 2025 11:51:38 +0530 Subject: [PATCH 02/10] Fixed: issues in webservices and removed the specific managemenet qlo webservice and non required functions --- classes/Image.php | 17 +- .../WebserviceSpecificManagementBookings.php | 24 +- .../WebserviceSpecificManagementImages.php | 29 +- mails/en/hotel_booking_cart_data.tpl | 1 + .../classes/HotelRoomTypeFeaturePricing.php | 355 ------------------ .../classes/QloRoomType.php | 304 --------------- .../classes/QloWebservice.php | 145 ------- .../WebserviceSpecificManagementQlo.php | 185 --------- modules/hotelreservationsystem/define.php | 2 - .../hotelreservationsystem.php | 2 - 10 files changed, 45 insertions(+), 1019 deletions(-) delete mode 100644 modules/hotelreservationsystem/classes/QloRoomType.php delete mode 100644 modules/hotelreservationsystem/classes/QloWebservice.php delete mode 100644 modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php diff --git a/classes/Image.php b/classes/Image.php index 19f2c9f98..b208e9e81 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -171,19 +171,22 @@ class ImageCore extends ObjectModel * @param int $id_product_attribute Product Attribute ID * @return array Images */ - public static function getImages($id_lang, $id_product, $id_product_attribute = null) + public static function getImages($id_lang, $id_product, $id_product_attribute = null, $bookingProduct = null) { $attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : ''); $sql = 'SELECT * FROM `'._DB_PREFIX_.'image` i - LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)'; + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`) + LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = i.`id_product`)'; if ($id_product_attribute) { $sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)'; } $sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.$attribute_filter.' + '.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').' ORDER BY i.`position` ASC'; + return Db::getInstance()->executeS($sql); } @@ -215,12 +218,14 @@ class ImageCore extends ObjectModel * * @return array Images */ - public static function getAllImages() + public static function getAllImages($bookingProduct = null) { return Db::getInstance()->executeS(' - SELECT `id_image`, `id_product` - FROM `'._DB_PREFIX_.'image` - ORDER BY `id_image` ASC'); + SELECT img.`id_image`, img.`id_product` FROM `'._DB_PREFIX_.'image` img + LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = img.`id_product` + WHERE 1 '.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').' + ORDER BY `id_image` ASC' + ); } /** diff --git a/classes/webservice/WebserviceSpecificManagementBookings.php b/classes/webservice/WebserviceSpecificManagementBookings.php index 2485adbeb..0f7e99a67 100644 --- a/classes/webservice/WebserviceSpecificManagementBookings.php +++ b/classes/webservice/WebserviceSpecificManagementBookings.php @@ -542,7 +542,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We return array( array( - 'adults' => isset($data['adult']) && $data['adult'] ? $data['adult'] : $roomTypeInfo['adults'], + 'adults' => isset($data['adults']) ? $data['adults'] : $roomTypeInfo['adults'], 'children' => isset($data['child']) ? $data['child'] : $roomTypeInfo['children'], 'child_ages' => $child_ages ) @@ -946,7 +946,9 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $extraVars, null, false, - $this->bookingCustomer->secure_key + $this->bookingCustomer->secure_key, + null, + false )) { $this->updateServicesAndDemandsInOrder($objPaymentModule->currentOrder); if (!empty($this->wsRequestedRooms)) { @@ -1081,7 +1083,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objTaxManager = TaxManagerFactory::getManager($objAddress, $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group']); $objTaxCalculator = $objTaxManager->getTaxCalculator(); $priceWithTax = $objTaxCalculator->addTaxes($objHotelBookingDetail->total_price_tax_excl); - } else if (isset($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) { + } else if (!empty($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) { $priceWithTax = $objHotelBookingDetail->total_price_tax_excl + $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax']; } @@ -1216,9 +1218,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objOrder->total_paid_tax_incl += $priceDiffTaxIncl; $objOrder->total_paid += $priceDiffTaxIncl; - } else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']) - && $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'] - ) { + } else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { $oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl; $objServiceProductOrderDetail->total_price_tax_incl = $objServiceProductOrderDetail->total_price_tax_excl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']; @@ -1697,7 +1697,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room; if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group']; - } else if (isset($room['total_tax'])) { + } else if (!empty($room['total_tax'])) { $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax']; } @@ -1946,13 +1946,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group']; - } else if (isset($room['total_tax'])) { + } else if (!empty($room['total_tax'])) { $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax']; } $numDays = HotelHelper::getNumberOfDays($dateFrom, $dateTo); if (isset($room['unit_price_without_tax']) - && ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_incl']/$numDays) + && ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_excl']/$numDays) ) { $this->updateRoomPriceInOrder($room, $roomsByDate['order'][$roomsKey]); $this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room; @@ -2314,7 +2314,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); $totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_); - } else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { + } else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) { $totalPriceTaxIncl = $totalPriceTaxExcl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']; $totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); @@ -2876,7 +2876,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We if (isset($room['id_tax_rules_group']) && !Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) { $this->error_msg = Tools::displayError('Invalid id_tax_rules_group.'); return false; - } else if (isset($room['total_tax']) && !Validate::isPrice($room['total_tax'])) { + } else if (!empty($room['total_tax']) && !Validate::isPrice($room['total_tax'])) { $this->error_msg = Tools::displayError('Invalid total tax.'); return false; } @@ -3243,7 +3243,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); $totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_); - } else if (isset($services[$product['id_product']]['total_tax'])) { + } else if (!empty($services[$product['id_product']]['total_tax'])) { $totalPriceTaxIncl = $totalPriceTaxExcl + $services[$product['id_product']]['total_tax']; $totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index 6f3139e3a..2a1cff79c 100644 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -51,7 +51,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage 'room_types' => array(), 'hotels' => array(), 'categories' => array(), - 'extra_service' => array(), + 'services' => array(), // 'manufacturers' => array(), // 'suppliers' => array(), // 'stores' => array(), @@ -288,7 +288,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage $this->imageType = $this->wsObject->urlSegment[1]; // if image type requested is room_types then process products images if ($this->imageType == 'room_types' - || $this->imageType == 'extra_services' + || $this->imageType == 'services' ) { $this->imageType = 'products'; } @@ -305,7 +305,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage case 'stores': case 'features': case 'hotels': - case 'extra_services': + case 'services': case 'room_types': switch ($this->wsObject->urlSegment[1]) { case 'categories': @@ -326,7 +326,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage case 'room_types': $directory = _PS_PROD_IMG_DIR_; break; - case 'extra_services': + case 'services': $directory = _PS_PROD_IMG_DIR_; break; case 'hotels': @@ -511,14 +511,20 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($this->imageType == 'products') { $ids = array(); - $images = Image::getAllImages(); + if ($this->wsObject->urlSegment[1] == 'services') { + $resourceType = 'services'; + $images = Image::getAllImages(0); + } else { + $resourceType = 'room_types'; + $images = Image::getAllImages(1); + } foreach ($images as $image) { $ids[] = $image['id_product']; } $ids = array_unique($ids, SORT_NUMERIC); asort($ids); foreach ($ids as $id) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$id), false); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$id), false); } } else if ($this->imageType == 'hotels') { $ids = array(); @@ -567,10 +573,17 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($this->imageType == 'products') { // Get available image ids $available_image_ids = array(); + if ($this->wsObject->urlSegment[1] == 'services') { + $resourceType = 'services'; + $bookingProduct = 0; + } else { + $bookingProduct = 1; + $resourceType = 'room_types'; + } // New Behavior foreach (Language::getIDs() as $id_lang) { - foreach (Image::getImages($id_lang, $object_id) as $image) { + foreach (Image::getImages($id_lang, $object_id, null, $bookingProduct) as $image) { $available_image_ids[] = $image['id_image']; } } @@ -607,7 +620,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage if ($available_image_ids) { $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id'=>$object_id)); foreach ($available_image_ids as $available_image_id) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$object_id.'/'.$available_image_id), false); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$object_id.'/'.$available_image_id), false); } $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array()); } else { diff --git a/mails/en/hotel_booking_cart_data.tpl b/mails/en/hotel_booking_cart_data.tpl index af74884b8..224fc2778 100644 --- a/mails/en/hotel_booking_cart_data.tpl +++ b/mails/en/hotel_booking_cart_data.tpl @@ -38,6 +38,7 @@ {$rm_v['num_rm']} + {if !isset($show_full_date)}{assign var="show_full_date" value=0}{/if} {assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))} {$rm_v['data_form']|date_format:"%d-%b-%G"}{if $is_full_date} {$rm_v['data_form']|date_format:"%I:%M %p"}{/if} diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index e4c24eb82..e20ccf9e0 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -257,361 +257,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel return $specialDaysCount; } - /** - * [getHotelRoomTypesRatesByDate returns hotel room types rates accrding to feature price plans] - * @param [int] $id_hotel [id of th hotel] - * @param integer $id_product [id of the product if supplied only rates of this room type will be returned] - * @param [date] $date_from [start date of the date range] - * @param [date] $date_to [end date of the date range] - * @return [array|false] [returns array containing rates of room type of a hotel if found else returns false] - */ - public function getHotelRoomTypesRatesAndInventoryByDate($id_hotel, $id_product, $date_from, $date_to) - { - $hotelRoomType = new HotelRoomType(); - $context = Context::getContext(); - $roomTypeRatesAndInventory = array(); - $objBookingDetail = new HotelBookingDetail(); - $incr = 0; - $date_from = date('Y-m-d', strtotime($date_from)); - $date_to = date('Y-m-d', strtotime($date_to)); - for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - $currentDate = date('Y-m-d', strtotime($date)); - $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); - if ($id_product) { - $bookingParams = array( - 'date_from' => $currentDate, - 'date_to' => $nextDayDate, - 'hotel_id' => $id_hotel, - 'id_room_type' => $id_product, - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams); - if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) { - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } else { - $totalAvailableRooms = 0; - } - - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($id_product, $currentDate, $nextDayDate); - $roomTypeRatesAndInventory[$incr]['date'] = $currentDate; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['id'] = $id_product; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['rates'] = $roomTypePrice; - $roomTypeRatesAndInventory[$incr]['room_types'][0]['available_rooms'] = $totalAvailableRooms; - } else { - $hotelRoomTypes = $hotelRoomType->getRoomTypeByHotelId($id_hotel, $context->language->id); - if ($hotelRoomTypes) { - $roomTypeRatesAndInventory[$incr]['date'] = $currentDate; - foreach ($hotelRoomTypes as $key => $product) { - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $product['id_product'], - $currentDate, - $nextDayDate - ); - $bookingParams = array( - 'date_from' => $currentDate, - 'date_to' => $nextDayDate, - 'hotel_id' => $id_hotel, - 'id_room_type' => $product['id_product'], - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams); - if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) { - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } else { - $totalAvailableRooms = 0; - } - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['id'] = $product['id_product']; - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['rates'] = $roomTypePrice; - $roomTypeRatesAndInventory[$incr]['room_types'][$key]['available_rooms'] = $totalAvailableRooms; - } - } else { - return false; - } - } - $incr++; - } - return $roomTypeRatesAndInventory; - } - - /** - * [updateRoomTypesFeaturePrices update and creates feature price plans by supplied information] - * @param [array] $featurePricePlans [feature price plans sent from channel manager] - * @return [array] [success if process is finished successfully else fasiled with errors] - * @information [if any feature price plan for the same date_from and date_to(supplied in the $featurePricePlans array) it will be updated otherwise it is added. While adding date range type rate plans if any plan already exist then feature price for all specific dates in the date range will be created (or updated if specific date feature price plan exists)] - */ - public function updateRoomTypesFeaturePricesAvailability($featurePricePlans) - { - $errors = []; - if ($featurePricePlans) { - if (isset($featurePricePlans['data']) && $featurePricePlans['data']) { - foreach ($featurePricePlans['data'] as $roomTypeRatesData) { - $dateFrom = date('Y-m-d', strtotime($roomTypeRatesData['dateFrom'])); - $dateTo = date('Y-m-d', strtotime('+1 day', strtotime($roomTypeRatesData['dateTo']))); - if ($roomTypeRatesData['roomType']) { - foreach ($roomTypeRatesData['roomType'] as $key => $roomTypeRates) { - $id_product = $key; - // feature price rates create and updates - if (isset($roomTypeRates['rate'])) { - $productPriceTE = Product::getPriceStatic((int) $id_product, false); - if ($productPriceTE != $roomTypeRates['rate']) { - if ($productPriceTE > $roomTypeRates['rate']) { - $priceImpactWay = 1; - $impactValue = $productPriceTE - $roomTypeRates['rate']; - } else { - $priceImpactWay = 2; - $impactValue = $roomTypeRates['rate'] - $productPriceTE; - } - $params = array(); - $params['roomTypeId'] = $id_product; - $params['featurePriceName'] = 'Webservice Feature Price'; - $params['dateFrom'] = $dateFrom; - $featurePriceDateTo = date('Y-m-d', (strtotime($dateTo) - _TIME_1_DAY_)); - $params['dateTo'] = $featurePriceDateTo; - $params['priceImpactWay'] = $priceImpactWay; - $params['isSpecialDaysExists'] = 0; - $params['jsonSpecialDays'] = null; - $params['priceImpactType'] = 2; - $params['impactValue'] = $impactValue; - $params['enableFeaturePrice'] = 1; - $nextDate = date('Y-m-d', strtotime('+1 day', strtotime($dateFrom))); - if ($nextDate == $dateTo) { - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; - $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $dateFrom, - $featurePriceDateTo, - 'specific_date' - ); - if ($featurePriceExists) { - if (!$this->saveFeaturePricePlan(2, $params, $featurePriceExists['id'])) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - if (!$this->saveFeaturePricePlan(2, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } else { - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_RANGE; - if ($featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $dateFrom, - $featurePriceDateTo, - 'date_range' - )) { - if ($featurePriceExists['date_from'] == $dateFrom - && $featurePriceExists['date_to'] == $featurePriceDateTo - ) { - if (!$this->saveFeaturePricePlan( - 1, - $params, - $featurePriceExists['id'] - )) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - // Creating feature prices day wise, for single days. - $nextDayDate = $currentDate = date('Y-m-d', $date); - $params['dateFrom'] = $currentDate; - $params['dateTo'] = $nextDayDate; - $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; - $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( - $id_product, - $currentDate, - $nextDayDate, - 'specific_date' - ); - if ($featurePriceExists) { - if (!$this->saveFeaturePricePlan( - 2, - $params, - $featurePriceExists['id'] - )) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } else { - if (!$this->saveFeaturePricePlan(2, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } - } - } else { - if (!$this->saveFeaturePricePlan(1, $params, 0)) { - $errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId']; - } - } - } - } - } - - if (isset($roomTypeRates['inventory'])) { - $totalAvailableNotBooked = 0; - $totalAvailableRooms = 0; - $hotelRoomType = new HotelRoomType(); - $hotelBookingDetail = new HotelBookingDetail(); - $hotelRoomInformation = new HotelRoomInformation(); - $roomTypeInfo = $hotelRoomType->getRoomTypeInfoByIdProduct($id_product); - $id_hotel = $roomTypeInfo['id_hotel']; - if ($id_hotel) { - $bookingParams = array( - 'date_from' => $dateFrom, - 'date_to' => $dateTo, - 'hotel_id' => $id_hotel, - 'id_room_type' => $id_product, - 'only_search_data' => 1, - ); - $roomTypeAvailabilityInfo = $hotelBookingDetail->dataForFrontSearch($bookingParams); - $bookedRoomsInfo = $hotelRoomInformation->getRoomTypeBookedRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - $countBookedRooms = count($bookedRoomsInfo); - if (isset($roomTypeAvailabilityInfo['stats']['total_rooms'])) { - $totalAvailableNotBooked = $roomTypeAvailabilityInfo['stats']['total_rooms'] - $countBookedRooms; - $totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail']; - } - - if ($roomTypeRates['inventory'] <= $totalAvailableNotBooked) { - if ($roomTypeRates['inventory'] < $totalAvailableRooms) { - $numDisabledRooms = $totalAvailableRooms - $roomTypeRates['inventory']; - $availableRooms = $hotelRoomInformation->getRoomTypeAvailableRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - if ($availableRooms) { - foreach ($availableRooms as $room) { - $objRoomDisableDates = new HotelRoomDisableDates(); - $params['id_room'] = $room['id']; - $params['date_from'] = $dateFrom; - $params['date_to'] = $dateTo; - if (!($objRoomDisableDates->checkIfRoomAlreadyDisabled($params))) { - if ($numDisabledRooms > 0) { - $hotelRoomInformation = new HotelRoomInformation($room['id']); - if ($hotelRoomInformation->id_status == 3) { - $params['reason'] = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing'); - if (!$objRoomDisableDates->updateDisableDateRanges( - $params - )) { - $errors[] = $this->moduleInstance->l('Some error occurred while saving disable dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$room['id'], 'HotelRoomTypeFeaturePricing'); - } - } else { - $hotelRoomInformation->id_status = 3; - if ($hotelRoomInformation->save()) { - $objRoomDisableDates = new HotelRoomDisableDates(); - $objRoomDisableDates->id_room = $room['id']; - $objRoomDisableDates->date_from = $dateFrom; - $objRoomDisableDates->date_to = $dateTo; - $objRoomDisableDates->reason = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing'); - $objRoomDisableDates->save(); - } - } - $numDisabledRooms--; - } - } - } - } - } elseif ($roomTypeRates['inventory'] > $totalAvailableRooms) { - $roomsToEnable = $roomTypeRates['inventory'] - $totalAvailableRooms; - $disabledRooms = $hotelRoomInformation->getRoomTypeDisabledRoomsForDateRange( - $id_hotel, - $id_product, - $dateFrom, - $dateTo - ); - if ($disabledRooms) { - foreach ($disabledRooms as $disableRoom) { - if ($roomsToEnable > 0) { - $hotelRoomInformation = new HotelRoomInformation($disableRoom['id']); - $objRoomDisableDates = new HotelRoomDisableDates(); - $params['id_room'] = $disableRoom['id']; - $params['date_from'] = $dateFrom; - $params['date_to'] = $dateTo; - if (!$objRoomDisableDates->deleteDisabledDatesForDateRange( - $params - )) { - $errors[] = $this->moduleInstance->l('Some error occurred while saving deleting dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$disableRoom['id'], 'HotelRoomTypeFeaturePricing'); - } - $disabledDates = $objRoomDisableDates->getRoomDisableDates( - $disableRoom['id'] - ); - if (!count($disabledDates)) { - $hotelRoomInformation->id_status = 1; - $hotelRoomInformation->disabled_dates = null; - } - $hotelRoomInformation->save(); - } - $roomsToEnable--; - } - } - } - } - } - } else { - $errors[] = $this->moduleInstance->l('Requested rooms inventory is not available.', 'HotelRoomTypeFeaturePricing'); - } - } - } else { - $errors[] = $this->moduleInstance->l('Room Types for which Feature prices to be updated are not found.', 'HotelRoomTypeFeaturePricing'); - } - } - } else { - $errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing'); - } - } else { - $errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing'); - } - - $result = array(); - if (count($errors)) { - $result['status'] = 'failed'; - $result['errors'] = $errors; - } else { - $result['status'] = 'success'; - } - - return $result; - } - - /** - * [saveFeaturePricePlan add or update feature price plan] - * @param [int] $dateSelectionType [date selection type 1 or 2 (date range or specific date)] - * @param [array] $params [Room type rate plan info] - * @param integer $id [id of the feature price plan if 0 means to add else to update the feature price plan] - * @return [bool] [returns true is successfuly added or updated else returns false] - */ - public function saveFeaturePricePlan($dateSelectionType, $params, $id = 0) - { - if ($id) { - $roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing($id); - } else { - $roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing(); - } - $roomTypeFeaturePricing->id_product = $params['roomTypeId']; - // lang fields - $languages = Language::getLanguages(false); - foreach ($languages as $language) { - $roomTypeFeaturePricing->feature_price_name[$language['id_lang']] = $params['featurePriceName']; - } - - $roomTypeFeaturePricing->date_selection_type = $params['dateSelectionType']; - $roomTypeFeaturePricing->date_from = $params['dateFrom']; - $roomTypeFeaturePricing->date_to = $params['dateTo']; - $roomTypeFeaturePricing->impact_way = $params['priceImpactWay']; - $roomTypeFeaturePricing->is_special_days_exists = $params['isSpecialDaysExists']; - $roomTypeFeaturePricing->special_days = $params['jsonSpecialDays']; - $roomTypeFeaturePricing->impact_type = $params['priceImpactType']; - $roomTypeFeaturePricing->impact_value = $params['impactValue']; - $roomTypeFeaturePricing->active = $params['enableFeaturePrice']; - - return $roomTypeFeaturePricing->save(); - } - /** * [getRoomTypeTotalPrice Returns Total price of the room type according to supplied dates]. * diff --git a/modules/hotelreservationsystem/classes/QloRoomType.php b/modules/hotelreservationsystem/classes/QloRoomType.php deleted file mode 100644 index c5bc3ac02..000000000 --- a/modules/hotelreservationsystem/classes/QloRoomType.php +++ /dev/null @@ -1,304 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class QloRoomType extends QloWebservice -{ - public function getRoomType($idHotel) - { - $objHotelRoomType = new HotelRoomType(); - $idLang = $this->context->language->id; - $roomTypes = $objHotelRoomType->getRoomTypeByHotelId((int)$idHotel, $idLang); - - $required = ['id', 'name', 'status']; - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); - foreach ($roomTypes as $roomType) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array()); - $roomType['name'] = $roomType['room_type']; - $roomType['id'] = $roomType['id_product']; - $roomType['status'] = $roomType['active']; - foreach ($roomType as $key => $value) { - if (in_array($key, $required)) { - $this->output .= $this->renderField($key, $value); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); - return $this->output; - } - - public function getRoomRates(array $params) - { - $objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing(); - - $idProd = 0; - if (isset($params['idRoomType'])) { - $idProd = $params['idRoomType']; - } - - $rates = $objRoomTypeFeaturePrice->getHotelRoomTypesRatesAndInventoryByDate($params['idHotel'], $idProd, $params['dateFrom'], $params['dateTo']); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('getRoomRatesApi', array()); - foreach ($rates as $datewiseRate) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate_list', array()); - foreach ($datewiseRate as $attr => $value) { - // how to put line written in else before if and no need to use else condition - if ($attr == 'room_types') { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); - foreach ($value as $roomType) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array()); - foreach ($roomType as $roomTypeAttr => $roomTypeData) { - if ($roomTypeAttr == 'rates') { - $roomTypeData['tax_inc'] = $roomTypeData['total_price_tax_incl']; - $roomTypeData['tax_exc'] = $roomTypeData['total_price_tax_excl']; - unset($roomTypeData['total_price_tax_incl']); - unset($roomTypeData['total_price_tax_excl']); - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate', array()); - foreach ($roomTypeData as $rateAttr => $rate) { - $this->output .= $this->renderField($rateAttr, $rate); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate', array()); - } else { - $this->output .= $this->renderField($roomTypeAttr, $roomTypeData); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); - } else { - $this->output .= $this->renderField($attr, $value); - } - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate_list', array()); - } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('getRoomRatesApi', array()); - return $this->output; - } - - public function updRoomRateAvail($availRateData) - { - $hotelId = $availRateData['Hotel']['id']; - $formatedData = [ - 'propertyId' => $hotelId, - 'data' => [], - ]; - - $rateData = $availRateData['Hotel']['rate_lists']['rate_list']; - - foreach ($rateData as $dateWise) { - $formateSubData = array(); - $formateSubData['dateFrom'] = $dateWise['date_range']['date_from']; - $formateSubData['dateTo'] = $dateWise['date_range']['date_to']; - - if (isset($dateWise['date_range']['RoomTypeLists']['RoomType']['id'])) { - $roomTypeDetail = $dateWise['date_range']['RoomTypeLists']['RoomType']; - - $formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status']; - if (isset($roomTypeDetail['rate'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate']; - } - if (isset($roomTypeDetail['Inventory'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory']; - } - } else { - foreach ($dateWise['date_range']['RoomTypeLists']['RoomType'] as $roomTypeDetail) { - $formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status']; - - if (isset($roomTypeDetail['rate'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate']; - } - if (isset($roomTypeDetail['Inventory'])) { - $formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory']; - } - } - } - - $formatedData['data'][] = $formateSubData; - } - $objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing(); - $objRoomTypeFeaturePrice->updateRoomTypesFeaturePricesAvailability($formatedData); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('success', array()); - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('success', array()); - - return $this->output; - } - // /** - // * Get address details by id_address - // * - // * @api /getaddress - // * @param int $idAddress - // * @return xml output - // */ - // public function getaddress($idAddress) - // { - // $address = new Address($idAddress); - // if (!Validate::isLoadedObject($address)) { - // return false; - // } - - // // convert object to array - // $address = json_decode(json_encode($address), true); - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array()); - // $address['country'] = Country::getNameById($this->id_lang, $address['id_country']); - // $address['state'] = State::getNameById($address['id_state']); - // foreach ($address as $key => $addr) { - // $this->output .= $this->renderField($key, $addr); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array()); - // return $this->output; - // } - - // /** - // * [getCustomerAddress description] - // * - // * @api /getcustomeraddress - // * @param int $idCustomer - // * @return xml output - // */ - // public function getCustomerAddress($idCustomer) - // { - // $customer = new Customer($idCustomer); - // if (!Validate::isLoadedObject($customer)) { - // return false; - // } - - // $required = ['id', 'country', 'state', 'alias', 'company', 'lastname', 'firstname', - // 'address1', 'address2', 'postcode', 'city', 'other', 'other', 'phone_mobile', 'phone', 'deleted']; - // $addresses = $customer->getAddresses($this->id_lang); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('addresses', array()); - // foreach ($addresses as $address) { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array()); - // $address['id'] = $address['id_address']; - // $address['country'] = Country::getNameById($this->id_lang, $address['id_country']); - // $address['state'] = State::getNameById($address['id_state']); - // foreach ($address as $key => $value) { - // if (in_array($key, $required)) { - // $this->output .= $this->renderField($key, $value); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array()); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('addresses', array()); - // return $this->output; - // } - - // /** - // * Check is customer have his first address or not - // * - // * @api /checkfirstaddress - // * @param int $idCustomer - // * @return xml message - // */ - // public function checkFirstAddressProcess($idCustomer) - // { - // if (Address::getFirstCustomerAddressId($idCustomer)) { - // return $this->getResult($this->mkmodule->l('Address exist for this customer.', 'mkaddress'), '1'); - // } - - // return $this->getResult($this->mkmodule->l('No address added by this customer yet.', 'mkaddress'), '0'); - // } - - // /** - // * Get required field in address from configuration - // * - // * @return xml node - // */ - // public function addressConfiguration() - // { - // $requiredFields = AddressFormat::getFieldsRequired(); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('required_fields', array()); - // $this->output .= $this->renderField('phone_config', Configuration::get('PS_ONE_PHONE_AT_LEAST')); - // foreach ($requiredFields as $field) { - // if ($field !== 'Country:name') { - // $this->output .= $this->renderField($field, 1); - // } - // } - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('required_fields', array()); - // } - - // /** - // * Get country and state list - // * - // * @api /getcountrieswithstates - // * @return [type] [description] - // */ - // public function getCountriesWithStatesProcess() - // { - // $countries = Country::getCountries($this->id_lang, true); - // $this->output .= $this->addressConfiguration(); - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('countries', array()); - // if ($countries) { - // foreach ($countries as $country) { - // // set if default country - // if ($country['id_country'] == Configuration::get('PS_COUNTRY_DEFAULT')) { - // $country['is_default'] = 1; - // } else { - // $country['is_default'] = 0; - // } - // // check if company field exist - // if ($this->isCompanyFieldAvailable($country['id_country'])) { - // $country['is_company'] = 1; - // } else { - // $country['is_company'] = 0; - // } - - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('country', array()); - // $country['country_name'] = $country['country']; - // unset($country['country']); - // foreach ($country as $k => $c) { - // if ($k == 'states') { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($k, array()); - // foreach ($c as $s) { - // $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('state', array()); - // foreach ($s as $kkk => $ss) { - // $this->output .= $this->renderField($kkk, $ss); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('state', array()); - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($k, array()); - // } else { - // $this->output .= $this->renderField($k, $c); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('country', array()); - // } - // } - // $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('countries', array()); - // return $this->output; - // } - - // /** - // * Is 'company' field available while adding address - // * - // * @param int $idCountry - // * @return boolean - // */ - // public function isCompanyFieldAvailable($idCountry) - // { - // if (in_array('company', AddressFormat::getOrderedAddressFields($idCountry, true, true))) { - // return true; - // } - // return false; - // } -} diff --git a/modules/hotelreservationsystem/classes/QloWebservice.php b/modules/hotelreservationsystem/classes/QloWebservice.php deleted file mode 100644 index 741b10186..000000000 --- a/modules/hotelreservationsystem/classes/QloWebservice.php +++ /dev/null @@ -1,145 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class QloWebservice -{ - protected $objOutput; - protected $output; - protected $wsObject; - protected $mobikulGlobal; // Remove this - protected $mkGlobal; - protected $mkmodule; - protected $http; - protected $width; - - public function __construct($objOutput = null, $wsObject = null, $output = null) - { - $this->objOutput = $objOutput; - $this->wsObject = $wsObject; - $this->output = $output; - - // Need to remove these three settings, this should be handled by context - // $this->id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); - // $this->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); - // $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - - $this->setContext(); - // $this->mkmodule = Module::getInstanceByName('mobikul'); - // $this->mobikulGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output); // Remove this - // $this->mkGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output); - } - - public function setContext() - { - $this->context = Context::getContext(); - - // // Set Customer - // if (isset($this->wsObject->urlFragments['id_customer'])) { - // $this->context->customer = new Customer($this->wsObject->urlFragments['id_customer']); - // } - - // // Set language - // if (isset($this->wsObject->urlFragments['id_lang'])) { - // $language = new Language($this->wsObject->urlFragments['id_lang']); - // if (!Validate::isLoadedObject($language)) { - // $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - // } - // } else { - // $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - // } - $language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - $this->context->language = $language; - - // // Set Currency - // if (isset($this->wsObject->urlFragments['id_currency'])) { - // $currency = new Currency($this->wsObject->urlFragments['id_currency']); - // if (!Validate::isLoadedObject($currency)) { - // $language = new Language((int)Configuration::get('PS_CURRENCY_DEFAULT')); - // } - // } else { - // $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - // } - $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); - $this->context->currency = $currency; - } - - public function getResult($message, $status = null, $args = array(), $xml = false) - { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('response', array()); - if ($status !== null) { - $this->output .= $this->renderField('status', $status); - } - - $this->output .= $this->renderField('message', $message); - - if (is_array($args) && !empty($args)) { - foreach ($args as $key => $value) { - $this->output .= $this->renderField($key, $value); - } - } - - if ($xml) { - $this->output .= $xml; - } - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('response', array()); - return $this->output; - } - - /** - * Create just like PS renderField function in WebServiceOutputXML class - * @todo :: to be mode functional with attributes and others - * @param [type] $nodeName - * @param [type] $value - * @return [type] xml node - */ - public function renderField($nodeName, $value = null) - { - $node_content = ''; - return '<'.$nodeName.'>'.$node_content.''."\n"; - } - - // public function displayPrice($price, $idCurrency = false) - // { - // if ($idCurrency) { - // $this->currency = Currency::getCurrencyInstance($idCurrency); - // } elseif (isset($this->wsObject->urlFragments['id_currency'])) { - // $this->currency = Currency::getCurrencyInstance($this->wsObject->urlFragments['id_currency']); - // } else { - // $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - // } - - // $defaultCurrencyInstance = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT')); - // if (Validate::isLoadedObject($this->currency)) { - // $price = Tools::ps_round((float) $price, (int) $this->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_); - // $convertedPrice = Tools::convertPrice($price, $this->currency, $defaultCurrencyInstance); - - // return Tools::displayPrice($convertedPrice, $this->currency); - // } else { - // return $price; - // } - // } - - // public function getProductPrice($id_product, $tax = true, $id_product_attribute = null, $decimals = 6, - // $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null) - // { - // return Product::getPriceStatic((int)$id_product, $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity, $force_associated_tax, $id_customer); - // } -} \ No newline at end of file diff --git a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php deleted file mode 100644 index 54fd46e89..000000000 --- a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementQlo.php +++ /dev/null @@ -1,185 +0,0 @@ - -* @copyright 2010-2020 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInterface -{ - protected $objOutput; - protected $output; - protected $wsObject; - - public $id_lang; - public $id_customer; - public $id_currency; - public $mobikulGlobal; - - public function __construct() - { - ini_set('memory_limit', '256M'); - $psCurrencyDefault = (int) Configuration::get('PS_CURRENCY_DEFAULT'); - $this->context = Context::getContext(); - $this->id_lang = Configuration::get('PS_LANG_DEFAULT'); - $this->id_currency = $psCurrencyDefault; - $this->currency = Currency::getCurrencyInstance($psCurrencyDefault); - } - - public function setObjectOutput(WebserviceOutputBuilderCore $obj) - { - $this->objOutput = $obj; - return $this; - } - - public function getObjectOutput() - { - return $this->objOutput; - } - - public function setWsObject(WebserviceRequestCore $obj) - { - $this->wsObject = $obj; - return $this; - } - - public function getWsObject() - { - return $this->wsObject; - } - - // written in alphabatical order - public function manage() - { - $this->wsQloCRUD(); - return $this->wsObject->getOutputEnabled(); - } - - protected $allowedMethods = array( - 'getRoomTypes' => array(), - 'getRoomRates' => array(), - 'updRoomRateAvail' => array(), - ); - - public function getContent() - { - if ($this->output != '') { - $outputXML = $this->objOutput->getObjectRender()->overrideContent($this->output); - if (isset($this->wsObject->urlFragments['outputformat']) && $this->wsObject->urlFragments['outputformat'] == 'json') { - $outputXML = simplexml_load_string($outputXML, null, LIBXML_NOCDATA); - $json = json_encode($outputXML); - $content = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($matches) { - return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($matches[1]))); - }, $json); - header('Content-Type: application/json'); - die($content); - } else { - return $outputXML; - } - } - } - - protected function wsQloCRUD() - { - $objQloRoomType = new QloRoomType($this->objOutput, $this->wsObject, $this->output); - - switch ($this->wsObject->method) { - case 'GET': - switch ($this->wsObject->urlSegment[1]) { - case 'getRoomTypes': - if (!isset($this->wsObject->urlFragments['id_hotel'])) { - throw new WebserviceException('You have to set \'id_hotel\' parameter to get a result', array(100, 400)); - } - $this->output .= $objQloRoomType->getRoomType($this->wsObject->urlFragments['id_hotel']); - break; - case 'getRoomRates': - if (!isset($this->wsObject->urlFragments['id_hotel']) ) { - throw new WebserviceException('You have to set \'id_hotel\', \'date_from\' and \'date_to\'parameters to get a result', array(100, 400)); - } - $dateFrom = isset($this->wsObject->urlFragments['date_from']) ? $this->wsObject->urlFragments['date_from'] : date('Y-m-d'); - $dateTo = isset($this->wsObject->urlFragments['date_to']) ? $this->wsObject->urlFragments['date_to'] : date('Y-m-d', strtotime($dateFrom.' + 1 day')); - $kwargs = array( - 'idHotel' => $this->wsObject->urlFragments['id_hotel'], - 'dateFrom' => $dateFrom, - 'dateTo' => $dateTo, - 'idRoomType' => isset($this->wsObject->urlFragments['id_room_type']) ? $this->wsObject->urlFragments['id_room_type'] : 0, - ); - - $this->output .= $objQloRoomType->getRoomRates($kwargs); - break; - - default: - $exception = new WebserviceException(sprintf('Method with name "%s" does not exist in Qlo Library,', $this->wsObject->urlSegment[1]), array(48, 400)); - throw $exception->setDidYouMean($this->wsObject->urlSegment[1], array_keys($this->allowedMethods)); - } - break; - case 'POST': - switch ($this->wsObject->urlSegment[1]) { - case 'updRoomRateAvail': - $fields = $this->getXMLFields('updRoomRateAvail'); - - if (!isset($fields)) { - throw new WebserviceException('Send XML formated data', array(100, 400)); - } - $this->output .= $objQloRoomType->updRoomRateAvail($fields); - break; - } - break; - default : - throw new WebserviceException('This HTTP method is not allowed', array(67, 405)); - } - } - - public function getXMLFields($head = false) - { - $putresource = fopen('php://input', 'r'); - $inputXML = ''; - while ($putData = fread($putresource, 1024)) { - $inputXML .= $putData; - } - fclose($putresource); - - // If xml - if (simplexml_load_string($inputXML)) { - if (isset($inputXML) && strncmp($inputXML, 'xml=', 4) == 0) { - $inputXML = Tools::substr($inputXML, 4); - } - } else { - // If input type is json - $array = json_decode($inputXML, true); - if (isset($array['json']) && $array['json'] && isset($array[$head])) { - return ($head ? $array[$head] : $array); - } else { - WebserviceRequest::getInstance()->setError(500, 'Invalid json.', 127); - return; - } - } - - try { - $xml = new SimpleXMLElement($inputXML); - } catch (Exception $error) { - WebserviceRequest::getInstance()->setError(500, 'XML error : '.$error->getMessage()."\n".'XML length : '.Tools::strlen($inputXML)."\n".'Original XML : '.$inputXML, 127); - - return; - } - - $xmlEntities = $xml->children(); - // Convert multi-dimention xml into an array - $array = json_decode(json_encode($xmlEntities), true); - - return ($head ? $array[$head] : $array); - } -} diff --git a/modules/hotelreservationsystem/define.php b/modules/hotelreservationsystem/define.php index f45b141d4..3e085fd40 100644 --- a/modules/hotelreservationsystem/define.php +++ b/modules/hotelreservationsystem/define.php @@ -41,8 +41,6 @@ require_once 'classes/HotelRoomTypeDemandPrice.php'; require_once 'classes/HotelRoomTypeDemand.php'; require_once 'classes/HotelRoomTypeRestrictionDateRange.php'; -require_once 'classes/QloWebservice.php'; -require_once 'classes/QloRoomType.php'; require_once 'classes/HotelRoomDisableDates.php'; require_once 'classes/HotelBranchRefundRules.php'; require_once 'classes/HotelBedType.php'; diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index b5e1dca79..2a181cdf3 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -54,10 +54,8 @@ class HotelReservationSystem extends Module 'room_bookings' => array('description' => 'Room bookings', 'class' => 'HotelBookingDetail'), 'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'), 'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'), - 'extra_services' => array('description' => 'Extra services', 'class' => 'Product', 'parameters_attribute' => 'webserviceRoomTypeServicesParameters'), 'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'), 'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true), - 'qlo' => array('description' => 'qlo API', 'specific_management' => true), ); return $resources; From cc3619b9ea6bfaa8da683258b2fd88edc4ede1e8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 5 Jun 2025 12:00:04 +0530 Subject: [PATCH 03/10] Fixed: console error during guest checkout --- themes/hotel-reservation-theme/js/order-opc.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index 5855055de..854f90fbb 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -118,14 +118,12 @@ $(document).ready(function() validateCustomerGuestDetailForm(); } $(document).on('click', '.submit-guest-details', function(e) { - e.preventDefault(); if ($('#customer_guest_detail').prop('checked')) { validateCustomerGuestDetailForm(); + e.preventDefault(); if ($('#customer_guest_detail_form').find('.form-error').length == 0) { $('#customer_guest_detail_form').get(0).submit(); } - } else { - $('#customer_guest_detail_form').get(0).submit(); } }); From 38019950eb5eaab381b68454bb9a879740de42bc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 5 Jun 2025 12:36:06 +0530 Subject: [PATCH 04/10] Fixed: Fatal errors while exporting the addresses and orders in back-office --- controllers/admin/AdminAddressesController.php | 2 +- controllers/admin/AdminOrdersController.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 9847509b0..551e9c207 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -385,7 +385,7 @@ class AdminAddressesControllerCore extends AdminController { $this->fields_list = array_merge($this->fields_list, array( 'email' => array('title' => $this->l('Customer Email')), - 'phone' => array('title' => $this->l('Phone')), + 'phone' => array('title' => $this->l('Phone'), 'filter_key' => 'a!phone'), 'phone_mobile' => array('title' => $this->l('Mobile phone')), 'address1' => array('title' => $this->l('Address (2)')), 'dni' => array('title' => $this->l('Identification Number')), diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index dad09b3b0..028976d07 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1386,13 +1386,12 @@ class AdminOrdersControllerCore extends AdminController $id_lang_shop = false ){ if ($this->action == 'export' && empty($this->_listsql)) { - $this->_select .= ', c.`email`, cgd.`phone`, a.`total_paid_real`, + $this->_select .= ', c.`email`, c.`phone`, a.`total_paid_real`, orf.`cancellation_date`, orf.`cancellation_fee`, cy.`iso_code` AS country, st.`iso_code` as state, ad.`city`, CONCAT(ad.`address1`, \', \', ad.`postcode`) AS `cus_address`, hbdtl.*'; - $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd ON cgd.`email` = c.`email` AND cgd.`id_cart` = 0 - LEFT JOIN `'._DB_PREFIX_.'address` ad ON a.`id_customer`= ad.`id_customer` AND ad.`id_customer`!=0 + $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'address` ad ON a.`id_customer`= ad.`id_customer` AND ad.`id_customer`!=0 LEFT JOIN `'._DB_PREFIX_.'country` cy ON cy.`id_country`= ad.`id_country` LEFT JOIN `'._DB_PREFIX_.'state` st ON st.`id_state`= ad.`id_state` LEFT JOIN ( From 84cf324b96bfd9fa48973653bd62ad83225af3f5 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 5 Jun 2025 18:49:11 +0530 Subject: [PATCH 05/10] Fixed: the service quantity is updated incorrectly on service update from the add order page in back office --- controllers/admin/AdminCartsController.php | 8 ++++---- .../classes/ServiceProductCartDetail.php | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index d6a736572..61be9be2f 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1541,6 +1541,10 @@ class AdminCartsControllerCore extends AdminController // Validate selected services foreach ($selectedServiceProducts as $idServiceProduct => $selected) { if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct, false, $objCart->id_lang))) { + if (!$objProduct->allow_multiple_quantity) { + $serviceQuantities[$idServiceProduct] = 1; + } + if ($objProduct->allow_multiple_quantity) { if (!isset($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; @@ -1554,10 +1558,6 @@ class AdminCartsControllerCore extends AdminController $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } - if (!$objProduct->allow_multiple_quantity) { - $serviceQuantities[$idServiceProduct] = 1; - } - if (!isset($serviceUnitPrices[$idServiceProduct]) || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) ) { diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index f62b0d9ec..0d6587674 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -426,7 +426,13 @@ class ServiceProductCartDetail extends ObjectModel $objServiceProductCartDetail->id_product_option = $idProductOption; } - $objServiceProductCartDetail->quantity += $quantity; + $objProduct = new Product((int) $idProduct); + if ($objProduct->allow_multiple_quantity) { + $objServiceProductCartDetail->quantity += $quantity; + } else { + $objServiceProductCartDetail->quantity = 1; + } + if ($objServiceProductCartDetail->save()) { $objCart = new Cart($idCart); return $objCart->updateQty($quantity, $idProduct); @@ -468,7 +474,7 @@ class ServiceProductCartDetail extends ObjectModel if ($quantity) { $removedQuantity = $quantity; $objServiceProductCartDetail->quantity -= $quantity; - if ($objServiceProductCartDetail->quantity) { + if ($objServiceProductCartDetail->quantity > 1) { $updateQunatity = $objServiceProductCartDetail->save(); } else { $updateQunatity = $objServiceProductCartDetail->delete(); From ba8ddce10eeb5a99ac954e19c1d335247c999f98 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 6 Jun 2025 12:07:28 +0530 Subject: [PATCH 06/10] Fixed: the payment page link is generated with ssl as false in the admin order controller in the order page in back office --- controllers/admin/AdminCartsController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index d6a736572..bbdc8b7d4 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -935,7 +935,8 @@ class AdminCartsControllerCore extends AdminController 'id_cart' => $id_cart, 'order_message' => $message_content, 'link_order' => $this->context->link->getPageLink( - 'order', false, + 'order', + null, (int)$this->context->cart->id_lang, 'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart) ), From e6351529d7668b0b1fc2ab6d63c8f5581498b028 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 6 Jun 2025 13:09:54 +0530 Subject: [PATCH 07/10] Fixed: added fax, fixed fatal error for the hotel import and warning in booking import incase the Room type does not exists --- controllers/admin/AdminImportController.php | 75 ++++++++++++--------- docs/csv_import/hotels_import.csv | 6 +- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index b805356ad..11242fc56 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -145,6 +145,7 @@ class AdminImportControllerCore extends AdminController 'id_state' => array('label' => $this->l('State ID')), 'city' => array('label' => $this->l('City *')), 'postcode' => array('label' => $this->l('Zip Code *')), + 'fax' => array('label' => $this->l('Fax')), 'policies' => array('label' => $this->l('Hotel Policies')), 'active_refund' => array('label' => $this->l('Allow Refund (0 = No, 1 = Yes)')), 'refund_ids' => array('label' => $this->l('Refund IDs (x,y,z...)')), @@ -1200,6 +1201,11 @@ class AdminImportControllerCore extends AdminController $this->l('Zip code is invalid for (ID: %1$s)'), (isset($info['id']) && !empty($info['id']))? $info['id'] : 'null' ); + } else if (isset($info['fax']) && !Validate::isGenericName($info['fax'])) { + $this->errors[] = sprintf( + $this->l('Fax is invalid for (ID: %1$s)'), + (isset($info['id']) && !empty($info['id']))? $info['id'] : 'null' + ); } else if ($objCountry->active) { if ($objCountry->contains_states) { if (!isset($info['id_state']) @@ -1254,6 +1260,7 @@ class AdminImportControllerCore extends AdminController $objAddress->id_state = $info['id_state']; $objAddress->city = $info['city']; $objAddress->postcode = $info['postcode']; + $objHotelBranch->fax = $info['fax']; $hotelName = $objHotelBranch->hotel_name[$idLangDefault]; $objAddress->alias = $hotelName; $hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName)); @@ -1438,16 +1445,18 @@ class AdminImportControllerCore extends AdminController $objHotelOrderRestrictDate->use_global_min_booking_offset = true; if (isset($info['max_checkout_offset']) - && (Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset'] - || isset($info['min_booking_offset']) && $info['min_booking_offset'] < $info['max_checkout_offset']) + && ((Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset']) + || (isset($info['min_booking_offset']) && ($info['min_booking_offset'] < $info['max_checkout_offset'])) + ) ) { $objHotelOrderRestrictDate->use_global_max_checkout_offset = false; $objHotelOrderRestrictDate->max_checkout_offset = $info['max_checkout_offset']; } if (isset($info['min_booking_offset']) - && (Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset'] - || isset($info['max_checkout_offset']) && $info['max_checkout_offset'] > $info['min_booking_offset']) + && ((Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset']) + || (isset($info['max_checkout_offset']) && ($info['max_checkout_offset'] > $info['min_booking_offset'])) + ) ) { $objHotelOrderRestrictDate->use_global_min_booking_offset = false; $objHotelOrderRestrictDate->min_booking_offset = $info['min_booking_offset']; @@ -2449,39 +2458,41 @@ class AdminImportControllerCore extends AdminController $idHotel = 0; $objCustomer = new Customer($info['id_customer']); $objProduct = new Product($info['id_product']); - if (Validate::isLoadedObject($objCustomer) - && Validate::isLoadedObject($objProduct) - ) { - if (!isset($hotelRoomTypeInfo[$info['id_product']])) { - if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) { + if (Validate::isLoadedObject($objCustomer)) { + if (Validate::isLoadedObject($objProduct) || $objProduct->booking_product) { + if (!isset($hotelRoomTypeInfo[$info['id_product']])) { + if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) { + $singleRow->id_hotel = $roomInfo['id_hotel']; + $idHotel = $roomInfo['id_hotel']; + $singleRow->adults = $roomInfo['adults']; + $singleRow->children = $roomInfo['children']; + $hotelRoomTypeInfo[$info['id_product']] = $roomInfo; + } + } else { + $roomInfo = $hotelRoomTypeInfo[$info['id_product']]; $singleRow->id_hotel = $roomInfo['id_hotel']; $idHotel = $roomInfo['id_hotel']; $singleRow->adults = $roomInfo['adults']; $singleRow->children = $roomInfo['children']; - $hotelRoomTypeInfo[$info['id_product']] = $roomInfo; + } + + $ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow; + if (!isset($orderInfo[$info['id_order']])) { + $orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer; + if (isset($singleRow->id_order_status)) { + $orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status; + } else { + $orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT'); + } + + if (isset($singleRow->id_currency)) { + $orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ; + } else { + $orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT'); + } } } else { - $roomInfo = $hotelRoomTypeInfo[$info['id_product']]; - $singleRow->id_hotel = $roomInfo['id_hotel']; - $idHotel = $roomInfo['id_hotel']; - $singleRow->adults = $roomInfo['adults']; - $singleRow->children = $roomInfo['children']; - } - - $ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow; - if (!isset($orderInfo[$info['id_order']])) { - $orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer; - if (isset($singleRow->id_order_status)) { - $orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status; - } else { - $orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT'); - } - - if (isset($singleRow->id_currency)) { - $orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ; - } else { - $orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT'); - } + $this->warnings[] = $this->l('Invalid room type Id: ').$info['id_product']; } } } @@ -2667,7 +2678,7 @@ class AdminImportControllerCore extends AdminController null, false )) { - $this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey); + $this->errors[] = $this->l('Failed to create booking for reference').' '.$orderRefKey; } foreach ($featurePrices as $idPrice) { diff --git a/docs/csv_import/hotels_import.csv b/docs/csv_import/hotels_import.csv index f3c5962fa..537e704cc 100644 --- a/docs/csv_import/hotels_import.csv +++ b/docs/csv_import/hotels_import.csv @@ -1,3 +1,3 @@ -Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max booking offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) -2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;2024-01-01;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0 -3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0 +Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Fax;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Maximum checkout offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes) +2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;4;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0 +3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0 From b8fc8afe9a45127d5f39ec954cc89464d8c1a066 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 6 Jun 2025 15:43:08 +0530 Subject: [PATCH 08/10] Fixed: Admin in unable to delete some refund statuses --- controllers/admin/AdminStatusesController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index aadb4ee44..fcf663091 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -285,7 +285,8 @@ class AdminStatusesControllerCore extends AdminController //init and render the second list $this->list_skip_actions = array(); $this->_filter = false; - $this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5)); + $unremovableOrs = Configuration::getMultiple(array('PS_ORS_PENDING', 'PS_ORS_DENIED', 'PS_ORS_REFUNDED')); + $this->addRowActionSkipList('delete', $unremovableOrs); $this->initOrdersReturnsList(); $this->checkFilterForOrdersReturnsList(); From d8966379506c863fee7117c8d9369a7761a851ea Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 9 Jun 2025 10:46:47 +0530 Subject: [PATCH 09/10] Fixed: issue in the hotel filter block module --- modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js | 4 ++-- modules/wkhotelfilterblock/wkhotelfilterblock.php | 2 +- modules/wkroomsearchblock/classes/WkRoomSearchHelper.php | 2 -- modules/wkroomsearchblock/views/js/wk-room-search-block.js | 7 ++++--- .../hotel-reservation-theme/_partials/room_type_list.tpl | 6 +++--- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js index 14aa1b5ec..c4a55a5be 100644 --- a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js +++ b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js @@ -41,8 +41,8 @@ $(document).ready(function() $("#filter_price_silder").slider("values", [min_price, max_price]); var slider_price_cont = filter_wrapper.find("div.price_filter_subcont"); - slider_price_cont.find("span#filter_price_from").html(min_price); - slider_price_cont.find("span#filter_price_to").html(max_price); + slider_price_cont.find("span#filter_price_from").html(formatCurrency(min_price, currencyFormat, currencySign, currencyBlank)); + slider_price_cont.find("span#filter_price_to").html(formatCurrency(max_price, currencyFormat, currencySign, currencyBlank)); /* -------NOTICE------- */ //triggerFilter(); diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php index 2c50393fc..05ebde0cb 100644 --- a/modules/wkhotelfilterblock/wkhotelfilterblock.php +++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php @@ -192,7 +192,7 @@ class wkhotelfilterblock extends Module if (!($date_to = Tools::getValue('date_to'))) { $date_to = date('Y-m-d H:i:s', strtotime($date_from) + 86400); } else { - $urlData['date_from'] = $date_to; + $urlData['date_to'] = $date_to; } if ($occupancy = Tools::getValue('occupancy')) { diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php index 16b514066..107053862 100644 --- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php +++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php @@ -192,8 +192,6 @@ class WkRoomSearchHelper $searchedData['order_date_restrict'] = true; } } - - $smartyVars['search_data'] = $searchedData; } if ($occupancyEnabled) { diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index 0c12eb857..586de6f89 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -388,10 +388,11 @@ $(document).ready(function() { start_date.setHours(0, 0, 0, 0); } - let selectedDateFrom = new Date(Date.parse(dateFrom)); - let selectedDateTo = new Date(Date.parse(dateTo)); + // Using the Date object will also add extra hours according to the timezone. + let selectedDateFrom = $.datepicker.parseDate('yy-mm-dd', dateFrom); + let selectedDateTo = $.datepicker.parseDate('yy-mm-dd', dateTo); if (max_order_date) { - max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date ); + max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date); } else { max_order_date = false; } diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 5613be05c..0eaf739ce 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -20,9 +20,9 @@ {block name='displayRoomTypeListBefore'} {hook h='displayRoomTypeListBefore'} {/block} -{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types && isset($booking_data['rm_data'])} +{if !empty($booking_data['rm_data']) && (isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || !empty($display_all_room_types))} {foreach from=$booking_data['rm_data'] key=room_k item=room_v} - {if $room_v['data']['available']|count || isset($display_all_room_types) && $display_all_room_types } + {if $room_v['data']['available']|count || !empty($display_all_room_types) }
{block name='room_type_list_room_image'} @@ -41,7 +41,7 @@

{$room_v['name']|escape:'htmlall':'UTF-8'}

{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict} -

$warning_num} style="display:none"{/if}> +

$warning_num} style="display:none"{/if}> {l s='Hurry!'} {$room_v['room_left']|escape:'htmlall':'UTF-8'} {l s='rooms left'}

{/if} From 0584b0fdec3cc3aeb62f8409cb1a3dbfa280257f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 9 Jun 2025 11:32:07 +0530 Subject: [PATCH 10/10] Added the current installed version of QloApps in the Database --- install/models/install.php | 4 ++++ install/upgrade/upgrade.php | 1 + 2 files changed, 5 insertions(+) diff --git a/install/models/install.php b/install/models/install.php index 3e95362ae..4f48210c1 100644 --- a/install/models/install.php +++ b/install/models/install.php @@ -211,6 +211,9 @@ class InstallModelInstall extends InstallAbstractModel Configuration::updateGlobalValue('PS_LANG_DEFAULT', $id_lang); Configuration::updateGlobalValue('PS_VERSION_DB', _PS_INSTALL_VERSION_); Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_); + return true; } @@ -475,6 +478,7 @@ class InstallModelInstall extends InstallAbstractModel Configuration::updateGlobalValue('PS_SHOP_DOMAIN', Tools::getHttpHost()); Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', Tools::getHttpHost()); Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_); Configuration::updateGlobalValue('PS_LOCALE_LANGUAGE', $this->language->getLanguageIso()); Configuration::updateGlobalValue('PS_SHOP_NAME', $data['shop_name']); Configuration::updateGlobalValue('PS_SHOP_ACTIVITY', $data['shop_activity']); diff --git a/install/upgrade/upgrade.php b/install/upgrade/upgrade.php index 7cb6b8379..e30c7a9bd 100644 --- a/install/upgrade/upgrade.php +++ b/install/upgrade/upgrade.php @@ -434,6 +434,7 @@ if (empty($fail_result)) { Configuration::updateValue('PS_HIDE_OPTIMIZATION_TIPS', 0); Configuration::updateValue('PS_NEED_REBUILD_INDEX', 1); Configuration::updateValue('PS_VERSION_DB', _PS_INSTALL_VERSION_); + Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_); $result .= $warningExist ? ''."\n" : ''."\n"; $result .= $requests; $result .= ''."\n";