meeting-room-booking-system / mrbs-code

MRBS application code
Other
124 stars 61 forks source link

Change Morning Start for all current rooms #1706

Open jberanek opened 8 years ago

jberanek commented 8 years ago

Hello there, For some reasons, I would like to change morning start from 8:00 AM to 6:00 AM for all current rooms. Is it possible? I've tried to update:

// The beginning of the first slot of the day (DEFAULT VALUES FOR NEW AREAS) $morningstarts = 6; // must be integer in range 0-23 $morningstarts_minutes = 00; // must be integer in range 0-59

However, there is no luck.

Thank you,

Reported by: tranngocson9999

Original Ticket: mrbs/support-requests/983

jberanek commented 8 years ago

The config settings just change the default settings for new areas. For existing areas you need to change them through the browser. Login to MRBS as an admin, go to the Rooms page, select the area you want to change, click the edit icon and then make the changes you need to.

Original comment by: campbell-m

jberanek commented 8 years ago

Hello Campbell, Thank you for your answer. This means I have to do one by one? Are there any impacts to my existing bookings?

Original comment by: tranngocson9999

jberanek commented 8 years ago

Yes, you have to do it one by one. This means that you can have different settings for each area if you want. There will be no impact on your existing bookings.

Original comment by: campbell-m

jberanek commented 8 years ago

One more question please! Is it possible to turn off email alert for some specified bookers? Is it possible to turn off approval for some non-admin bookers? Thank you.

Original comment by: tranngocson9999

jberanek commented 8 years ago

Not without modifying the code in functions_mail.inc

Original comment by: campbell-m

jberanek commented 8 years ago

Hello Campbell, If you have time, would you mind helping me update the code to ignore sending alert email if the booker is an admin? Thank you

Best Regards

Son Tran (Mr) Database Administrator British International School, HCMC

From: Campbell Morrison [mailto:cimorrison@users.sf.net] Sent: 27 May 2016 4:32 PM To: [mrbs:support-requests] Subject: [mrbs:support-requests] #983 Change Morning Start for all current rooms

Not without modifying the code in functions_mail.inc


