From 38d8bb2b94932b3dbc98cbaff075e18ea8fba194 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 29 Jun 2023 15:30:23 +0530 Subject: [PATCH 001/172] Date wise breakdown added in Availability and rates search API --- .../WebserviceSpecificManagementHotelAri.php | 597 ++++++++++-------- 1 file changed, 332 insertions(+), 265 deletions(-) diff --git a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php index bfdbfdce8..bc4b33dce 100644 --- a/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php +++ b/modules/hotelreservationsystem/classes/WebserviceSpecificManagementHotelAri.php @@ -29,7 +29,7 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser public $get_booked_rooms; public $get_partial_available_rooms; public $get_unavailable_rooms; - + public $date_wise_breakdown; /** @var WebserviceOutputBuilder */ protected $objOutput; @@ -51,6 +51,7 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser 'get_booked_rooms' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'get_partial_available_rooms' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'get_unavailable_rooms' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'date_wise_breakdown' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), ), ); @@ -225,21 +226,59 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser } // now call the function - $obBookingDtl = new HotelBookingDetail(); - $ariInfo = $obBookingDtl->getBookingData($bookingParams); + $objBookingDtl = new HotelBookingDetail(); - // append request fields also. will be attached in the response xml - $ariInfo['id_hotel'] = $ariParams['id_hotel']; - $ariInfo['date_from'] = $bookingParams['date_from']; - $ariInfo['date_to'] = $bookingParams['date_to']; - $ariInfo['num_rooms'] = $totalRooms; + $searchAriData = []; + + // If api is called for getting ari info for all the dates in the provided date range + if (isset($ariParams['date_wise_breakdown']) && $ariParams['date_wise_breakdown'] && $bookingParams['search_available']) { + $dateWiseBreakdown = 1; + + $datesAriInfo = []; + + $dateFrom = $bookingParams['date_from']; + $dateTo = $bookingParams['date_to']; + + // Lets get data date by date (Every date in the date range) + $dateBookingParams = $bookingParams; + // for a single date there is no use of partial available rooms + $dateBookingParams['search_partial'] = 0; + + for ($currentDate = $dateFrom; $currentDate < $dateTo; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) { + $dateBookingParams['date_from'] = $currentDate; + $dateBookingParams['date_to'] = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); + + // get inventories for every date + $ariInfo = $objBookingDtl->getBookingData($dateBookingParams); + // append request fields also. will be attached in the response xml + $ariInfo['id_hotel'] = $ariParams['id_hotel']; + $ariInfo['date_from'] = $dateBookingParams['date_from']; + $ariInfo['date_to'] = $dateBookingParams['date_to']; + $ariInfo['num_rooms'] = $totalRooms; + + $searchAriData[] = $ariInfo; + } + } else { // If api is called for getting ari info for a particular date range + $dateWiseBreakdown = 0; + + // If api is called for getting ari info for a particular date range + $ariInfo = $objBookingDtl->getBookingData($bookingParams); + + // append request fields also. will be attached in the response xml + $ariInfo['id_hotel'] = $ariParams['id_hotel']; + $ariInfo['date_from'] = $bookingParams['date_from']; + $ariInfo['date_to'] = $bookingParams['date_to']; + $ariInfo['num_rooms'] = $totalRooms; + + $searchAriData[] = $ariInfo; + } // We have to create the json and xml response for request by ourself. So we need to check if data to be sent in xml or json // We have no way to check the output format from parent classed. So we used below code if (get_class($this->objOutput->getObjectRender()) == 'WebserviceOutputJSON') { - $this->getResponseJson($ariInfo); + $this->getResponseJson($searchAriData, $dateWiseBreakdown); } else { - $this->getResponseXml($ariInfo); + $this->getResponseXml($searchAriData, $dateWiseBreakdown); } } @@ -392,167 +431,180 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser } // create xml for the response of the ari request - private function getResponseXml($ariInfo) + private function getResponseXml($ariInfoArray, $dateWiseBreakdown = 0) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('hotel_ari', array()); - - $field = array('sqlId' => 'id_hotel', 'value' => $ariInfo['id_hotel'], 'xlink_resource' => 'hotels'); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $field = array('sqlId' => 'date_from', 'value' => $ariInfo['date_from']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $field = array('sqlId' => 'date_to', 'value' => $ariInfo['date_to']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $field = array('sqlId' => 'currency', 'value' => $objCurrency->iso_code); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - // check if availability stats are available then only process further - if (isset($ariInfo['stats']) && $ariInfo['stats']) { - $field = array('sqlId' => 'total_rooms', 'value' => $ariInfo['stats']['total_rooms']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - if (isset($ariInfo['stats']['num_avail'])) { - $field = array('sqlId' => 'total_available_rooms', 'value' => $ariInfo['stats']['num_avail']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); + if ($ariInfoArray) { + // if date wise breakup is requested the parent node will be 'hotel_aris' as per other APIs in QloApps (orders > order) + if ($dateWiseBreakdown) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('hotel_aris', array()); } + foreach ($ariInfoArray as $ariInfo) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('hotel_ari', array()); - if (isset($ariInfo['stats']['num_unavail'])) { - $field = array('sqlId' => 'total_unavailable_rooms', 'value' => $ariInfo['stats']['num_unavail']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - } - - if (isset($ariInfo['stats']['num_part_avai'])) { - $field = array('sqlId' => 'total_partial_available_rooms', 'value' => $ariInfo['stats']['num_part_avai']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - } - - if (isset($ariInfo['stats']['num_booked'])) { - $field = array('sqlId' => 'total_booked_rooms', 'value' => $ariInfo['stats']['num_booked']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - } - } - - // check if room type data is available then only process further - if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); - - foreach ($ariInfo['rm_data'] as $roomTypeInfo) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array(), array('id' => $roomTypeInfo['id_product'], 'xlink_resource' => $this->wsObject->wsUrl.'room_types'.'/'.$roomTypeInfo['id_product'])); - - $field = array('sqlId' => 'id_room_type', 'value' => $roomTypeInfo['id_product'], 'xlink_resource' => 'room_types'); + $field = array('sqlId' => 'id_hotel', 'value' => $ariInfo['id_hotel'], 'xlink_resource' => 'hotels'); $this->output .= $this->objOutput->getObjectRender()->renderField($field); - // get feature price of room type - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - 0 - ); - $field = array('sqlId' => 'base_price', 'value' => $roomTypePrice); + $field = array('sqlId' => 'date_from', 'value' => $ariInfo['date_from']); $this->output .= $this->objOutput->getObjectRender()->renderField($field); - // get feature price of room type - $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - 1 - ); - $field = array('sqlId' => 'base_price_with_tax', 'value' => $roomTypePrice); + $field = array('sqlId' => 'date_to', 'value' => $ariInfo['date_to']); $this->output .= $this->objOutput->getObjectRender()->renderField($field); - $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - $ariInfo['num_rooms'] - ); - $field = array('sqlId' => 'total_price', 'value' => $totalBookingPrice['total_price_tax_excl']); + $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $field = array('sqlId' => 'currency', 'value' => $objCurrency->iso_code); $this->output .= $this->objOutput->getObjectRender()->renderField($field); - $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - $ariInfo['num_rooms'] - ); - $field = array('sqlId' => 'total_price_with_tax', 'value' => $totalBookingPrice['total_price_tax_incl']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); + // check if availability stats are available then only process further + if (isset($ariInfo['stats']) && $ariInfo['stats']) { + $field = array('sqlId' => 'total_rooms', 'value' => $ariInfo['stats']['total_rooms']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); - $objRoomType = new Product($roomTypeInfo['id_product']); - $field = array('sqlId' => 'name', 'value' => $objRoomType->name, 'i18n' => true); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - // rooms info of the room type - if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array()); - foreach ($roomTypeInfo['data'] as $key => $roomsInfo) { - if ($key == 'available') { - $nodeRoomAvailability = 'available'; - } elseif ($key == 'unavailable') { - $nodeRoomAvailability = 'unavailable'; - } elseif ($key == 'booked') { - $nodeRoomAvailability = 'booked'; - } elseif ($key == 'partially_available') { - $nodeRoomAvailability = 'partial_available'; - } - - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($nodeRoomAvailability, array()); - if ($key == 'partially_available') { - foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { - if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array(), array('date_from' => $partialRoomsInfo['date_from'], 'date_to' => $partialRoomsInfo['date_to'])); - - foreach ($partialRoomsInfo['rooms'] as $roomInfo) { - $roomDetail = array(); - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); - - $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); - } - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rooms', array()); - } - } - } else { - if ($roomsInfo) { - foreach ($roomsInfo as $roomInfo) { - $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); - - $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); - $this->output .= $this->objOutput->getObjectRender()->renderField($field); - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); - } - } - } - - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($nodeRoomAvailability, array()); + if (isset($ariInfo['stats']['num_avail'])) { + $field = array('sqlId' => 'total_available_rooms', 'value' => $ariInfo['stats']['num_avail']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rooms', array()); + if (isset($ariInfo['stats']['num_unavail'])) { + $field = array('sqlId' => 'total_unavailable_rooms', 'value' => $ariInfo['stats']['num_unavail']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + } + + if (isset($ariInfo['stats']['num_part_avai'])) { + $field = array('sqlId' => 'total_partial_available_rooms', 'value' => $ariInfo['stats']['num_part_avai']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + } + + if (isset($ariInfo['stats']['num_booked'])) { + $field = array('sqlId' => 'total_booked_rooms', 'value' => $ariInfo['stats']['num_booked']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + } } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); + // check if room type data is available then only process further + if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array()); + + foreach ($ariInfo['rm_data'] as $roomTypeInfo) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array(), array('id' => $roomTypeInfo['id_product'], 'xlink_resource' => $this->wsObject->wsUrl.'room_types'.'/'.$roomTypeInfo['id_product'])); + + $field = array('sqlId' => 'id_room_type', 'value' => $roomTypeInfo['id_product'], 'xlink_resource' => 'room_types'); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + // get feature price of room type + $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + 0 + ); + $field = array('sqlId' => 'base_price', 'value' => $roomTypePrice); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + // get feature price of room type + $roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + 1 + ); + $field = array('sqlId' => 'base_price_with_tax', 'value' => $roomTypePrice); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + $ariInfo['num_rooms'] + ); + $field = array('sqlId' => 'total_price', 'value' => $totalBookingPrice['total_price_tax_excl']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + $ariInfo['num_rooms'] + ); + $field = array('sqlId' => 'total_price_with_tax', 'value' => $totalBookingPrice['total_price_tax_incl']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $objRoomType = new Product($roomTypeInfo['id_product']); + $field = array('sqlId' => 'name', 'value' => $objRoomType->name, 'i18n' => true); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + // rooms info of the room type + if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array()); + foreach ($roomTypeInfo['data'] as $key => $roomsInfo) { + if ($key == 'available') { + $nodeRoomAvailability = 'available'; + } elseif ($key == 'unavailable') { + $nodeRoomAvailability = 'unavailable'; + } elseif ($key == 'booked') { + $nodeRoomAvailability = 'booked'; + } elseif ($key == 'partially_available') { + $nodeRoomAvailability = 'partial_available'; + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($nodeRoomAvailability, array()); + if ($key == 'partially_available') { + foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { + if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rooms', array(), array('date_from' => $partialRoomsInfo['date_from'], 'date_to' => $partialRoomsInfo['date_to'])); + + foreach ($partialRoomsInfo['rooms'] as $roomInfo) { + $roomDetail = array(); + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); + + $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rooms', array()); + } + } + } else { + if ($roomsInfo) { + foreach ($roomsInfo as $roomInfo) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room', array(), array('id' => $roomInfo['id_room'])); + + $field = array('sqlId' => 'id_room', 'value' => $roomInfo['id_room']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $field = array('sqlId' => 'room_number', 'value' => $roomInfo['room_num']); + $this->output .= $this->objOutput->getObjectRender()->renderField($field); + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room', array()); + } + } + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($nodeRoomAvailability, array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rooms', array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); + } + + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('hotel_ari', array()); } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array()); + // if date wise breakup is requested the parent node will be 'hotel_aris' as per other APIs in QloApps (orders > order) + if ($dateWiseBreakdown) { + $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('hotel_aris', array()); + } } - $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('hotel_ari', array()); - // wrap with the common parent header of QloApps xml api responses $this->output = $this->objOutput->getObjectRender()->overrideContent($this->output); @@ -560,131 +612,146 @@ class WebserviceSpecificManagementHotelAri extends ObjectModel implements Webser } // create json for the response of the ari request - private function getResponseJson($ariInfo) + private function getResponseJson($ariInfoArray, $dateWiseBreakdown = 0) { $ariFormatted = array(); - $ariFormatted['hotel_ari'] = array(); - $ariFormatted['hotel_ari']['id_hotel'] = $ariInfo['id_hotel']; - $ariFormatted['hotel_ari']['date_from'] = $ariInfo['date_from']; - $ariFormatted['hotel_ari']['date_to'] = $ariInfo['date_to']; + if ($ariInfoArray) { + foreach ($ariInfoArray as $ariInfo) { + $dateAriInfo = array(); + $dateAriInfo = array(); + $dateAriInfo['id_hotel'] = $ariInfo['id_hotel']; + $dateAriInfo['date_from'] = $ariInfo['date_from']; + $dateAriInfo['date_to'] = $ariInfo['date_to']; - $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $ariFormatted['hotel_ari']['currency'] = $objCurrency->iso_code; + $objCurrency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $dateAriInfo['currency'] = $objCurrency->iso_code; - // check if availability stats are available then only process further - if (isset($ariInfo['stats']) && $ariInfo['stats']) { - $ariFormatted['hotel_ari']['total_rooms'] = $ariInfo['stats']['total_rooms']; - if (isset($ariInfo['stats']['num_avail'])) { - $ariFormatted['hotel_ari']['total_available_rooms'] = $ariInfo['stats']['num_avail']; - } - if (isset($ariInfo['stats']['num_unavail'])) { - $ariFormatted['hotel_ari']['total_unavailable_rooms'] = $ariInfo['stats']['num_unavail']; - } - if (isset($ariInfo['stats']['num_part_avai'])) { - $ariFormatted['hotel_ari']['total_partial_available_rooms'] = $ariInfo['stats']['num_part_avai']; - } - if (isset($ariInfo['stats']['num_booked'])) { - $ariFormatted['hotel_ari']['total_booked_rooms'] = $ariInfo['stats']['num_booked']; - } - } - - // check if room type data is available then only process further - if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) { - $ariFormatted['hotel_ari']['room_types'] = array(); - - foreach ($ariInfo['rm_data'] as $roomTypeIndex => $roomTypeInfo) { - // get feature price of room type - $roomTypePriceTE = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - 0 - ); - $roomTypePriceTI = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - 1 - ); - $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( - $roomTypeInfo['id_product'], - $ariInfo['date_from'], - $ariInfo['date_to'], - $ariInfo['num_rooms'] - ); - - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex] = array( - 'id_room_type' => $roomTypeInfo['id_product'], - 'base_price' => $roomTypePriceTE, - 'base_price_with_tax' => $roomTypePriceTI, - 'total_price' => $totalBookingPrice['total_price_tax_excl'], - 'total_price_with_tax' => $totalBookingPrice['total_price_tax_incl'] - ); - - $objRoomType = new Product($roomTypeInfo['id_product']); - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'] = array(); - foreach ($this->objOutput->getObjectRender()->languages as $idLang) { - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'][] = array( - 'id' => $idLang, - 'value' => $objRoomType->name[$idLang] - ); - } - // if only one lang than do not set name as array and set only value of the room - if (count($ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name']) == 1) { - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'] = $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['name'][0]['value']; - } - - // rooms info of the room type - if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) { - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['rooms'] = array(); - - foreach ($roomTypeInfo['data'] as $key => $roomsInfo) { - $roomsAriInfo = array(); - if ($key == 'available') { - $keyRoomAvailability = 'available'; - } elseif ($key == 'unavailable') { - $keyRoomAvailability = 'unavailable'; - } elseif ($key == 'booked') { - $keyRoomAvailability = 'booked'; - } elseif ($key == 'partially_available') { - $keyRoomAvailability = 'partially_available'; - } - - if ($roomsInfo) { - if ($key == 'partially_available') { - foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { - if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { - $roomsAriInfo[$dateIndex]['date_from'] = $partialRoomsInfo['date_from']; - $roomsAriInfo[$dateIndex]['date_to'] = $partialRoomsInfo['date_to']; - - $roomsAriInfo[$dateIndex]['rooms'] = array(); - foreach ($partialRoomsInfo['rooms'] as $roomInfo) { - $roomDetail = array(); - $roomDetail['id_room'] = $roomInfo['id_room']; - $roomDetail['room_number'] = $roomInfo['room_num']; - - $roomsAriInfo[$dateIndex]['rooms'][] = $roomDetail; - } - } - } - } else { - foreach ($roomsInfo as $roomIndex => $roomInfo) { - $roomsAriInfo[$roomIndex]['id_room'] = $roomInfo['id_room']; - $roomsAriInfo[$roomIndex]['room_number'] = $roomInfo['room_num']; - } - } - } - - $ariFormatted['hotel_ari']['room_types'][$roomTypeIndex]['rooms'][$keyRoomAvailability] = array_values($roomsAriInfo); + // check if availability stats are available then only process further + if (isset($ariInfo['stats']) && $ariInfo['stats']) { + $dateAriInfo['total_rooms'] = $ariInfo['stats']['total_rooms']; + if (isset($ariInfo['stats']['num_avail'])) { + $dateAriInfo['total_available_rooms'] = $ariInfo['stats']['num_avail']; + } + if (isset($ariInfo['stats']['num_unavail'])) { + $dateAriInfo['total_unavailable_rooms'] = $ariInfo['stats']['num_unavail']; + } + if (isset($ariInfo['stats']['num_part_avai'])) { + $dateAriInfo['total_partial_available_rooms'] = $ariInfo['stats']['num_part_avai']; + } + if (isset($ariInfo['stats']['num_booked'])) { + $dateAriInfo['total_booked_rooms'] = $ariInfo['stats']['num_booked']; } } - $ariFormatted['hotel_ari']['room_types'] = array_values($ariFormatted['hotel_ari']['room_types']); + // check if room type data is available then only process further + if (isset($ariInfo['rm_data']) && $ariInfo['rm_data']) { + $dateAriInfo['room_types'] = array(); + + foreach ($ariInfo['rm_data'] as $roomTypeIndex => $roomTypeInfo) { + // get feature price of room type + $roomTypePriceTE = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + 0 + ); + $roomTypePriceTI = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + 1 + ); + $totalBookingPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice( + $roomTypeInfo['id_product'], + $ariInfo['date_from'], + $ariInfo['date_to'], + $ariInfo['num_rooms'] + ); + + $dateAriInfo['room_types'][$roomTypeIndex] = array( + 'id_room_type' => $roomTypeInfo['id_product'], + 'base_price' => $roomTypePriceTE, + 'base_price_with_tax' => $roomTypePriceTI, + 'total_price' => $totalBookingPrice['total_price_tax_excl'], + 'total_price_with_tax' => $totalBookingPrice['total_price_tax_incl'] + ); + + $objRoomType = new Product($roomTypeInfo['id_product']); + $dateAriInfo['room_types'][$roomTypeIndex]['name'] = array(); + foreach ($this->objOutput->getObjectRender()->languages as $idLang) { + $dateAriInfo['room_types'][$roomTypeIndex]['name'][] = array( + 'id' => $idLang, + 'value' => $objRoomType->name[$idLang] + ); + } + // if only one lang than do not set name as array and set only value of the room + if (count($dateAriInfo['room_types'][$roomTypeIndex]['name']) == 1) { + $dateAriInfo['room_types'][$roomTypeIndex]['name'] = $dateAriInfo['room_types'][$roomTypeIndex]['name'][0]['value']; + } + + // rooms info of the room type + if (isset($roomTypeInfo['data']) && $roomTypeInfo['data']) { + $dateAriInfo['room_types'][$roomTypeIndex]['rooms'] = array(); + + foreach ($roomTypeInfo['data'] as $key => $roomsInfo) { + $roomsAriInfo = array(); + if ($key == 'available') { + $keyRoomAvailability = 'available'; + } elseif ($key == 'unavailable') { + $keyRoomAvailability = 'unavailable'; + } elseif ($key == 'booked') { + $keyRoomAvailability = 'booked'; + } elseif ($key == 'partially_available') { + $keyRoomAvailability = 'partially_available'; + } + + if ($roomsInfo) { + if ($key == 'partially_available') { + foreach ($roomsInfo as $dateIndex => $partialRoomsInfo) { + if (isset($partialRoomsInfo['rooms']) && $partialRoomsInfo['rooms']) { + $roomsAriInfo[$dateIndex]['date_from'] = $partialRoomsInfo['date_from']; + $roomsAriInfo[$dateIndex]['date_to'] = $partialRoomsInfo['date_to']; + + $roomsAriInfo[$dateIndex]['rooms'] = array(); + foreach ($partialRoomsInfo['rooms'] as $roomInfo) { + $roomDetail = array(); + $roomDetail['id_room'] = $roomInfo['id_room']; + $roomDetail['room_number'] = $roomInfo['room_num']; + + $roomsAriInfo[$dateIndex]['rooms'][] = $roomDetail; + } + } + } + } else { + foreach ($roomsInfo as $roomIndex => $roomInfo) { + $roomsAriInfo[$roomIndex]['id_room'] = $roomInfo['id_room']; + $roomsAriInfo[$roomIndex]['room_number'] = $roomInfo['room_num']; + } + } + } + + $dateAriInfo['room_types'][$roomTypeIndex]['rooms'][$keyRoomAvailability] = array_values($roomsAriInfo); + } + } + + $dateAriInfo['room_types'] = array_values($dateAriInfo['room_types']); + } + } + + $ariFormatted[] = $dateAriInfo; } } // change the content to the json form for api response - $this->output .= json_encode($ariFormatted); + $ariReponse = []; + if ($dateWiseBreakdown) { + // if date wise breakup is requested the parent node will be 'hotel_aris' as per other APIs in QloApps (orders > order) + $ariReponse['hotel_aris'] = array_values($ariFormatted); + } else { + $ariReponse['hotel_ari'] = $ariFormatted[0]; + } + + $this->output .= json_encode($ariReponse); $this->output = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($matches) { return iconv('UCS-4LE','UTF-8', pack('V', hexdec('U' . $matches[1]))); }, $this->output); From a614aee387b739870df6449edfad928a4733e9a4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 16 Jan 2024 15:38:29 +0530 Subject: [PATCH 002/172] Updated the adminimportcontroller to allow the admin to import rooms, room types, hotels, orders, etc. using the csv files. --- .../controllers/import/helpers/form/form.tpl | 135 +- controllers/admin/AdminImportController.php | 2703 +++++++++++------ docs/csv_import/alias_import.csv | 8 +- docs/csv_import/bookings_import.csv | 4 + docs/csv_import/categories_import.csv | 7 +- docs/csv_import/customers_import.csv | 20 +- docs/csv_import/hotels_import.csv | 3 + docs/csv_import/room_types_import.csv | 3 + docs/csv_import/rooms_import.csv | 3 + docs/csv_import/service_products_import.csv | 4 + 10 files changed, 1957 insertions(+), 933 deletions(-) create mode 100644 docs/csv_import/bookings_import.csv create mode 100644 docs/csv_import/hotels_import.csv create mode 100644 docs/csv_import/room_types_import.csv create mode 100644 docs/csv_import/rooms_import.csv create mode 100644 docs/csv_import/service_products_import.csv diff --git a/admin/themes/default/template/controllers/import/helpers/form/form.tpl b/admin/themes/default/template/controllers/import/helpers/form/form.tpl index 5bf19d342..f82dfa8cf 100644 --- a/admin/themes/default/template/controllers/import/helpers/form/form.tpl +++ b/admin/themes/default/template/controllers/import/helpers/form/form.tpl @@ -25,7 +25,7 @@
{block name="leadin"}{/block}
{if $module_confirmation}
- {l s='Your .CSV file has been successfully imported into your shop. Don\'t forget to re-build the products\' search index.'} + {l s='Your .CSV file has been successfully imported to your website.'}
{/if}
@@ -63,7 +63,12 @@
  • {l s='Note that the Category import does not support having two categories with the same name.'}
  • -
  • {l s='Note that you can have several products with the same reference.'}
  • +
