Multiple issues fixed

This commit is contained in:
azhar bhat
2026-08-21 16:48:36 +05:30
parent decb01efe6
commit e1f494998b
7 changed files with 23 additions and 29 deletions

View File

@@ -3057,6 +3057,14 @@ class OrderCore extends ObjectModel
public function getOrderCompleteRefundStatus()
{
$objHotelBooking = new HotelBookingdetail();
foreach ($objHotelBooking->getOrderCurrentDataByOrderId($this->id) as $booking) {
if ($booking['id_status'] != HotelBookingDetail::STATUS_CANCELLED
&& $booking['id_status'] != HotelBookingDetail::STATUS_NO_SHOW
) {
return 0;
}
}
// any completed refund anywhere in the order takes priority over
// No-show/Cancelled and is sticky (a refund never un-completes)
if ((new OrderReturn())->hasAnyCompletedRefund($this->id)) {

View File

@@ -356,7 +356,7 @@ class OrderReturnCore extends ObjectModel
}
if ($onlyBookingIds) {
return array_column($returnDetails, 'id_htl_booking');
return array_values(array_unique(array_column($returnDetails, 'id_htl_booking')));
}
if ($customerView) {

View File

@@ -77,8 +77,11 @@ class OrderReturnDetailCore extends ObjectModel
public static function deleteReturnDetailByIdBookingDetail($idOrder, $idHtlBooking)
{
if (Validate::isLoadedObject($objOrderReturnDetail = OrderReturnDetail::getReturnDetailByIdBookingDetail($idHtlBooking))) {
if ($objOrderReturnDetail->delete()) {
$orderReturnDetails = OrderReturn::getOrdersReturnDetail($idOrder, 0, $idHtlBooking);
foreach ($orderReturnDetails as $row) {
$objOrderReturnDetail = new OrderReturnDetail((int) $row['id_order_return_detail']);
if (Validate::isLoadedObject($objOrderReturnDetail) && $objOrderReturnDetail->delete()) {
$objOrderReturn = new OrderReturn();
if (empty($objOrderReturn->getOrderRefundRequestedBookings($idOrder, $objOrderReturnDetail->id_order_return, true))) {
$objOrderReturn = new OrderReturn($objOrderReturnDetail->id_order_return);

View File

@@ -1720,10 +1720,7 @@ class HotelBookingDetail extends ObjectModel
$objHistory->id_status_to = $newStatus;
$objHistory->id_employee = isset($params['id_employee']) ? (int) $params['id_employee'] : null;
$objHistory->id_customer = isset($params['id_customer']) ? (int) $params['id_customer'] : null;
$remark = isset($params['remark']) ? $params['remark'] : '';
foreach (Language::getLanguages(true) as $lang) {
$objHistory->remark[$lang['id_lang']] = $remark;
}
$objHistory->remark = isset($params['remark']) ? $params['remark'] : '';
$objHistory->save();
Hook::exec('actionBookingStatusAfter', array(

View File

@@ -37,34 +37,26 @@ class HotelBookingStatusHistory extends ObjectModel
public static $definition = array(
'table' => 'htl_booking_status_history',
'primary' => 'id_booking_status_history',
'multilang' => true,
'fields' => array(
'id_htl_booking' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_status_from' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'allow_null' => true),
'id_status_to' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'allow_null' => true),
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'allow_null' => true),
'remark' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// lang fields
'remark' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml'),
),
);
/**
* @param int $idHtlBooking
* @param int $idLang
* @return array history rows for one booking, oldest first
*/
public function getHistoryByBooking($idHtlBooking, $idLang = 0)
public function getHistoryByBooking($idHtlBooking)
{
if (!$idLang) {
$idLang = Context::getContext()->language->id;
}
$sql = 'SELECT hbsh.*, hbshl.`remark` FROM `'._DB_PREFIX_.$this->table.'` hbsh
LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` hbshl ON hbsh.`id_booking_status_history` = hbshl.`id_booking_status_history` AND hbshl.`id_lang` = '.(int) $idLang.'
WHERE hbsh.`id_htl_booking` = '.(int) $idHtlBooking.'
ORDER BY hbsh.`id_booking_status_history` ASC';
$sql = 'SELECT * FROM `'._DB_PREFIX_.$this->table.'`
WHERE `id_htl_booking` = '.(int) $idHtlBooking.'
ORDER BY `id_booking_status_history` ASC';
return Db::getInstance()->executeS($sql);
}

View File

@@ -223,17 +223,11 @@ class HotelReservationSystemDb
`id_status_to` int(11) NOT NULL,
`id_employee` int(11) DEFAULT NULL,
`id_customer` int(11) DEFAULT NULL,
`remark` text,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id_booking_status_history`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_booking_status_history_lang` (
`id_booking_status_history` int(11) NOT NULL,
`id_lang` int(11) NOT NULL,
`remark` text,
PRIMARY KEY (`id_booking_status_history`, `id_lang`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_booking_document` (
`id_htl_booking_document` int(11) NOT NULL AUTO_INCREMENT,
`id_htl_booking` int(11) NOT NULL,
@@ -627,7 +621,6 @@ class HotelReservationSystemDb
`'._DB_PREFIX_.'htl_booking_status`,
`'._DB_PREFIX_.'htl_booking_status_lang`,
`'._DB_PREFIX_.'htl_booking_status_history`,
`'._DB_PREFIX_.'htl_booking_status_history_lang`,
`'._DB_PREFIX_.'htl_booking_document`,
`'._DB_PREFIX_.'htl_booking_demands`,
`'._DB_PREFIX_.'htl_booking_demands_tax`,

View File

@@ -33,6 +33,7 @@ class AdminRoomStatusesController extends ModuleAdminController
$this->lang = true;
parent::__construct();
$this->_new_list_header_design = true;
// edit only — the 5 statuses are fixed (their IDs are the
// HotelBookingDetail::STATUS_* constants used everywhere), no add/delete
@@ -122,7 +123,7 @@ class AdminRoomStatusesController extends ModuleAdminController
'type' => 'switch',
'label' => $this->l('Terminal (final) status'),
'name' => 'is_terminal_display',
'hint' => $this->l('A terminal status is final — once a room reaches it, it can\'t move to any other status. Fixed per status, cannot be changed here.'),
'hint' => $this->l('If set to Yes, a room with this status cannot be edited, only deleted. If No, the room can still be edited. This setting is fixed for each status, so it is disabled here.'),
'disabled' => true,
'values' => array(
array(