[BUG] Small bug in Room Availability schedule

Discuss everything related to PHP Hotel Site. All versions. Any questions related to the PHP Hotel Site developing or using should be posted to this forum.

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

PrinceOfAbyss
Junior
Junior
Posts: 17
Joined: Apr 1st, '18, 23:17

[BUG] Small bug in Room Availability schedule

Postby PrinceOfAbyss » Apr 19th, '18, 17:12

In Room Availability table where you set 0 or 1+ for the availability of rooms of each day, today is marked with a reddish background color. However, it is marked for all years, ie for the next year as well. Though not a critical bug, it may create some confusion if you don't pay attention to the year selection dropdown. The fix is very simple and I'm writing it below.

In include/classes/Rooms.class.php:

Line ~693 [in public function DrawRoomAvailabilitiesForm()]
code

Code: Select all

            $is_current_month = false;
            $selected_month = $room[0][$i]['m'];
            $current_day = date('d');
            if($selected_month == $current_month){
                $tr_class = 'm_current';
                $is_current_month = true;
            }
         else{
            $tr_class = (($i%2==0) ? 'm_odd' : 'm_even');
         }

change to

Code: Select all

            $is_current_month = false;
            $is_current_year = false;
            $selected_month = $room[0][$i]['m'];
            $current_day = date('d');
            if($selected_month == $current_month){
                $tr_class = 'm_current';
                $is_current_month = true;
            }
         else{
            $tr_class = (($i%2==0) ? 'm_odd' : 'm_even');
         }
            if($selected_year == $current_year){
                $is_current_year = true;
            }


Then, a little below, line ~724
code

Code: Select all

                if($is_current_month && $current_day == $day){

change to

Code: Select all

                if($is_current_year && $is_current_month && $current_day == $day){


The bug and the fix result can be seen in the following images:

2018.PNG
2018
2018.PNG (41.06 KiB) Viewed 172 times


2019_before.PNG
2019 - before fix
2019_before.PNG (27.44 KiB) Viewed 172 times


2019_after.PNG
2019 - after fix
2019_after.PNG (27.25 KiB) Viewed 172 times

administrator
Site Admin
Site Admin
Posts: 5990
Joined: Jan 7th, '09, 23:18
Contact:

Re: [BUG] Small bug in Room Availability schedule

Postby administrator » Apr 22nd, '18, 09:02

Thanks!


Return to “ApPHP HotelSite / uHotelBooking Talk {developers/users}”