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:
varun kewlani
2026-06-02 18:56:53 +05:30
parent 476d3b5756
commit d3d0ba26ee
2 changed files with 26 additions and 34 deletions

View File

@@ -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'];