+
+
+
    +
  • {l s='Note that the bookings import with active mail feature will make the import process very slow.'}
  • +
  • {l s='You can disable the mail feature from Advanced Parameters > E-mail'}
@@ -199,42 +204,40 @@
- +
-
{l s='e.g. '} 1; Blouse; 129.90; 5
+
{l s='e.g. '} 6; 1; The Sunshine Luxury
-
{l s='e.g. '} Blouse; red.jpg, blue.jpg, green.jpg; 129.90
+
{l s='e.g. '} The Sunshine Luxury; News Paper:2.jpg, Gym:7.jpg

- +
- +
- +
- + -->
- + - +
+ +
+ {if $guestFormatedAddress} + {$guestFormatedAddress} + {else} +
+
+ + {l s='Guest address not found.'} +
+
+ {/if} +
+
+ {* Order Internal notes *} {if (sizeof($messages))}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 0c0af163a..56580527f 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -2853,7 +2853,14 @@ class AdminOrdersControllerCore extends AdminController // Overbookings information of the order $orderOverBookings = $objHotelBookingDetail->getOverbookedRooms($order->id, 0, '', '', 0, 0, 1); + // Guest address info + $guestFormatedAddress = ''; + if ($idGuestAddress = Customer::getCustomerIdAddress($order->id_customer)) { + $guestFormatedAddress = AddressFormat::generateAddress(new Address($idGuestAddress), array(), "
"); + } $this->tpl_view_vars = array( + 'guestFormatedAddress' => $guestFormatedAddress, + 'idGuestAddress' => $idGuestAddress, 'totalRefundedRooms' => $totalRefundedRooms, 'orderOverBookings' => $orderOverBookings, 'refund_allowed' => (int) $order->isReturnable(), diff --git a/js/admin/orders.js b/js/admin/orders.js index ae5dd844a..16e1331bd 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1232,7 +1232,23 @@ function setRoomTypeGuestOccupancy(booking_occupancy_wrapper) /* Refund system script */ var flagRefund = ''; +// when submit from ajax from guest address controller the function will be called from the controller header +function getSummary() +{ + return; +} + $(document).ready(function() { + // when click edit/add guest address we have to initialize fancybox + $('.fancybox').fancybox({ + 'type': 'iframe', + 'width': '90%', + 'height': '90%', + afterClose: function() { + location.reload(); + }, + }); + // when change order state to cancel or refund then show modal of bookings cancellation $(document).on('change', '#id_order_state', function(e) { if ($(this).val() == PS_OS_CANCELED || $(this).val() == PS_OS_REFUND) { From 48b4263b6a3fee6cd7bb0ef37c3fa56e39de61c3 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 10 Jul 2024 16:42:44 +0530 Subject: [PATCH 070/172] Fixed the english translation and fatal error caused if verifying using registered email --- modules/blocknewsletter/blocknewsletter.php | 2 +- modules/blocknewsletter/translations/en.php | 80 --------------------- 2 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 modules/blocknewsletter/translations/en.php diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index dfd1496e8..2ae4660ba 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -486,7 +486,7 @@ class Blocknewsletter extends Module $sql = 'SELECT MD5(CONCAT( `email` , `newsletter_date_add`, \''.pSQL(Configuration::get('NW_SALT')).'\')) as token FROM `'._DB_PREFIX_.'newsletter` WHERE 1 AND `email` = \''.pSQL($email).'\''; - } elseif ($register_status == self::CUSTOMER_NOT_REGISTERED) { + } elseif (in_array($register_status, array(self::CUSTOMER_NOT_REGISTERED, self::CUSTOMER_REGISTERED))) { $sql = 'SELECT MD5(CONCAT( `email` , `date_add`, \''.pSQL(Configuration::get('NW_SALT')).'\' )) as token FROM `'._DB_PREFIX_.'customer` WHERE 1 AND `email` = \''.pSQL($email).'\''; diff --git a/modules/blocknewsletter/translations/en.php b/modules/blocknewsletter/translations/en.php deleted file mode 100644 index ca151c6e0..000000000 --- a/modules/blocknewsletter/translations/en.php +++ /dev/null @@ -1,80 +0,0 @@ -blocknewsletter_9e31b08a00c1ed653bcaa517dee84714'] = 'Blok newslettera'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_ba457fab18d697d978befb95e827eb91'] = 'Dodaje blokadę subskrypcji newslettera.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_396c88991101b5ca362932952293d291'] = 'Czy na pewno chcesz usunąć wszystkie swoje kontakty?'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_3a0c11a4716a65627f50989b8c0a2ba8'] = 'Blok biuletynu: Nie można wyeksportować klienta za pomocą poczty elektronicznej.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_674cafd1e77028f37c08a661ff23b773'] = 'Blok biuletynu: Nie można usunąć klienta za pomocą poczty elektronicznej.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_e267e2be02cf3e29f4ba53b5d97cf78a'] = 'Niepoprawny adres email.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_1c623b291d95f4f1b1d0c03d0dc0ffa1'] = 'Ten adres email nie jest zarejestrowany.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_3b1f17a6fd92e35bc744e986b8e7a61c'] = 'Wystąpił błąd podczas próby anulowania subskrypcji.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_d4197f3e8e8b4b5d06b599bc45d683bb'] = 'Anulowanie subskrypcji powiodło się.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_f6618fce0acbfca15e1f2b0991ddbcd0'] = 'Ten adres email jest już zarejestrowany.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_e172cb581e84f43a3bd8ee4e3b512197'] = 'Wystąpił błąd podczas procesu subskrypcji.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_ebc069b1b9a2c48edfa39e344103be1e'] = 'E-mail weryfikacyjny został wysłany. Proszę, sprawdź swoją skrzynkę odbiorczą.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_77c576a354d5d6f5e2c1ba50167addf8'] = 'Pomyślnie zapisałeś się do tego newslettera.'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_544ed721c22329e581919041a14e0c72'] = 'Tytuł społecznościowy'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_bc910f8bdf70f29374f496f05be0330c'] = 'Imię'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_77587239bf4c54ea493c7033e1dbf636'] = 'Nazwisko'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_808c7457c768423c5651cbf676d9f6d7'] = 'Zasubskrybowano'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_93a524d9a34a84b2c8b9f0575c08b6c8'] = 'Data dodania'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_99c8b8e5e51bf8f00f1d66820684be9a'] = 'Ten adres e-mail jest już zarejestrowany i/lub nieprawidłowy.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_b718adec73e04ce3ec720dd11a06a308'] = 'ID'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_544ed721c22329e581919041a14e0c72'] = 'Tytuł społecznościowy'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_bc910f8bdf70f29374f496f05be0330c'] = 'Imię'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_77587239bf4c54ea493c7033e1dbf636'] = 'Nazwisko'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_ce8ae9da5b7cd6c3df2929543a9af92d'] = 'E-mail'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_808c7457c768423c5651cbf676d9f6d7'] = 'Zasubskrybowano'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_56af9211d9b2aea8984cf780b5f7d2d8'] = 'Zasubskrybowano'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_d3b206d196cd6be3a2764c1fb90b200f'] = 'Usuń wybrane'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_e25f0ecd41211b01c83e5fec41df4fe7'] = 'Usunąć wybrane elementy?'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_f7dea833543c95b08baaf59dda0bef48'] = 'Klient został pomyślnie wypisany z newslettera.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_75eb2f4f96e595c84146e888c70468b1'] = 'Wybór został pomyślnie wypisany z newslettera.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_0095a9fa74d1713e43e370a7d7846224'] = 'Eksport'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_254f642527b45bc260048e30704edb39'] = 'Konfiguracja'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_54d2f1bab16b550e32395a7e6edb8de5'] = 'Czy chcesz wysłać e-mail weryfikacyjny po subskrypcji?'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_b37f32d509cf5aabe806b16791588aa3'] = 'Czy chcesz wysłać e-mail z potwierdzeniem po subskrypcji?'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_506e58042922bff5bd753dc612e84f5b'] = 'Kod kuponu powitalnego'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_fc3d55a9294f7c485c62626c040ee16f'] = 'Możesz utworzyć kupon na stronie %s. Pozostaw puste, aby wyłączyć tę funkcję.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_65b7eaeb9ba4e9903f82297face9f7cd'] = 'Zasady koszyka'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_c9cc8cce247e49bae79f15173ce97354'] = 'Ratować'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_39f7a3e2b56e9bfd753ba6325533a127'] = 'Abonenci'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_deed5ad7044289abf4151834af518e32'] = 'Eksportuj adresy e-mail'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_623b80c92050a5b0767fdcf186786149'] = 'Użyj tej opcji, aby wyeksportować listę adresów e-mail jako plik .CSV.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_2198f293f5e1e95dddeff819fbca0975'] = 'Abonenci newslettera'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_847b0223c73ac0fec0d9df6539c7cad6'] = 'Wszyscy subskrybenci'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_a307579714b75082f3f8734971b125cd'] = 'Abonenci posiadający konto'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_d0da5609e4aebc5d532de97511a5a34a'] = 'Abonenci bez konta'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_011d8c5d94f729f013963d856cd78745'] = 'Osoby nie posiadające subskrypcji'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_1b09c341aa487e26dac94d2467b7f7e3'] = 'Filtruj klientów, którzy zapisali się do newslettera lub nie i posiadają konto lub nie.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_dbb392a2dc9b38722e69f6032faea73e'] = 'Eksportuj plik .CSV'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_417d63b1effb110e438d4b4b9f0fbd95'] = 'Kod kuponu jest nieprawidłowy.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_68a70a22b2942e7049971b6d2ef8f434'] = 'Kod kuponu nie istnieje.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_a6b62ca6afbc9be0f363df04ed40ff07'] = 'Nie znaleziono adresów e-mail do wyeksportowania.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_6910996dd14593a8529449f1cf95a49e'] = 'Nie można załadować obiektu klienta.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_1c623b291d95f4f1b1d0c03d0dc0ffa1'] = 'Ten adres email nie jest zarejestrowany.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_3b1f17a6fd92e35bc744e986b8e7a61c'] = 'Wystąpił błąd podczas próby anulowania subskrypcji.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_00902490208cfea5327999021f89b824'] = 'Wypisanie się z newslettera nie powiodło się. Proszę spróbuj ponownie.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_7ac4022061477a5003424d8244347e52'] = 'Nie można usunąć #%d'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_e9f36d65b0491f99ef8f0ce2c11bf998'] = 'Coś poszło nie tak. Proszę spróbuj ponownie.'; -$_MODULE['<{blocknewsletter}prestashop>adminnewslettercontroller_ddd4e7f16c2032d59cb4fb4b86576bc5'] = 'Musisz wybrać co najmniej jeden element do usunięcia.'; -$_MODULE['<{blocknewsletter}prestashop>view-customer-link_9788af9fa097020a285afc0651a0721c'] = 'Zobacz klienta'; -$_MODULE['<{blocknewsletter}prestashop>view-customer-link_4351cfebe4b61d8aa5efa1d020710005'] = 'Pogląd'; -$_MODULE['<{blocknewsletter}prestashop>unsubscription_execution_e57610364b03e5176c683ef9e3f29702'] = 'Pomyślnie anulowałeś subskrypcję.'; -$_MODULE['<{blocknewsletter}prestashop>unsubscription_execution_720dbedf329396bf26cac10187691ffb'] = 'Zostaniesz przekierowany na stronę główną w'; -$_MODULE['<{blocknewsletter}prestashop>unsubscription_execution_e4da3b7fbbce2345d7772b0674a318d5'] = '5'; -$_MODULE['<{blocknewsletter}prestashop>unsubscription_execution_d90d8347e139d0cfc3fad11757b651ff'] = 'sekundy.'; -$_MODULE['<{blocknewsletter}prestashop>unsubscription_execution_cfe6e34a4c7f24aad32aa4299562f5b1'] = 'Strona główna'; -$_MODULE['<{blocknewsletter}prestashop>verification_execution_4e1c51e233f1ed368c58db9ef09010ba'] = 'Dziękujemy za subskrypcję naszego newslettera.'; -$_MODULE['<{blocknewsletter}prestashop>verification_execution_720dbedf329396bf26cac10187691ffb'] = 'Zostaniesz przekierowany na stronę główną w'; -$_MODULE['<{blocknewsletter}prestashop>verification_execution_e4da3b7fbbce2345d7772b0674a318d5'] = '5'; -$_MODULE['<{blocknewsletter}prestashop>verification_execution_d90d8347e139d0cfc3fad11757b651ff'] = 'sekundy.'; -$_MODULE['<{blocknewsletter}prestashop>verification_execution_cfe6e34a4c7f24aad32aa4299562f5b1'] = 'Strona główna'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_060c27814fb52fb2fe6e3c65d7b676bf'] = 'DOSTAWAĆ POWIADOMIENIA'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_198584454b0ce1101ff5b50323325aa8'] = 'Twój adres email'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_b26917587d98330d93f87808fc9d7267'] = 'Subskrybuj'; -$_MODULE['<{blocknewsletter}prestashop>blocknewsletter_103b7e768fcb636062a510da61e910ca'] = 'Brak internetu. Proszę spróbuj później.'; From 206b5bcf0718081e84a2ccb018064bc79a0fa252 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 10 Jul 2024 17:37:07 +0530 Subject: [PATCH 071/172] Fixed: Notice on the order-opc page when admin creates address using inactive country for a customer --- controllers/front/ParentOrderController.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 7bac1b5d9..655d805ac 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -423,25 +423,6 @@ class ParentOrderControllerCore extends FrontController $customerAddresses = array_values($customerAddresses); - if (!count($customerAddresses) && !Tools::isSubmit('ajax')) { - $bad_delivery = false; - if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) { - $params = array(); - if ($this->step) { - $params['step'] = (int)$this->step; - } - if ($multi = (int)Tools::getValue('multi-shipping')) { - $params['multi-shipping'] = $multi; - } - $back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, $params); - - $params = array('back' => $back_url, 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice)); - if ($multi) { - $params['multi-shipping'] = $multi; - } - - } - } $this->context->smarty->assign(array( 'addresses' => $customerAddresses, 'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList) From 14e2592fe1f8fec575a76604c1a6ab3f5b274f23 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 11 Jul 2024 13:23:15 +0530 Subject: [PATCH 072/172] update get frequest customer accoding to order date instead of invoice date --- controllers/admin/AdminStatsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 926e29a97..7a9510ffa 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -1851,7 +1851,7 @@ class AdminStatsControllerCore extends AdminStatsTabController WHERE hbd.`id_order` = o.`id_order` LIMIT 1 ) AS id_hotel FROM `'._DB_PREFIX_.'orders` o - WHERE o.`valid` = 1 AND o.`invoice_date` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" + WHERE o.`valid` = 1 AND o.`date_add` BETWEEN "'.pSQL($dateFrom).' 00:00:00" AND "'.pSQL($dateTo).' 23:59:59" GROUP BY o.`id_customer` HAVING 1 '.(!is_null($idHotel) ? HotelBranchInformation::addHotelRestriction($idHotel) : '').' ) AS t From fe31a29245b68317f08a0c064f2c1f1d5838e728 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 11 Jul 2024 15:14:30 +0530 Subject: [PATCH 073/172] prevent guest users form using welcome voucher --- classes/CartRule.php | 40 ++++++++++++++++++--- modules/blocknewsletter/blocknewsletter.php | 32 +++++++++-------- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 24d49acd6..133bce84f 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -407,7 +407,7 @@ class CartRuleCore extends ObjectModel } unset($cart_rule); - Hook::exec('actionCartRulesAvailable', array('result' => &$result, 'id_customer' => (int)$id_customer)); + Hook::exec('actionCustomerCartRulesModifier', array('cart_rules' => &$result, 'id_customer' => (int)$id_customer)); return $result; } @@ -517,6 +517,40 @@ class CartRuleCore extends ObjectModel return false; } + /* + * Custom cart rule validation from modules. Allows to create infinite possibilities of rules. + * + * If null is provided, nothing happens and built-in validation is ran. Useful if you want your own conditions, + * but also want to retain functionality of the core. + * + * If true is provided, the validation ends here and the rule is VALID, ignoring the rest of core validation. + * + * If false is provided, the validation ends here and the rule is not VALID, ignoring the rest of core validation. + * In this case, it's recommended to properly alter the isValidatedByModulesError error message so the user knows why. + */ + $isValidatedByModules = null; + $isValidatedByModulesError = Tools::displayError('This voucher is not valid.'); + Hook::exec( + 'actionValidateCartRule', + array( + 'cart_rule' => $this, + 'context' => $context, + 'alreadyInCart' => $alreadyInCart, + 'display_error' => $display_error, + 'check_carrier' => $check_carrier, + 'isValidatedByModules' => &$isValidatedByModules, + 'isValidatedByModulesError' => &$isValidatedByModulesError, + ) + ); + + if ($isValidatedByModules === false) { + return (!$display_error) ? false : $isValidatedByModulesError; + } + + if ($isValidatedByModules === true) { + return (!$display_error) ? true : null; + } + if (!$this->active) { return (!$display_error) ? false : Tools::displayError('This voucher is disabled'); } @@ -687,10 +721,6 @@ class CartRuleCore extends ObjectModel } } - if ($errors = Hook::exec('actionCheckCartRuleValid', array('cartRule' => $this))) { - return (!$display_error) ? false : Tools::displayError($errors); - } - if (!$nb_products) { return (!$display_error) ? false : Tools::displayError('Cart is empty'); } diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index e8a8c2133..dbfe6698a 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -85,8 +85,8 @@ class Blocknewsletter extends Module 'registerGDPRConsent', 'actionExportGDPRData', 'actionDeleteGDPRCustomer', - 'actionCartRulesAvailable', - 'actionCheckCartRuleValid', + 'actionCustomerCartRulesModifier', + 'actionValidateCartRule', 'actionObjectCustomerDeleteAfter', ) ); @@ -124,32 +124,36 @@ class Blocknewsletter extends Module } } - public function hookActionCartRulesAvailable($params) + public function hookActionCustomerCartRulesModifier($params) { - foreach($params['result'] as $key => $cartRule) { + $customer = new Customer($params['id_customer']); + foreach($params['cart_rules'] as $key => $cartRule) { if ($cartRule['code'] == Configuration::get('NW_VOUCHER_CODE')) { - if ($params['id_customer']) { - if (count(OrderCore::getCustomerOrders($params['id_customer']))) { + if ($customer->id && !$customer->is_guest) { + if (count(Order::getCustomerOrders($customer->id))) { // remove welcome voucher - unset($params['result'][$key]); + unset($params['cart_rules'][$key]); } } else { // remove welcome voucher - unset($params['result'][$key]); + unset($params['cart_rules'][$key]); } } } } - public function hookActionCheckCartRuleValid($params) + public function hookActionValidateCartRule($params) { - if ($params['cartRule']->code == Configuration::get('NW_VOUCHER_CODE')) { - if ($params['id_customer']) { - if (count(OrderCore::getCustomerOrders($params['id_customer']))) { - return $this->l('This voucher is not available for this booking.'); + $customer = new Customer($params['context']->cart->id_customer); + if ($params['cart_rule']->code == Configuration::get('NW_VOUCHER_CODE')) { + if ($customer->id && !$customer->is_guest) { + if (count(Order::getCustomerOrders($customer->id))) { + $params['isValidatedByModules'] = false; + $params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.'); } } else { - return $this->l('This voucher is not available for this booking.'); + $params['isValidatedByModules'] = false; + $params['isValidatedByModulesError'] = $this->l('This voucher is not available for this booking.'); } } } From cffab70e117e015af08378bbf536715f9fa59ef0 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 11 Jul 2024 19:58:12 +0530 Subject: [PATCH 074/172] removed dump added in code --- controllers/admin/AdminOrdersController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 2a5ee2178..9699b1a59 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -5132,7 +5132,6 @@ class AdminOrdersControllerCore extends AdminController $bookingPriceTaxIncl = $objBookingDetail->total_price_tax_incl; $bookingPriceTaxExcl = $objBookingDetail->total_price_tax_excl; - ddd($objBookingDetail); $objBookingDemand = new HotelBookingDemands(); $roomExtraDemandTI = $objBookingDemand->getRoomTypeBookingExtraDemands( $id_order, From 2c80a61a73b9982bd504e8c4797f0deaf1cdedf1 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 12 Jul 2024 15:17:57 +0530 Subject: [PATCH 075/172] Fix refund options not availabe if error occurs in refund request page --- .../templates/admin/order_refund_requests/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl index e69a38a28..11758f12b 100644 --- a/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl +++ b/modules/hotelreservationsystem/views/templates/admin/order_refund_requests/helpers/view/view.tpl @@ -5,7 +5,7 @@  {l s='Order Cancellation Request Information' mod='hotelreservationsystem'}

-
+
{if isset($customer_name)}
From 6c0622af234ed9c77129c0c69e15e4c5cd10eb4d Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 13 Jul 2024 13:24:05 +0530 Subject: [PATCH 076/172] Fixed: The net profit amount should decrease if an admin issues a refund by creating a voucher or credit slip --- controllers/admin/AdminStatsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminStatsController.php b/controllers/admin/AdminStatsController.php index 7d6846f18..151aeca79 100644 --- a/controllers/admin/AdminStatsController.php +++ b/controllers/admin/AdminStatsController.php @@ -532,7 +532,7 @@ class AdminStatsControllerCore extends AdminStatsTabController FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_return` orr ON (o.id_order = orr.id_order) LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (o.current_state = os.id_order_state) - WHERE orr.`payment_mode` != "" AND orr.`id_transaction` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' + WHERE orr.`payment_mode` != "" AND `invoice_date` BETWEEN "'.pSQL($date_from).' 00:00:00" AND "'.pSQL($date_to).' 23:59:59" AND os.logable = 1'.' GROUP BY LEFT(`invoice_date`, 10) HAVING 1 '.HotelBranchInformation::addHotelRestriction($id_hotel)); foreach ($result as $row) { From 0b1862c948217ca3edb76645d7e070e616a3ee4f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Jul 2024 11:14:34 +0530 Subject: [PATCH 077/172] Removed the address from the csv bookings import process --- controllers/admin/AdminImportController.php | 315 +++++++++----------- 1 file changed, 144 insertions(+), 171 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 6144b6f2f..ed5cf0d79 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -2786,195 +2786,168 @@ class AdminImportControllerCore extends AdminController } } - foreach ($ordersRow as $orderRefKey => $orderRow) { $idCustomer = $orderInfo[$orderRefKey]['id_customer']; if (Validate::isLoadedObject($objCustomer = new Customer((int) $idCustomer))) { - if (!$objCustomer->is_guest) { - $idGuest = Guest::getFromCustomer($objCustomer->id); - $id_order_state = (int) $orderInfo[$orderRefKey]['id_order_status']; - $objCartBooking = new HotelCartBookingData(); - $this->context->cart = new Cart(); - $this->context->customer = $objCustomer; - $this->context->cart->id_customer = $idCustomer; - $this->context->cart->id_guest = $idGuest; - if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists()) { - continue; - } + $idGuest = Guest::getFromCustomer($objCustomer->id); + $id_order_state = (int) $orderInfo[$orderRefKey]['id_order_status']; + $objCartBooking = new HotelCartBookingData(); + $this->context->cart = new Cart(); + $this->context->customer = $objCustomer; + $this->context->cart->id_customer = $idCustomer; + $this->context->cart->id_guest = $idGuest; + if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists()) { + continue; + } - if (!$this->context->cart->secure_key) { - $this->context->cart->secure_key = $this->context->customer->secure_key; - } + if (!$this->context->cart->secure_key) { + $this->context->cart->secure_key = $this->context->customer->secure_key; + } - if (!$this->context->cart->id_shop) { - $this->context->cart->id_shop = Configuration::get('PS_SHOP_DEFAULT'); - } + if (!$this->context->cart->id_shop) { + $this->context->cart->id_shop = Configuration::get('PS_SHOP_DEFAULT'); + } - if (!$this->context->cart->id_lang) { - $this->context->cart->id_lang = Configuration::get('PS_LANG_DEFAULT'); - } + if (!$this->context->cart->id_lang) { + $this->context->cart->id_lang = Configuration::get('PS_LANG_DEFAULT'); + } - if (!$this->context->cart->id_currency) { - $this->context->cart->id_currency = Configuration::get('PS_CURRENCY_DEFAULT'); - } + if (!$this->context->cart->id_currency) { + $this->context->cart->id_currency = Configuration::get('PS_CURRENCY_DEFAULT'); + } - if ($addresses = $objCustomer->getAddresses((int)$this->context->cart->id_lang)){ - $objCountry = new Country($addresses[0]['id_country'], $this->context->language->id); - $objHotelBookingDetails = new HotelBookingDetail(); - $amount = 0; - $due_amount = 0; - if ($objCountry->active) { - if (!$this->context->cart->id_address_invoice && isset($addresses[0])) { - $this->context->cart->id_address_invoice = (int)$addresses[0]['id_address']; + $objHotelBookingDetails = new HotelBookingDetail(); + $amount = 0; + $due_amount = 0; + $this->context->cart->setNoMultishipping(); + $this->context->cart->save(); + $occupancy = $featurePrices = array(); + foreach ($orderRow as $idHotel => $orderByHotel) { + foreach($orderByHotel as $key => $orderProduct) { + $date_from = $orderProduct['duration_dates'][0]; + $date_to = $orderProduct['duration_dates'][1]; + $bookingParams = array( + 'date_from' => $date_from, + 'date_to' => $date_to, + 'hotel_id' => $idHotel, + 'id_room_type' => $orderProduct['id_product'], + 'only_search_data' => 1, + ); + $due_amount += isset($orderProduct['due_amount']) ? $orderProduct['due_amount'] : 0; + $data = $objHotelBookingDetails->getBookingData($bookingParams); + if ($data['stats']['num_avail'] >= $orderProduct['num_rooms']) { + for ($i = 0; $i < $orderProduct['num_rooms']; $i++) { + $occupancy[$i]['adults'] = $orderProduct['adults']; + $occupancy[$i]['children'] = 0; } - if (!$this->context->cart->id_address_delivery && isset($addresses[0])) { - $this->context->cart->id_address_delivery = $addresses[0]['id_address']; - } - - $this->context->cart->setNoMultishipping(); - $this->context->cart->save(); - $occupancy = $featurePrices = array(); - foreach ($orderRow as $idHotel => $orderByHotel) { - foreach($orderByHotel as $key => $orderProduct) { - $date_from = $orderProduct['duration_dates'][0]; - $date_to = $orderProduct['duration_dates'][1]; - $bookingParams = array( - 'date_from' => $date_from, - 'date_to' => $date_to, - 'hotel_id' => $idHotel, - 'id_room_type' => $orderProduct['id_product'], - 'only_search_data' => 1, - ); - $due_amount += isset($orderProduct['due_amount']) ? $orderProduct['due_amount'] : 0; - $data = $objHotelBookingDetails->getBookingData($bookingParams); - if ($data['stats']['num_avail'] >= $orderProduct['num_rooms']) { - for ($i = 0; $i < $orderProduct['num_rooms']; $i++) { - $occupancy[$i]['adults'] = $orderProduct['adults']; - $occupancy[$i]['children'] = 0; - } - - $serviceProduct = array(); - $globalDemand = array(); - if (isset($orderProduct['id_service_products']) && count($orderProduct['id_service_products'])) { - foreach ($orderProduct['id_service_products'] as $serviceProdKey => $serviceProd) { - $objServiceProduct = new Product($serviceProd); - if (Validate::isLoadedObject($objServiceProduct)) { - $serviceProduct[$serviceProdKey]['id_product'] = $serviceProd; - $serviceProduct[$serviceProdKey]['quantity'] = 1; - } - } - } - - if (isset($orderProduct['id_additional_facilities']) && count($orderProduct['id_additional_facilities'])) { - foreach ($orderProduct['id_additional_facilities'] as $globalDemandKey => $idGlobalDemand) { - $objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $this->context->language->id); - if (Validate::isLoadedObject($objGlobalDemand)) { - $globalDemand[$globalDemandKey]['id_global_demand'] = $idGlobalDemand; - $globalDemand[$globalDemandKey]['id_option'] = 0; - } - } - } - - $globalDemand = json_encode($globalDemand); - $objCartBooking->updateCartBooking( - $orderProduct['id_product'], - $occupancy, - 'up', - $idHotel, - 0, - date('Y-m-d', strtotime($date_from)), - date('Y-m-d', strtotime($date_to)), - $globalDemand, - $serviceProduct, - $this->context->cart->id, - $this->context->cart->id_guest - ); - $objHotelCartBookingData = new HotelCartBookingData(); - if ($idRooms = $objHotelCartBookingData->getCustomerIdRoomsByIdCartIdProduct( - $this->context->cart->id, - $orderProduct['id_product'], - date('Y-m-d', strtotime($date_from)), - date('Y-m-d', strtotime($date_to)) - )) { - $productPriceTI = Product::getPriceStatic((int) $orderProduct['id_product'], true); - $productPriceTE = Product::getPriceStatic((int) $orderProduct['id_product'], false); - if ($productPriceTE) { - $taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100; - } else { - $taxRate = 0; - } - - $taxRateM = $taxRate/100; - if (isset($orderProduct['amount'])) { - $orderProduct['amount'] = (float)$orderProduct['amount']/(1+$taxRateM); - foreach ($idRooms as $idRoom) { - $hrt_feature_price = new HotelRoomTypeFeaturePricing(); - $hrt_feature_price->id_product = (int) $orderProduct['id_product']; - $hrt_feature_price->id_cart = (int) $this->context->cart->id; - $hrt_feature_price->id_guest = (int) $this->context->cart->id_guest; - foreach(Language::getLanguages(true) as $lang) { - $hrt_feature_price->feature_price_name[$lang['id_lang']] = 'csvprice'; - } - - $hrt_feature_price->date_selection_type = HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE; - $hrt_feature_price->date_from = date('Y-m-d', strtotime($date_from)); - $hrt_feature_price->date_to = date('Y-m-d', strtotime($date_to)); - $hrt_feature_price->is_special_days_exists = 0; - $hrt_feature_price->id_room = $idRoom['id_room']; - $hrt_feature_price->special_days = json_encode(false); - $hrt_feature_price->impact_way = HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE; - $hrt_feature_price->impact_type = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; - $hrt_feature_price->impact_value = $orderProduct['amount']; - $hrt_feature_price->active = 1; - $hrt_feature_price->groupBox = array_column(Group::getGroups($this->context->language->id), 'id_group'); - $hrt_feature_price->add(); - $featurePrices[] = $hrt_feature_price->id; - } - } - } + $serviceProduct = array(); + $globalDemand = array(); + if (isset($orderProduct['id_service_products']) && count($orderProduct['id_service_products'])) { + foreach ($orderProduct['id_service_products'] as $serviceProdKey => $serviceProd) { + $objServiceProduct = new Product($serviceProd); + if (Validate::isLoadedObject($objServiceProduct)) { + $serviceProduct[$serviceProdKey]['id_product'] = $serviceProd; + $serviceProduct[$serviceProdKey]['quantity'] = 1; } } } - $amount = $this->context->cart->getOrderTotal(true); - $amount = $amount - $due_amount; - if ($this->context->cart->getProducts()) { - $objPayment = new CsvOrder(); - if (!$objPayment->validateOrder( - (int) $this->context->cart->id, - $id_order_state, - $amount, - $this->l('CSV Import -- Admin'), - null, - array(), - (int) $orderInfo[$orderRefKey]['id_currency'], - false, - $objCustomer->secure_key - )) { - $this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey); - } - - foreach ($featurePrices as $idPrice) { - $featue_price = new HotelRoomTypeFeaturePricing($idPrice); - $featue_price->delete(); + if (isset($orderProduct['id_additional_facilities']) && count($orderProduct['id_additional_facilities'])) { + foreach ($orderProduct['id_additional_facilities'] as $globalDemandKey => $idGlobalDemand) { + $objGlobalDemand = new HotelRoomTypeGlobalDemand($idGlobalDemand, $this->context->language->id); + if (Validate::isLoadedObject($objGlobalDemand)) { + $globalDemand[$globalDemandKey]['id_global_demand'] = $idGlobalDemand; + $globalDemand[$globalDemandKey]['id_option'] = 0; + } + } + } + + $globalDemand = json_encode($globalDemand); + $objCartBooking->updateCartBooking( + $orderProduct['id_product'], + $occupancy, + 'up', + $idHotel, + 0, + date('Y-m-d', strtotime($date_from)), + date('Y-m-d', strtotime($date_to)), + $globalDemand, + $serviceProduct, + $this->context->cart->id, + $this->context->cart->id_guest + ); + $objHotelCartBookingData = new HotelCartBookingData(); + if ($idRooms = $objHotelCartBookingData->getCustomerIdRoomsByIdCartIdProduct( + $this->context->cart->id, + $orderProduct['id_product'], + date('Y-m-d', strtotime($date_from)), + date('Y-m-d', strtotime($date_to)) + )) { + $productPriceTI = Product::getPriceStatic((int) $orderProduct['id_product'], true); + $productPriceTE = Product::getPriceStatic((int) $orderProduct['id_product'], false); + if ($productPriceTE) { + $taxRate = (($productPriceTI-$productPriceTE)/$productPriceTE)*100; + } else { + $taxRate = 0; + } + + $taxRateM = $taxRate/100; + if (isset($orderProduct['amount'])) { + $orderProduct['amount'] = (float)$orderProduct['amount']/(1+$taxRateM); + foreach ($idRooms as $idRoom) { + $hrt_feature_price = new HotelRoomTypeFeaturePricing(); + $hrt_feature_price->id_product = (int) $orderProduct['id_product']; + $hrt_feature_price->id_cart = (int) $this->context->cart->id; + $hrt_feature_price->id_guest = (int) $this->context->cart->id_guest; + foreach(Language::getLanguages(true) as $lang) { + $hrt_feature_price->feature_price_name[$lang['id_lang']] = 'csvprice'; + } + + $hrt_feature_price->date_selection_type = HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE; + $hrt_feature_price->date_from = date('Y-m-d', strtotime($date_from)); + $hrt_feature_price->date_to = date('Y-m-d', strtotime($date_to)); + $hrt_feature_price->is_special_days_exists = 0; + $hrt_feature_price->id_room = $idRoom['id_room']; + $hrt_feature_price->special_days = json_encode(false); + $hrt_feature_price->impact_way = HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE; + $hrt_feature_price->impact_type = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE; + $hrt_feature_price->impact_value = $orderProduct['amount']; + $hrt_feature_price->active = 1; + $hrt_feature_price->groupBox = array_column(Group::getGroups($this->context->language->id), 'id_group'); + $hrt_feature_price->add(); + $featurePrices[] = $hrt_feature_price->id; + } } } - } else { - $this->warnings[] = $this->l('Order creation for the ').$objCountry->name. - $this->l(' is currently unavailable. Please activate the country to enable order creation.'); } - } else { - $this->warnings[] = sprintf( - Tools::displayError('No address found for the customer ID: %1$s'), - (isset($objCustomer->id) && !empty($objCustomer->id))? $objCustomer->id : 'null' - ); } - } else { - $this->warnings[] = sprintf( - Tools::displayError('You cannot upload booking for guest account. (Customer ID: %1$s)'), - (isset($objCustomer->id) && !empty($objCustomer->id))? $objCustomer->id : 'null' - ); + } + + $amount = $this->context->cart->getOrderTotal(true); + $amount = $amount - $due_amount; + if ($this->context->cart->getProducts()) { + $objPayment = new BoOrder(); + if (!$objPayment->validateOrder( + (int) $this->context->cart->id, + $id_order_state, + $amount, + $this->l('CSV Import -- Admin'), + null, + array(), + (int) $orderInfo[$orderRefKey]['id_currency'], + false, + $objCustomer->secure_key, + null, + false + )) { + $this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey); + } + + foreach ($featurePrices as $idPrice) { + $featue_price = new HotelRoomTypeFeaturePricing($idPrice); + $featue_price->delete(); + } } } else { $this->warnings[] = sprintf( From 99a15ad344a2e648f1c4c5f13e184163d8641b9b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 17 Jul 2024 16:09:01 +0530 Subject: [PATCH 078/172] applied the changes to get the discounted price of a room --- controllers/front/ProductController.php | 2 + .../classes/HotelCartBookingData.php | 20 +------ .../classes/HotelRoomType.php | 58 ------------------- .../_partials/booking-form.tpl | 9 ++- .../hotel-reservation-theme/css/category.css | 1 + 5 files changed, 13 insertions(+), 77 deletions(-) diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 1028ae6e0..b0840ec3d 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -763,6 +763,7 @@ class ProductControllerCore extends FrontController $demandsPrice = $demandsPricePerRoom * $quantity; // calculate total price $totalPrice = $totalRoomPrice + $demandsPrice; + $totalPriceWithoutDiscount = $objProduct->getPriceWithoutReduct(!$useTax, false, 6, 1) * $numDays; // send occupancy information searched by the user if ($occupancy && is_array($occupancy)) { $smartyVars['occupancies'] = $occupancy; @@ -784,6 +785,7 @@ class ProductControllerCore extends FrontController $smartyVars['has_room_type_demands'] = $roomTypeDemands ? true : false; // whether to show price breakup $smartyVars['rooms_price'] = $totalRoomPrice; $smartyVars['demands_price_per_room'] = $demandsPricePerRoom; + $smartyVars['total_price_without_discount'] = $totalPriceWithoutDiscount + $demandsPrice; $smartyVars['demands_price'] = $demandsPrice; $smartyVars['total_price'] = $totalPrice; $this->context->smarty->assign($smartyVars); diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index fda7d2a39..3e147a59a 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -1574,21 +1574,13 @@ class HotelCartBookingData extends ObjectModel $data_v['id_room'], 0 ); - $totalPriceWithoutDiscount = HotelRoomType::getRoomTypeTotalPriceForDateRange( - $product['id_product'], - $data_v['date_from'], - $data_v['date_to'], - $context->cart->id, - $context->cart->id_guest - ); + $totalPriceWithoutDiscount = $objProduct->getPriceWithoutReduct(!$price_tax, false, 6, 1) * $numDays; if (!$price_tax) { $amount = $roomTypeDateRangePrice['total_price_tax_excl']; $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl']; - $totalPriceWithoutDiscount = $totalPriceWithoutDiscount['total_price_tax_excl']; } else { $amount = $roomTypeDateRangePrice['total_price_tax_incl']; $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl']; - $totalPriceWithoutDiscount = $totalPriceWithoutDiscount['total_price_tax_incl']; } $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount * $varQty; $cartHotelData[$prodKey]['date_diff'][$dateJoin]['total_price_without_discount'] = $totalPriceWithoutDiscount * $varQty; @@ -1631,21 +1623,13 @@ class HotelCartBookingData extends ObjectModel $data_v['id_room'], 0 ); - $totalPriceWithoutDiscount = HotelRoomType::getRoomTypeTotalPriceForDateRange( - $product['id_product'], - $data_v['date_from'], - $data_v['date_to'], - $context->cart->id, - $context->cart->id_guest - ); + $totalPriceWithoutDiscount = $objProduct->getPriceWithoutReduct(!$price_tax, false, 6, 1) * $numDays; if (!$price_tax) { $amount = $roomTypeDateRangePrice['total_price_tax_excl']; $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_excl']; - $totalPriceWithoutDiscount = $totalPriceWithoutDiscount['total_price_tax_excl']; } else { $amount = $roomTypeDateRangePrice['total_price_tax_incl']; $amountWithoutAutoAdd = $roomTypeDateRangePriceWithoutAutoAdd['total_price_tax_incl']; - $totalPriceWithoutDiscount = $totalPriceWithoutDiscount['total_price_tax_incl']; } $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount'] = $amount; $cartHotelData[$prodKey]['date_diff'][$dateJoin]['amount_without_auto_add'] = $amountWithoutAutoAdd; diff --git a/modules/hotelreservationsystem/classes/HotelRoomType.php b/modules/hotelreservationsystem/classes/HotelRoomType.php index 90659316b..c809e088a 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomType.php +++ b/modules/hotelreservationsystem/classes/HotelRoomType.php @@ -415,62 +415,4 @@ class HotelRoomType extends ObjectModel ); } - public static function getRoomTypeTotalPriceForDateRange( - $id_product, - $date_from, - $date_to, - $id_cart = 0, - $id_guest = 0, - $with_auto_room_services = 1 - ) { - $totalPrice = array(); - $totalPrice['total_price_tax_incl'] = 0; - $totalPrice['total_price_tax_excl'] = 0; - $productPriceTI = Product::getPriceStatic((int) $id_product, true); - $productPriceTE = Product::getPriceStatic((int) $id_product, false); - - // if date_from and date_to are same then date_to will be the next date date of date_from - if (strtotime($date_from) == strtotime($date_to)) { - $date_to = date('Y-m-d', strtotime('+1 day', strtotime($date_from))); - } - - $date_from = date('Y-m-d', strtotime($date_from)); - $date_to = date('Y-m-d', strtotime($date_to)); - for($currentDate = $date_from; $currentDate < $date_to; $currentDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)))) { - $totalPrice['total_price_tax_incl'] += $productPriceTI; - $totalPrice['total_price_tax_excl'] += $productPriceTE; - } - - if ($with_auto_room_services) { - if ($servicesWithTax = RoomTypeServiceProduct::getAutoAddServices( - $id_product, - $date_from, - $date_to, - Product::PRICE_ADDITION_TYPE_WITH_ROOM, - true, - $id_cart, - $id_guest - )) { - foreach($servicesWithTax as $service) { - $totalPrice['total_price_tax_incl'] += $service['price']; - } - } - if ($servicesWithoutTax = RoomTypeServiceProduct::getAutoAddServices( - $id_product, - $date_from, - $date_to, - Product::PRICE_ADDITION_TYPE_WITH_ROOM, - false, - $id_cart, - $id_guest - )) { - foreach($servicesWithoutTax as $service) { - $totalPrice['total_price_tax_excl'] += $service['price']; - } - } - } - - return $totalPrice; - } - } diff --git a/themes/hotel-reservation-theme/_partials/booking-form.tpl b/themes/hotel-reservation-theme/_partials/booking-form.tpl index b7afa1894..647385251 100644 --- a/themes/hotel-reservation-theme/_partials/booking-form.tpl +++ b/themes/hotel-reservation-theme/_partials/booking-form.tpl @@ -137,7 +137,14 @@
-

{convertPrice price=$total_price|floatval}

+

+ {if $total_price && $total_price_without_discount > $total_price} + + {convertPrice price=$total_price_without_discount|floatval} + + {/if} + {convertPrice price=$total_price|floatval} +

{if $total_available_rooms <= $warning_count}
diff --git a/themes/hotel-reservation-theme/css/category.css b/themes/hotel-reservation-theme/css/category.css index 2e47c512e..66ce703d2 100644 --- a/themes/hotel-reservation-theme/css/category.css +++ b/themes/hotel-reservation-theme/css/category.css @@ -323,4 +323,5 @@ p.capa_txt { text-decoration: line-through; color:#e85757; font-size:18px; + display: block; } \ No newline at end of file From ffc554bf40b5fb606f349507a94341ceccc683e5 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 18 Jul 2024 16:47:02 +0530 Subject: [PATCH 079/172] fixed kpi pannel height issue --- admin/themes/default/sass/partials/_kpi.sass | 1 + admin/themes/default/sass/partials/_print.sass | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/sass/partials/_kpi.sass b/admin/themes/default/sass/partials/_kpi.sass index e6ccfe8cb..6e2e15fbf 100644 --- a/admin/themes/default/sass/partials/_kpi.sass +++ b/admin/themes/default/sass/partials/_kpi.sass @@ -16,6 +16,7 @@ $kpi-gap: 10px flex-wrap: wrap margin-left: -($kpi-gap / 2) margin-right: -($kpi-gap / 2) + flex-grow: 1 .kpi-wrap display: inline-block width: 20% diff --git a/admin/themes/default/sass/partials/_print.sass b/admin/themes/default/sass/partials/_print.sass index 9a8097f89..2732a42aa 100644 --- a/admin/themes/default/sass/partials/_print.sass +++ b/admin/themes/default/sass/partials/_print.sass @@ -81,13 +81,14 @@ i display: none !important .kpi-container.panel - margin: 30px 0 20px 0 !important border: solid 1px black !important + .actions-wrap + display: none .box-stats height: auto !important font-size: 8pt !important - i - font-size: 20pt !important + span.arrow + display: none .alert border: 1px solid black !important &:before From a66b446726889c238b4d3e8edd546489850adf13 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 18 Jul 2024 19:57:52 +0530 Subject: [PATCH 080/172] fixed voucher amount is not converted when changing currency while creating booking from back office --- classes/CartRule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 634434e53..508552f1d 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -909,7 +909,7 @@ class CartRuleCore extends ObjectModel $reduction_value = 0; $objHotelAdvancePayment = new HotelAdvancedPayment(); - $cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$filter.'_'.(int)$only_advance_payment_products; + $cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$context->currency->id.'_'.(int)$filter.'_'.(int)$only_advance_payment_products; foreach ($package['products'] as $key => $product) { if ($only_advance_payment_products) { if ($advancePaymentInfo = $objHotelAdvancePayment->getIdAdvPaymentByIdProduct($product['id_product'])) { From c39b97d4086ce517389799df03b023eb70555c67 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Jul 2024 15:40:41 +0530 Subject: [PATCH 081/172] fix num orders for frequent customers can be set to 0 --- .../admin/AdminCustomerPreferencesController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 5f81339a4..c9677499a 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -133,7 +133,7 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS' => array( 'title' => $this->l('Number of orders to use to calculate frequent customers'), 'hint' => $this->l('Set the number of orders to use to calculate frequent customers.'), - 'validation' => 'isUnsignedInt', + 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'text', 'class' => 'fixed-width-xxl', @@ -173,6 +173,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController ); } + public function beforeUpdateOptions() + { + $fieldData = $this->fields_options['customer_kpi']['fields']['PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS']; + if (!Tools::getValue('PS_KPI_FREQUENT_CUSTOMER_NB_ORDERS')) { + $this->errors[] = sprintf(Tools::displayError('field %s must be greater than 0.'), $fieldData['title']);; + } + } + /** * Update PS_B2B_ENABLE and enables / disables the associated tabs * @param $value integer Value of option From 3df11e6158659446d1f5e1d5733a2d7ccbea33a0 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 20 Jul 2024 10:16:12 +0530 Subject: [PATCH 082/172] Updated the design of the room price detail block on the opc page in the front --- themes/hotel-reservation-theme/css/global.css | 5 +++- .../hotel-reservation-theme/css/order-opc.css | 19 ++++++++++--- .../hotel-reservation-theme/shopping-cart.tpl | 27 ++++++++----------- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index 6d8662914..59a2ad187 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -7739,7 +7739,10 @@ a.price_discount_delete { #order-detail-content #cart_summary tfoot tr .text-right, #order-detail-content #cart_summary tfoot tr tbody td.cart_unit, #order-detail-content #cart_summary tbody tfoot tr td.cart_unit, #order-detail-content #cart_summary tfoot tr tbody td.cart_total, #order-detail-content #cart_summary tbody tfoot tr td.cart_total, #order-detail-content #cart_summary tfoot tr .price { display: block; float: left; - width: 50%; } } + width: 50%; } + .margin-btm-sm-10 { + margin-bottom: 10px + } } @media (max-width: 768px) { #order-detail-content #cart_summary tbody td .price { text-align: center; } diff --git a/themes/hotel-reservation-theme/css/order-opc.css b/themes/hotel-reservation-theme/css/order-opc.css index 703c43ade..270c85ca5 100644 --- a/themes/hotel-reservation-theme/css/order-opc.css +++ b/themes/hotel-reservation-theme/css/order-opc.css @@ -167,8 +167,7 @@ } #order-opc .room_type_old_price { text-decoration: line-through; - color:#FF4B4B; - display: block; + color:#979797; font-size:12px; } #order-opc .block-small-header { @@ -234,8 +233,19 @@ font-size: 24px; color: #333333; } -.order-detail-content .room_price_detail_block .plus-sign, .order-detail-content .product_price_detail_block .plus-sign { +.order-detail-content .room_price_detail_block{ + clear: both; +} +.order-detail-content .room_price_detail_block .plus-sign:before{ color: #777; + content: '+'; + margin-right: 15px; +} +.room_price_detail_block .price_block .total_price, .room_price_detail_block .demand_price_block .demand_total_price{ + word-break: break-word; +} +.order-detail-content .room_price_detail_block .plus-sign{ + display: flex; } .product_price_detail_block .product_quantity_block, .product_price_detail_block .price_block { display: inline-block; @@ -435,6 +445,9 @@ font-weight: normal!important; } @media (max-width: 767px) { + .room_price_detail_block .price_block, .room_type_old_price{ + padding-left: 15px; + } .order-detail-content .room_price_detail_block .plus-sign, .order-detail-content .product_price_detail_block .plus-sign { display: none; } diff --git a/themes/hotel-reservation-theme/shopping-cart.tpl b/themes/hotel-reservation-theme/shopping-cart.tpl index fba06ff86..5aec96f6b 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -144,16 +144,16 @@
- {if $rm_v['amount'] && $rm_v['total_price_without_discount'] > $rm_v['amount']} -
- - {displayPrice price=$rm_v['total_price_without_discount']|floatval} - -
- {/if} -
+
+ {if $rm_v['amount'] && isset($rm_v['total_price_without_discount']) && $rm_v['total_price_without_discount'] > $rm_v['amount']} +
+ + {displayPrice price=$rm_v['total_price_without_discount']|floatval} + +
+ {/if}
-
+

@@ -170,11 +170,6 @@

{/if} - {if (isset($data_v['extra_demands']) && $data_v['extra_demands']) || (isset($data_v['service_products']) && $data_v['service_products'])} - - + - - {/if}

{l s='Total rooms price'} {if $display_tax_label}{if $priceDisplay} {l s='(Excl.'} {else}{l s='(Incl.)'}{/if} {l s='all taxes.)'}{/if} @@ -182,7 +177,7 @@

{if (isset($data_v['extra_demands']) && $data_v['extra_demands']) || (isset($data_v['service_products']) && $data_v['service_products'])} -
+

@@ -200,7 +195,7 @@

-
+

{displayPrice price=($rm_v['amount']+$rm_v['demand_price'])} From 3515adf04ab1017e111f101c5656b1365066f21b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 20 Jul 2024 10:34:19 +0530 Subject: [PATCH 083/172] updated the issues for the design for the mobile view, incase no service or facility to select is available --- themes/hotel-reservation-theme/css/order-opc.css | 6 ++---- themes/hotel-reservation-theme/shopping-cart.tpl | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/themes/hotel-reservation-theme/css/order-opc.css b/themes/hotel-reservation-theme/css/order-opc.css index 270c85ca5..c51f5a187 100644 --- a/themes/hotel-reservation-theme/css/order-opc.css +++ b/themes/hotel-reservation-theme/css/order-opc.css @@ -167,7 +167,8 @@ } #order-opc .room_type_old_price { text-decoration: line-through; - color:#979797; + color:#FF4B4B; + display: block; font-size:12px; } #order-opc .block-small-header { @@ -448,9 +449,6 @@ .room_price_detail_block .price_block, .room_type_old_price{ padding-left: 15px; } - .order-detail-content .room_price_detail_block .plus-sign, .order-detail-content .product_price_detail_block .plus-sign { - display: none; - } #order-opc .cart_voucher_detail_block .submit_discount_div { margin-top: 10px; } diff --git a/themes/hotel-reservation-theme/shopping-cart.tpl b/themes/hotel-reservation-theme/shopping-cart.tpl index 5aec96f6b..ff1d61cf4 100644 --- a/themes/hotel-reservation-theme/shopping-cart.tpl +++ b/themes/hotel-reservation-theme/shopping-cart.tpl @@ -146,14 +146,12 @@

{if $rm_v['amount'] && isset($rm_v['total_price_without_discount']) && $rm_v['total_price_without_discount'] > $rm_v['amount']} -
- + {displayPrice price=$rm_v['total_price_without_discount']|floatval} - -
+ {/if}
-
+

From 53762de8200a4052da268fdcf5c4fd3e3cfff6c9 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 22 Jul 2024 13:17:58 +0530 Subject: [PATCH 084/172] fixed total amount in cart popup in admin book now page --- .../controllers/admin/AdminHotelRoomsBookingController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php index a62990a59..cc7edbc92 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php @@ -414,12 +414,11 @@ class AdminHotelRoomsBookingController extends ModuleAdminController $smartyVars['rms_in_cart'] = $objHotelCartBookingData->getCountRoomsInCart($this->id_cart, $this->id_guest); $smartyVars['products_in_cart'] = $products_in_cart; $smartyVars['total_products_in_cart'] = (int)$rms_in_cart + (int)$products_in_cart; - $cartAmountTotal = $this->context->cart->getOrderTotal(false); $cartRoomsAmount = $this->context->cart->getOrderTotal(false, cart::ONLY_ROOMS) + $this->context->cart->getOrderTotal(false, cart::ONLY_ROOM_SERVICES_WITHOUT_CONVENIENCE_FEE); $cartAmountConvenienceFee = $this->context->cart->getOrderTotal(false, cart::ONLY_CONVENIENCE_FEE); $smartyVars['cart_rooms_amount'] = $cartRoomsAmount; $smartyVars['cart_amount_convenience_fee'] = $cartAmountConvenienceFee; - $smartyVars['cart_tamount'] = $cartAmountTotal; + $smartyVars['cart_tamount'] = $cartRoomsAmount + $cartAmountConvenienceFee; $this->context->smarty->assign($smartyVars); } From a93ee2a4e445d74cb7d2ea5dafccf3f1df75c1d2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 22 Jul 2024 19:41:14 +0530 Subject: [PATCH 085/172] updated the NOTICE OF LICENSE for files added and uodated the name for the redirect.js --- modules/blocknewsletter/blocknewsletter.js | 19 +++++++++++ .../controllers/front/unsubscribe.php | 32 +++++++------------ .../controllers/front/verification.php | 2 +- .../{homepage_redirect.js => redirect.js} | 4 +-- 4 files changed, 33 insertions(+), 24 deletions(-) rename modules/blocknewsletter/views/js/front/{homepage_redirect.js => redirect.js} (92%) diff --git a/modules/blocknewsletter/blocknewsletter.js b/modules/blocknewsletter/blocknewsletter.js index 90caf5352..e34b5d2ce 100644 --- a/modules/blocknewsletter/blocknewsletter.js +++ b/modules/blocknewsletter/blocknewsletter.js @@ -1,3 +1,22 @@ +/** + * Copyright since 2010 Webkul. + * + * NOTICE OF LICENSE + * + * All right is reserved, + * Please go through LICENSE.txt file inside our module + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this module to newer + * versions in the future. If you wish to customize this module for your + * needs please refer to CustomizationPolicy.txt file inside our module for more information. + * + * @author Webkul IN + * @copyright since 2010 Webkul IN + * @license LICENSE.txt + */ + $(document).on('click', '#blocknewsletter .newsletter-btn', function (e) { e.preventDefault(); diff --git a/modules/blocknewsletter/controllers/front/unsubscribe.php b/modules/blocknewsletter/controllers/front/unsubscribe.php index 8b42f575f..877ccc959 100644 --- a/modules/blocknewsletter/controllers/front/unsubscribe.php +++ b/modules/blocknewsletter/controllers/front/unsubscribe.php @@ -1,32 +1,23 @@ -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA +* @author Webkul IN +* @copyright since 2010 Webkul IN +* @license https://store.webkul.com/license.html */ -/** - * @since 1.5.0 - */ class BlocknewsletterUnsubscribeModuleFrontController extends ModuleFrontController { /** @@ -57,8 +48,7 @@ class BlocknewsletterUnsubscribeModuleFrontController extends ModuleFrontControl { parent::setMedia(); - $this->addJS($this->module->getPathUri().'views/js/front/homepage_redirect.js'); - + $this->addJS($this->module->getPathUri().'views/js/front/redirect.js'); Media::addJsDef(array( 'homepage_url' => $this->context->link->getPageLink('index'), )); diff --git a/modules/blocknewsletter/controllers/front/verification.php b/modules/blocknewsletter/controllers/front/verification.php index 6f8ec3f99..0cf4ab4d8 100644 --- a/modules/blocknewsletter/controllers/front/verification.php +++ b/modules/blocknewsletter/controllers/front/verification.php @@ -58,7 +58,7 @@ class BlocknewsletterVerificationModuleFrontController extends ModuleFrontContro parent::setMedia(); $this->addCSS($this->module->getPathUri().'views/css/front/verification.css'); - $this->addJS($this->module->getPathUri().'views/js/front/homepage_redirect.js'); + $this->addJS($this->module->getPathUri().'views/js/front/redirect.js'); Media::addJsDef(array( 'homepage_url' => $this->context->link->getPageLink('index'), diff --git a/modules/blocknewsletter/views/js/front/homepage_redirect.js b/modules/blocknewsletter/views/js/front/redirect.js similarity index 92% rename from modules/blocknewsletter/views/js/front/homepage_redirect.js rename to modules/blocknewsletter/views/js/front/redirect.js index 4e1444d11..07700c096 100644 --- a/modules/blocknewsletter/views/js/front/homepage_redirect.js +++ b/modules/blocknewsletter/views/js/front/redirect.js @@ -1,5 +1,5 @@ /** - * 2010-2024 Webkul. + * Copyright since 2010 Webkul. * * NOTICE OF LICENSE * @@ -13,7 +13,7 @@ * needs please refer to CustomizationPolicy.txt file inside our module for more information. * * @author Webkul IN - * @copyright 2010-2024 Webkul IN + * @copyright since 2010 Webkul IN * @license LICENSE.txt */ From 93d22215eba254ea74bb083942d90db2d1537f21 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 23 Jul 2024 12:18:06 +0530 Subject: [PATCH 086/172] updated the notice of license for the newly added templated file for blocknewsletter module --- .../front/unsubscription_execution.tpl | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/modules/blocknewsletter/views/templates/front/unsubscription_execution.tpl b/modules/blocknewsletter/views/templates/front/unsubscription_execution.tpl index 9fc4db926..f893ca108 100644 --- a/modules/blocknewsletter/views/templates/front/unsubscription_execution.tpl +++ b/modules/blocknewsletter/views/templates/front/unsubscription_execution.tpl @@ -1,26 +1,20 @@ {* -* 2007-2015 PrestaShop +* Copyright since 2010 Webkul. * * NOTICE OF LICENSE * -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html * * DISCLAIMER * -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. * -* @author PrestaShop SA -* @copyright 2007-2015 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA +* @author Webkul IN +* @copyright since 2010 Webkul IN +* @license https://store.webkul.com/license.html *} {include file="$tpl_dir./errors.tpl"} From 28996df4171ad4e9a6858a1e88fd26e67838f1fa Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Tue, 23 Jul 2024 14:58:20 +0530 Subject: [PATCH 087/172] Updated: id_address_delivery is now set as 0 by default --- .../template/controllers/orders/form.tpl | 22 ++++----- classes/Cart.php | 49 +++++++------------ classes/Context.php | 1 - classes/controller/FrontController.php | 14 +++--- controllers/admin/AdminCartsController.php | 25 +++++----- controllers/front/AuthController.php | 1 - controllers/front/ParentOrderController.php | 4 -- .../classes/HotelBookingDetail.php | 3 -- 8 files changed, 47 insertions(+), 72 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 3cd980765..e2b2a90b0 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1458,21 +1458,21 @@ } /*Changed by webkul to make delivery and invoice addresses same*/ - $('#id_address_delivery').html(addresses_delivery_options).hide(); - $('#id_address_invoice').html(addresses_delivery_options).hide(); - $('#address_delivery_detail').html(address_delivery_detail); - $('#address_invoice_detail').html(address_delivery_detail); - $('#edit_delivery_address').attr('href', delivery_address_edit_link); - $('#edit_invoice_address').attr('href', delivery_address_edit_link); + // $('#id_address_delivery').html(addresses_delivery_options).hide(); + // $('#id_address_invoice').html(addresses_delivery_options).hide(); + // $('#address_delivery_detail').html(address_delivery_detail); + // $('#address_invoice_detail').html(address_delivery_detail); + // $('#edit_delivery_address').attr('href', delivery_address_edit_link); + // $('#edit_invoice_address').attr('href', delivery_address_edit_link); /*END*/ /*Original*/ - /*$('#id_address_delivery').html(addresses_delivery_options); - $('#id_address_invoice').html(addresses_invoice_options); + $('#id_address_delivery').html(addresses_delivery_options).hide(); + $('#id_address_invoice').html(addresses_invoice_options).hide(); $('#address_delivery_detail').html(address_delivery_detail); $('#address_invoice_detail').html(address_invoice_detail); $('#edit_delivery_address').attr('href', delivery_address_edit_link); - $('#edit_invoice_address').attr('href', invoice_address_edit_link);*/ + $('#edit_invoice_address').attr('href', invoice_address_edit_link); } function updateAddresses() @@ -2002,7 +2002,7 @@

-
+
-