Elxis CMS Forum
Extensions => Components => Topic started by: msti on August 28, 2009, 13:35:42
-
Hi!
I have found a bug in IOS reservations. When a room is booked for a period of say a single day (28/8/2008 - 29/8/2008) , then IOS reservations shows the room booked for the following day as well (29/8/2008 - 30/8/2008). Here is my bug fix:
find file: /components/com_reservations/reservations.php
find line: 857
replace:
if ($resmaster->cfg->get('VACANCY')) {
$vacancy = $room->vacancy;
$numAvailable = $vacancy;
$detailedReport = $resmaster->cfg->get('DETAVREP');
for ($i=0; $i<$numdays; $i++) {
$numreserved = 0;
$chkdate = date('Y-m-d H:i:s', mktime('23', '59', '00', $mtin[1], $mtin[2]+$i, $mtin[0]));
$chkdate2 = date('Y-m-d H:i:s', mktime('00', '01', '00', $mtin[1], $mtin[2]+$i, $mtin[0]));
$database->setQuery("SELECT quantity FROM #__res_reservations WHERE rid='".$rid."' AND (checkin <= '".$chkdate."') AND (checkout >= '".$chkdate2."')");
if ($rows = $database->loadResultArray()) {
foreach ($rows as $row) { $numreserved = $numreserved + $row; }
}
$av = $vacancy - $numreserved;
if ($av < $numAvailable) { $numAvailable = $av; }
if ($detailedReport) {
$icon = ($av >0) ? 'tick.png' : 'publish_x.png';
echo '<img src="'.$mainframe->getCfg('live_site').'/administrator/images/'.$icon.'" border="0" alt="availability report" /> ';
echo mosFormatDate($chkdate, '', '0').': <strong>'.$numreserved.'</strong> '.$resmaster->lng->RESERVED.', <strong>'.($vacancy - $numreserved).'</strong> '.$resmaster->lng->AVAILABLE.'<br />'._LEND;
}
}
}
with:
if ($resmaster->cfg->get('VACANCY')) {
$vacancy = $room->vacancy;
$numAvailable = $vacancy;
$database->setQuery("SELECT * FROM #__res_hotels WHERE hid='".$hid."' AND published='1'", '#__', 1, 0);
$database->loadObject($hotel);
$checkin_hour = explode(':',$hotel->checkintime);
$checkout_hour = explode(':',$hotel->checkouttime);
$detailedReport = $resmaster->cfg->get('DETAVREP');
for ($i=0; $i<$numdays; $i++) {
$numreserved = 0;
//$chkdate = date('Y-m-d H:i:s', mktime('23', '59', '00', $mtin[1], $mtin[0]+$i, $mtin[2]));
//$chkdate2 = date('Y-m-d H:i:s', mktime('00', '01', '00', $mtin[1], $mtin[0]+$i, $mtin[2]));
$chkdate2 = date('Y-m-d H:i:s', mktime($checkin_hour[0], '00', '00', $mtin[1], $mtin[0]+$i, $mtin[2]));
$chkdate = date('Y-m-d H:i:s', mktime($checkout_hour[0], '00', '00', $mtout[1], $mtout[0]+$i, $mtout[2]));
$database->setQuery("SELECT quantity FROM #__res_reservations WHERE rid='".$rid."' AND (checkin <= '".$chkdate."') AND (checkout >= '".$chkdate2."')");
if ($rows = $database->loadResultArray()) {
foreach ($rows as $row) { $numreserved = $numreserved + $row; }
}
$av = $vacancy - $numreserved;
if ($av < $numAvailable) { $numAvailable = $av; }
if ($detailedReport) {
$icon = ($av >0) ? 'tick.png' : 'publish_x.png';
echo '<img src="'.$mainframe->getCfg('live_site').'/administrator/images/'.$icon.'" border="0" alt="availability report" /> ';
echo mosFormatDate($chkdate2, '', '0').': <strong>'.$numreserved.'</strong> '.$resmaster->lng->RESERVED.', <strong>'.($vacancy - $numreserved).'</strong> '.$resmaster->lng->AVAILABLE.'<br />'._LEND;
}
}
}
-
Hello there!
I am new in this forum and I do not even met this module!
What happens if you choose to reserve it from 28/8/2009 - 28/8/2009 ?
Will return an error ?
-
IOS reservations is a commercial component distributed by the IOS company
www.isopensource.com
-
The problem you described might happen only under very special circumstances as the availability system uses the server's unix timestamp. Your code is wrong, you should not change the time. You made $chkdate equal to $chkdate2 and therefore the availability system can not work. The 2 timestamps should be the limits of a day.
The booking engine of IOS Reservations has been re-created from scratch making it much better, accurate and faster. The new system will be available in about a month with IOS Reservations v3.0.
-
Hi!
What are the special circumstances? As far as i know, I have installed the component to 3 different servers, and the bug is there!
If you take a closer look at the code, you will see that $chkdate and $chkdate2 are not equal.
In fact, I have added a $checkin_hour variable that is the hotel checkin time. You have not included this variable.
-
OK, the term "equal" was not right. What I wanted to say is the these 2 times should be the limits of the date. By setting the checkin/checkout times in their place you limit the availability search between these 2 times and therefor the code is wrong. To get support the procedure is as follows: you write the problem in details and send the report to me via e-mail and you also provide info to access your ftp and the elxis administration area. I will personally investigate the issue to find out what causes this problem and fix it for you.