Fixed: Display dynamic check-in and check-out times in invoice PDF based on room booking status, and remove changes from order detail page
Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
@@ -363,17 +363,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
foreach ($order_bk_data as $data_k => $data_v) {
|
||||
$date_join = strtotime($data_v['date_from']).strtotime($data_v['date_to']);
|
||||
$display_date_from = $data_v['date_from'];
|
||||
$display_date_to = $data_v['date_to'];
|
||||
$objHotelBranchInformation = new HotelBranchInformation($data_v['id_hotel']);
|
||||
if ($objHotelBranchInformation->check_in) {
|
||||
$display_date_from = date('Y-m-d', strtotime($data_v['date_from']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in));
|
||||
}
|
||||
if ($objHotelBranchInformation->check_out) {
|
||||
$display_date_to = date('Y-m-d', strtotime($data_v['date_to']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out));
|
||||
}
|
||||
|
||||
/*Product price when order was created*/
|
||||
$order_details_obj = new OrderDetail($data_v['id_order_detail']);
|
||||
@@ -484,9 +473,32 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
|
||||
$num_days = HotelHelper::getNumberOfDays($data_v['date_from'], $data_v['date_to']);
|
||||
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
|
||||
$fullDate = (isset($context->controller->show_full_date) && $context->controller->show_full_date && (date('Y-m-d', strtotime($data_v['date_from'])) == date('Y-m-d', strtotime($data_v['date_to'])))) ? true : false;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, $fullDate);
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, $fullDate);
|
||||
$display_date_from = $data_v['date_from'];
|
||||
$display_date_to = $data_v['date_to'];
|
||||
if ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_OUT) {
|
||||
if ($data_v['check_in']) {
|
||||
$display_date_from = $data_v['check_in'];
|
||||
}
|
||||
if ($data_v['check_out']) {
|
||||
$display_date_to = $data_v['check_out'];
|
||||
}
|
||||
} elseif ((int)$data_v['id_status'] === HotelBookingDetail::STATUS_CHECKED_IN) {
|
||||
if ($data_v['check_in']) {
|
||||
$display_date_from = $data_v['check_in'];
|
||||
}
|
||||
if ($data_v['check_out_time']) {
|
||||
$display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time']));
|
||||
}
|
||||
} else {
|
||||
if ($data_v['check_in_time']) {
|
||||
$display_date_from = date('Y-m-d', strtotime($data_v['date_from'])) . ' ' . date('H:i:s', strtotime($data_v['check_in_time']));
|
||||
}
|
||||
if ($data_v['check_out_time']) {
|
||||
$display_date_to = date('Y-m-d', strtotime($data_v['date_to'])) . ' ' . date('H:i:s', strtotime($data_v['check_out_time']));
|
||||
}
|
||||
}
|
||||
ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = Tools::displayDate($display_date_from, null, true));
|
||||
ppp($cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = Tools::displayDate($display_date_to, null, true));
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
|
||||
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
|
||||
|
||||
@@ -3395,16 +3395,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$objBookingDemand = new HotelBookingDemands();
|
||||
$objHotelRoomType = new HotelRoomType();
|
||||
foreach ($order_detail_data as $key => $value) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation($value['id_hotel']);
|
||||
if ($objHotelBranchInformation->check_in) {
|
||||
$order_detail_data[$key]['date_from'] = date('Y-m-d', strtotime($value['date_from']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in));
|
||||
}
|
||||
if ($objHotelBranchInformation->check_out) {
|
||||
$order_detail_data[$key]['date_to'] = date('Y-m-d', strtotime($value['date_to']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out));
|
||||
}
|
||||
|
||||
$order_detail_data[$key]['total_room_price_te'] = $value['total_price_tax_excl'];
|
||||
$order_detail_data[$key]['total_room_price_ti'] = $value['total_price_tax_incl'];
|
||||
|
||||
@@ -3634,16 +3624,6 @@ class AdminOrdersControllerCore extends AdminController
|
||||
// get booking information by order
|
||||
$bookingOrderInfo = $objBookingDetail->getBookingDataByOrderId($order->id);
|
||||
foreach ($bookingOrderInfo as &$bookingOrderRoomInfo) {
|
||||
$objHotelBranchInformation = new HotelBranchInformation($bookingOrderRoomInfo['id_hotel']);
|
||||
if ($objHotelBranchInformation->check_in) {
|
||||
$bookingOrderRoomInfo['date_from'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_from']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_in));
|
||||
}
|
||||
if ($objHotelBranchInformation->check_out) {
|
||||
$bookingOrderRoomInfo['date_to'] = date('Y-m-d', strtotime($bookingOrderRoomInfo['date_to']))
|
||||
. ' ' . date('H:i:s', strtotime($objHotelBranchInformation->check_out));
|
||||
}
|
||||
|
||||
// Get last refund request for booking
|
||||
if ($bookingRefundDetail = OrderReturn::getOrdersReturnDetail($bookingOrderRoomInfo['id_order'], 0, $bookingOrderRoomInfo['id'])) {
|
||||
$bookingRefundDetail = reset($bookingRefundDetail);
|
||||
|
||||
Reference in New Issue
Block a user