meeting-room-booking-system / mrbs-code

MRBS application code
Other
124 stars 61 forks source link

Set booking times for school day #3171

Open jberanek opened 2 years ago

jberanek commented 2 years ago

Hi Campbell we use your system in school and it works brilliantly for us but I would like to be able to stop staff making bookings for resources after the school day ends as we check whcih resources are needed for the following day after staff leave. We have been caught out by them booking resources in the evening time.

Many thanks

Francis

Reported by: *anonymous

Original Ticket: mrbs/support-requests/2486

jberanek commented 2 years ago

Do you need anybody to be able to make bookings for resources after the school day ends? If not, just change the length of the booking day.

Original comment by: campbell-m

jberanek commented 2 years ago

Hi Campbell many thanks for the quick reply...where exactly would I do that? Would I have to do it on each resource or on the configuration file?

Original comment by: *anonymous

jberanek commented 2 years ago

I should have said that the booking system is set for periods and not times...will that make a difference.

Original comment by: *anonymous

jberanek commented 2 years ago

You'd do it by logging into MRBS as an admin, going to the Rooms page, selecting the area in question and then clicking the Edit icon (little pencil). Just delete the periods after the end of the school day.

Original comment by: campbell-m

jberanek commented 2 years ago

HI Campbell - I have attached a screenshot of the computer rooms and there is no other periods to delete that I can see. What I would like to do is stop staff booking rooms say after 4.00pm. That is allow only bookings from 8.00am - 4.00pm. Apologies for not being clear here....

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/5786e3693a/951b/attachment/MRBS%20Room%20Booking%20Periods.jpg

jberanek commented 2 years ago

Delete the period "AFTER SCHOOL" by clicking the red cross next to it and then clicking Save. It will then disappear from the system and nobody will be able to make bookings for the AFTER SCHOOL period, assuming that's what you want.

Original comment by: campbell-m

jberanek commented 2 years ago

Sorry the issue is that staff are making bookings from home in the evenings and we are not seeing them until we come in to work the next day. I dont mind staff checking bookings from home but would like to stop them making bookings from say 4.00pm each day. Is this possible?

Original comment by: *anonymous

jberanek commented 2 years ago

Ah - now I understand!! I think you'll have to modify MRBS, but it will be a fairly simple change. Which version are you running?

Original comment by: campbell-m

jberanek commented 2 years ago

V1.9.2

Original comment by: *anonymous

jberanek commented 2 years ago

Edit mrbs_sql.inc and at line 377 (ie just after the comment // We'll also round ...) add the code

  // Custom code
  $hour = date('G');
  if (($hour < 8) || ($hour >= 16))
  {
    $violations[] = "Bookings may only be made or changed between 8.00am and 4.00pm";
  }

Note that admins will still be able to make bookings.

By the way, I haven't tested this.

Original comment by: campbell-m

jberanek commented 2 years ago

Many thanks for this Campbell - I will test it and let you know the outcome either way.

Francis

Original comment by: *anonymous

jberanek commented 2 years ago

Campbell I have just tested that modification wtih a non admin user and it is working fine. I have attached a screen shot of error that user received. Many thanks with this. It would be great this this addition to be in the next release - what do you think?

Francis

Original comment by: *anonymous

jberanek commented 2 years ago

Here is error image

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/5786e3693a/e5fe/attachment/MRBS%20Booking%20Conflict.jpg

jberanek commented 2 years ago

Yes, I agree it would be a useful addition to MRBS. I'll think of a way of generalising it.

Original comment by: campbell-m

jberanek commented 2 years ago

Campbell are there some lines of code that can be added to what you provided to stop users booking on a Saturday and Sunday? i have just seen a staff member booking a resource on Saturday morning.....many thanks

Francis

Original comment by: *anonymous

jberanek commented 2 years ago

Instead of the code above use

  $date = getdate();
  if (in_array($date['wday'], array(0, 6)) || ($date['hours'] < 8) || ($date['hours'] >= 16))
  {
    $violations[] = "Bookings can only be made or changed on weekdays between 8.00am and 4.00pm";
  }

Again, I haven't tested it.

Original comment by: campbell-m

jberanek commented 2 years ago

Hi Campbell

just tested that change and it works perfectly - really appreciate this especially at the weekend to!

Original comment by: *anonymous