[support-requests:#983]https://sourceforge.net/p/mrbs/support-requests/983/ Change Morning Start for all current rooms

Status: open Group: Created: Fri May 27, 2016 08:04 AM UTC by Son Tran Last Updated: Fri May 27, 2016 09:24 AM UTC Owner: nobody

Hello there, For some reasons, I would like to change morning start from 8:00 AM to 6:00 AM for all current rooms. Is it possible? I've tried to update:

// The beginning of the first slot of the day (DEFAULT VALUES FOR NEW AREAS) $morningstarts = 6; // must be integer in range 0-23 $morningstarts_minutes = 00; // must be integer in range 0-59

However, there is no luck.

Thank you,


Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/mrbs/support-requests/983/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

Original comment by: tranngocson9999

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/65c61ed0/a654/bb51/attachment/alternate

jberanek commented 8 years ago

Hello, I also changed the morningstarts (From 8:00 am to 7:15) in the areas but if I do so the default duration ($default_duration = (8 * 60);) is empty per default. When I changed it back to 8:00am its okay again. See attached image.

Original comment by: sundalf

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/65c61ed0/d809/attachment/Screenshot%20from%202016-05-31%2018%3A38%3A12.png

jberanek commented 8 years ago

Any ideas what I did wrong?

Original comment by: sundalf

jberanek commented 8 years ago

I don't think you are doing anything wrong. I can't reproduce this in the latest default branch. I know I fixed some bugs in this area after 1.5.0 was released. Can you try the attached version of edit_entry.js.php?

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/65c61ed0/0ada/attachment/edit_entry.js.php

jberanek commented 8 years ago

Hey Campbell,

I used the attached edit_etry.js.php but the behaviour is the same.

Original comment by: sundalf

jberanek commented 8 years ago

Hmmm, strange... The old morning start time was 08:00 am and the max_duration_secs are 7200 so the default value was START: 08:00am and END 08:08am. When I change the morning start time to 07:15am the END Time is empty as writte above. BUT: When I change the morning start time to 08:02am the END time is still 08:08 am

Original comment by: sundalf

jberanek commented 8 years ago

Default duration (minutes): 8

Original comment by: sundalf

jberanek commented 8 years ago

Hi Campbell, I tested it again but took over only the changes from your attached edit_entry.php regarding stop and start time changes but without success. During fixing some bugs in this area did you perhaps change other files regarding start and stop time?

Original comment by: sundalf

jberanek commented 8 years ago

I'm getting confused about where you have got to. Is it now working?

Original comment by: campbell-m

jberanek commented 8 years ago

You attached the file. please have a look at your post from 2016-06-16. No, it is not working with it, same behavior as before...

Original comment by: sundalf

jberanek commented 8 years ago

Two questions:

(1) What version of MRBS is your system based on? (2) Can you have a look in the JavaScript console of your browser and see if you are getting errors?

Original comment by: campbell-m

jberanek commented 8 years ago
  1. Version 1.5.0
  2. See attached txt file

Original comment by: sundalf

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/65c61ed0/b92c/attachment/js_log

jberanek commented 8 years ago

When I change the morning start time to 07:15am the END Time is empty as writte above. BUT: When I change the morning start time to 08:02am the END time is still 08:08 am

Original comment by: sundalf

jberanek commented 8 years ago

OK, I think I can reproduce it now. Just to check that we are seeing the same thing, can you confirm that even though the endtime when the page is loaded is empty, there are still options that are presented when you click on the drop-down?

Original comment by: campbell-m

jberanek commented 8 years ago

Oh, sorry campbell, I thought this was clear. I can confirm that. The drop down menu works fine, only the endtime is empty when the page is loaded

Original comment by: sundalf

jberanek commented 8 years ago

The only way I can reproduce it is by having two browser windows open. The first browser window has the booking form (edit_entry.php). In the second browser window the admin.php page is open and used to change the start time. When I change the start time in the admin page and then refresh the edit_entry page I see the problem. Is this what you are seeing? Or can you also get the problem by going to the edit_entry pager from the calendar view (eg day.php)?

If you can only reproduce it by having two browser windows open then I understand what is happening and can produce a fix. The problem is that when you change the start time, the query string parameters (hour and minute) in the edit_entry page no longer correspond to the start of a slot. I will modify edit_entry.php so that it rounds the hour and minute to the start of the nearest slot.

Original comment by: campbell-m

jberanek commented 8 years ago

I have this issue also when only one page is open in the browser. I have it since I changed the start time from 8:00am to 7:15 at existing area in the area setting. When I change it back to start time 8:00am the stop time will be shown again

Original comment by: *anonymous

jberanek commented 8 years ago

Just to be clear - do you get the problem when you go to the edit_entry page from the calendar view (day.php or week.php)?

Original comment by: campbell-m

jberanek commented 8 years ago

Ohhh, wow, never tested that but now. I only get this issue when I come from month.php and not, when go to the edit_entry from day.php and week.php

Original comment by: *anonymous

jberanek commented 8 years ago

You were right - there is one change to another file which is important. In edit_entry.php after line 945, which looks like this:

    $duration    = ($enable_periods ? 60 : $default_duration);

insert the lines


    // If the duration is not an integral number of slots, then make
    // it so.   And make the duration at least one slot long.
    if ($duration%$resolution != 0)
    {
      $duration = intval(round($duration/$resolution));
      $duration = max(1, $duration);
      $duration = $duration * $resolution;
    }

Original comment by: campbell-m

jberanek commented 8 years ago

I will test this later... Thank you

Original comment by: *anonymous

jberanek commented 8 years ago

I have now fixed the problem that I was seeing in changeset 58243e4763ec. However you won't need this fix - it's a very minor problem and very unlikely to happen.

Original comment by: campbell-m

jberanek commented 8 years ago

Hey Campbell, I installed only the line above without any other further change on the edit_entry.php file but the result is the same

Original comment by: sundalf

jberanek commented 8 years ago

Then I took your edit_entry.js.php and it is still not working

Original comment by: sundalf

jberanek commented 8 years ago

Can you just remind me of your default duration and resolution for this area please?

Original comment by: campbell-m

jberanek commented 8 years ago

Default resulution: 1 min Default duration: 8 min

Original comment by: sundalf

jberanek commented 8 years ago

Can you also edit edit_entry.php and after line 929 which looks like this:

  $start_time = mktime($hour, $minute, 0, $month, $day, $year);

insert the following lines:


  // If the start time is not on a slot boundary, then make it so.  (It's just possible that it won't be
  // if (a) somebody messes with the query string or (b) somebody changes morningstarts or the
  // resolution in another browser window and then this page is refreshed with the same query string).
  $start_first_slot = get_start_first_slot($month, $day, $year);
  $start_time = max($start_first_slot, $start_time);
  if (($start_time - $start_first_slot)%$resolution != 0)
  {
    $start_time = $start_first_slot + intval(($start_time - $start_first_slot)/$resolution);  // rounds down
  }

Original comment by: campbell-m

jberanek commented 8 years ago

OK, I understand the problem now. What was happening was that the link to a new booking from month.php was wrong and would only work properly if the start of the first slot in the area was xx::00. The change to edit_entry.php above, which I made to the default branch for other reasons, will cure the problem by making sure that the hour and minute are valid.

But I've also now fixed the root cause in changeset 194ff48a6fa8. If you like, you can patch your system by changing line 424 of month.php from

      $query_string .= "&hour=$morningstarts&minute=0";

to

       $query_string .= "&hour=$morningstarts&minute=$morningstarts_minutes";

Original comment by: campbell-m

jberanek commented 8 years ago

Cool, I got it running correctly now. Thank you very much for your help and patience

Original comment by: sundalf