diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 516a755ab..7a32be778 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -1384,7 +1384,7 @@ abstract class PaymentModuleCore extends Module } // End foreach $order_detail_list // delete cart feature prices after booking creation success - HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart); if (count($cart_rules)) { foreach ($cart_rules as $idCartRule => $cartRule) { diff --git a/classes/webservice/WebserviceSpecificManagementBookings.php b/classes/webservice/WebserviceSpecificManagementBookings.php index e0c0997b5..0fb05d23a 100644 --- a/classes/webservice/WebserviceSpecificManagementBookings.php +++ b/classes/webservice/WebserviceSpecificManagementBookings.php @@ -1710,7 +1710,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We 'id_cart' => (int) $this->context->cart->id, 'id_guest' => (int) $this->context->cart->id_guest, 'date_from' => date('Y-m-d', strtotime($dateFrom)), - 'date_to' => date('Y-m-d', strtotime($dateTo)), + 'date_to' => date('Y-m-d', strtotime($dateTo) - _TIME_1_DAY_), 'id_room' => $objCartBookingData->id_room, 'price' => $room['unit_price_without_tax'] ) @@ -2331,7 +2331,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We } $this->deleteWsFeaturePrices(); - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); } /** @@ -2878,8 +2878,8 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objRoomTypeFeaturePricing->id_room = (int) $params['id_room']; $objRoomTypeFeaturePricing->feature_price_name = $feature_price_name; $objRoomTypeFeaturePricing->date_selection_type = HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE; - $objRoomTypeFeaturePricing->date_from = date('Y-m-d', strtotime($params['date_from'])); - $objRoomTypeFeaturePricing->date_to = date('Y-m-d', (strtotime($params['date_to']) - _TIME_1_DAY_)); + $objRoomTypeFeaturePricing->date_from = $params['date_from']; + $objRoomTypeFeaturePricing->date_to = $params['date_to']; $objRoomTypeFeaturePricing->is_special_days_exists = 0; $objRoomTypeFeaturePricing->special_days = json_encode(false); $objRoomTypeFeaturePricing->impact_way = HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE; @@ -2970,7 +2970,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We 'id_cart' => (int) $objCart->id, 'id_guest' => (int) $objCart->id_guest, 'date_from' => date('Y-m-d', strtotime($objHotelBookingDetail->date_from)), - 'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to)), + 'date_to' => date('Y-m-d', strtotime($objHotelBookingDetail->date_to) - _TIME_1_DAY_), 'id_room' => $objHotelBookingDetail->id_room, 'price' => $room['unit_price_without_tax'] ) @@ -3006,7 +3006,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We $objOrder->total_products_wt += $objHotelBookingDetail->total_price_tax_incl; $objOrder->update(); - HotelRoomTypeFeaturePricing::deleteByIdCart($objCart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($objCart->id); $this->deleteWsFeaturePrices(); } } diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index a3cd2dfdc..9d1174adf 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -960,7 +960,7 @@ class AdminCartsControllerCore extends AdminController } if ($this->tabAccess['edit'] === '1') { - HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart, $id_product, $id_room, $date_from, $date_to); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart, $id_product, $id_room, $date_from, $date_to); $feature_price_name = array(); foreach (Language::getIDs(true) as $id_lang) { $feature_price_name[$id_lang] = 'Auto-generated'; diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 495cd7aaa..a75cfec92 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -4681,7 +4681,7 @@ class AdminOrdersControllerCore extends AdminController } // delete cart feature prices after room addition success - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); die(json_encode(array( 'result' => true, @@ -4842,7 +4842,7 @@ class AdminOrdersControllerCore extends AdminController } // delete cart feature prices after booking update success - HotelRoomTypeFeaturePricing::deleteByIdCart($cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart->id); // Calculate differences of price (Before / After) $diff_price_tax_incl = $totalRoomPriceAfterTI - $totalRoomPriceBeforeTI; diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 3aab098e2..1bbc1f236 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -2136,7 +2136,7 @@ class HotelBookingDetail extends ObjectModel } // delete cart feature prices after room addition success - HotelRoomTypeFeaturePricing::deleteByIdCart($this->context->cart->id); + HotelRoomTypeFeaturePricing::deleteFeaturePrices($this->context->cart->id); // =============================================================== // END: Add Process of the old booking diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index 94b42f39d..8cfaab339 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -363,7 +363,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $params['roomTypeId'] = $id_product; $params['featurePriceName'] = 'Webservice Feature Price'; $params['dateFrom'] = $dateFrom; - $params['dateTo'] = $dateTo; + $featurePriceDateTo = date('Y-m-d', (strtotime($dateTo) - _TIME_1_DAY_)); + $params['dateTo'] = $featurePriceDateTo; $params['priceImpactWay'] = $priceImpactWay; $params['isSpecialDaysExists'] = 0; $params['jsonSpecialDays'] = null; @@ -376,7 +377,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( $id_product, $dateFrom, - $dateTo, + $featurePriceDateTo, 'specific_date' ); if ($featurePriceExists) { @@ -393,12 +394,12 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $featurePriceExists = $this->checkRoomTypeFeaturePriceExistance( $id_product, $dateFrom, - $dateTo, + $featurePriceDateTo, 'date_range' ); if ($featurePriceExists) { if ($featurePriceExists['date_from'] == $dateFrom - && $featurePriceExists['date_to'] == $dateTo + && $featurePriceExists['date_to'] == $featurePriceDateTo ) { if (!$this->saveFeaturePricePlan( $featurePriceExists['id'], @@ -409,8 +410,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel } } else { for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) { - $currentDate = date('Y-m-d', $date); - $nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate))); + // Creating feature prices day wise, for single days. + $nextDayDate = $currentDate = date('Y-m-d', $date); $params['dateFrom'] = $currentDate; $params['dateTo'] = $nextDayDate; $params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC; @@ -611,7 +612,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $roomTypeFeaturePricing->date_selection_type = $params['dateSelectionType']; $roomTypeFeaturePricing->date_from = $params['dateFrom']; - $roomTypeFeaturePricing->date_to = date('Y-m-d', (strtotime($params['dateTo']) - _TIME_1_DAY_)); + $roomTypeFeaturePricing->date_to = $params['dateTo']; $roomTypeFeaturePricing->impact_way = $params['priceImpactWay']; $roomTypeFeaturePricing->is_special_days_exists = $params['isSpecialDaysExists']; $roomTypeFeaturePricing->special_days = $params['jsonSpecialDays'];