Added: New column 'planned checkout' in the hotel booking detail.

Added: New column 'planned checkout' in the hotel booking detail.
This commit is contained in:
Rohit Jain
2025-05-13 13:37:26 +05:30
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -62,6 +62,7 @@ class HotelBookingDetail extends ObjectModel
public $adults;
public $children;
public $child_ages;
public $planned_check_out;
public $date_add;
public $date_upd;
@@ -124,6 +125,7 @@ class HotelBookingDetail extends ObjectModel
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 255, 'required' => true),
'check_in_time' => array('type' => self::TYPE_STRING, 'required' => true),
'check_out_time' => array('type' => self::TYPE_STRING, 'required' => true),
'planned_check_out' => array('type' => self::TYPE_STRING, 'required' => true),
'adults' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'children' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'child_ages' => array('type' => self::TYPE_STRING),
@@ -3665,4 +3667,18 @@ class HotelBookingDetail extends ObjectModel
return $result;
}
public function add($auto_date = true, $null_values = false)
{
if (!$this->planned_check_out) {
$objHotelBranchInfo = new HotelBranchInformation((int) $this->id_hotel);
$dateTo = new DateTime($this->date_to);
$timeParts = explode(':', $objHotelBranchInfo->check_out);
$dateTo->setTime($timeParts[0], $timeParts[1]);
$this->planned_check_out = $dateTo->format('Y-m-d H:i:s');
}
return parent::add($auto_date, $null_values);
}
}

View File

@@ -153,6 +153,7 @@ class HotelReservationSystemDb
`comment` text NOT NULL,
`check_in` datetime NOT NULL,
`check_out` datetime NOT NULL,
`planned_check_out` datetime NOT NULL,
`date_from` datetime NOT NULL,
`date_to` datetime NOT NULL,
`total_price_tax_excl` decimal(20,6) NOT NULL,