meeting-room-booking-system / mrbs-code

MRBS application code
Other
124 stars 61 forks source link

error in the view entry page #3634

Open abidfakhrealam opened 7 months ago

abidfakhrealam commented 7 months ago

I'm encountering an issue with my MRBS. I modified the mrbs_auth.inc file is to open so all users can view the meeting details when viewing an entry. Here's the snippet of code I modified:

case 'view_entry.php':
  $result = 0;
  break;

However, when a meeting allows for registration, I'm receiving an error when attempting to view it. The error occurs at the following URL: http://3.19.252.152/view_entry.php?view=day&year=2024&month=3&day=13&area=1&id=5

the error is :

E_WARNING in /var/www/mrbs/web/view_entry.php at line 308
Attempt to read property "username" on null
MRBS GET: Array
(
    [view] => day
    [year] => 2024
    [month] => 3
    [day] => 13
    [area] => 1
    [id] => 5
)
MRBS POST: Array
(
)
MRBS SESSION: Array
(
    [last_page] => /index.php?view=day&view_all=1&page_date=2024-03-13&area=1&room=17
    [this_page] => /view_entry.php?view=day&year=2024&month=3&day=13&area=1&id=5
    [csrf_token] => 15d3f4a6d639a979cabb0e8c6a4d581fba6b26d47ec37a56f5296ddbed15a931
)

#0 MRBS\generate_backtrace() called at [/var/www/mrbs/web/functions_error.inc:219]
#1 MRBS\output_error() called at [/var/www/mrbs/web/functions_error.inc:249]
#2 MRBS\error_handler(2, Attempt to read property "username" on null, /var/www/mrbs/web/view_entry.php, 308) called at [/var/www/mrbs/web/view_entry.php:308]
#3 MRBS\generate_event_registration(array, /index.php?view=day&view_all=1&page_date=2024-03-13&area=1&room=17) called at [/var/www/mrbs/web/view_entry.php:762]
Uncaught exception 'TypeError' in /var/www/mrbs/web/language.inc at line 1126
MRBS\utf8_strtolower(): Argument #1 ($str) must be of type string, null given, called in /var/www/mrbs/web/functions.inc on line 35
#0 /var/www/mrbs/web/functions.inc(35): MRBS\utf8_strtolower()
#1 /var/www/mrbs/web/view_entry.php(309): MRBS\in_arrayi()
#2 /var/www/mrbs/web/view_entry.php(762): MRBS\generate_event_registration()
#3 {main}

MRBS GET: Array
(
    [view] => day
    [year] => 2024
    [month] => 3
    [day] => 13
    [area] => 1
    [id] => 5
)
MRBS POST: Array
(
)
MRBS SESSION: Array
(
    [last_page] => /index.php?view=day&view_all=1&page_date=2024-03-13&area=1&room=17
    [this_page] => /view_entry.php?view=day&year=2024&month=3&day=13&area=1&id=5
    [csrf_token] => 15d3f4a6d639a979cabb0e8c6a4d581fba6b26d47ec37a56f5296ddbed15a931
)

#0 MRBS\generate_backtrace() called at [/var/www/mrbs/web/functions_error.inc:219]
#1 MRBS\output_error() called at [/var/www/mrbs/web/functions_error.inc:262]
#2 MRBS\output_exception_error(object) called at [/var/www/mrbs/web/functions_error.inc:270]
#3 MRBS\exception_handler(object)
Whoops! Unfortunately MRBS has encountered a fatal error. Please consult your system administrator.
campbell-m commented 6 months ago

I've now fixed the problem in f89540f.

Are you expecting users who haven't logged in to be able to register? If so, how do you see that working?

abidfakhrealam commented 6 months ago

Yes, we wanted to use the registration process to identify attendees. We only want students to use the registration process to register for the room event program. We do not require students to provide login credentials to make bookings on the platform. They should fill in their details and write their name, course name, and email so that they can register without providing any credentials to the student.

campbell-m commented 6 months ago

I don't think that would be easy: the registration process only records usernames at the moment.

I think your best bet would be to solve #3635 somehow.