MRBS lost all bookings after BST time change -HELP!!

MRBS lost all bookings after BST time change -HELP!!

by graham woodsford -
Number of replies: 27
Does anyone know how I get my resource bookings back in MRBS?

We have been using this block since the beginning of the year without any problems, but all bookings after Saturday (when the time changed from GMT to BST) are gone !!

Any help would be gratefully received..




Average of ratings: -
In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
I'm sorry I can't help but I sympathise - we use an offline version, not on Moodle, and all our bookings have vanished too... sad
In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by David Fountain -

It happens, I think when the server is not set with the correct time zone - so this should be your first point of attack.

Failing that then I use the following SQL (Make BACK UP first):

update mrbs_entry
set start_time = start_time - 3600
where start_time > 1238324000

update mrbs_entry
set end_time = end_time - 3600
where start_time > 1238324000

In reply to David Fountain

Re: MRBS lost all bookings after BST time change -HELP!!

by Dave Perry -
Picture of Testers
Is that correct time zone as specified in the host OS?

I've not had this problem but the idea of it happening to something I may write in future has provoked my interest in this post.

Thanks,
Dave
In reply to David Fountain

Re: MRBS lost all bookings after BST time change -HELP!!

by Allan Morris -
Hi David.

Our server was set correctly and changed from GMT to BST yesterday. I nearly got caught myself getting up early for the F1 race and just happened to remember the clocks went forward.

I've just used phpmyadmin to run the 2 x scripts you posted on our db server and that seems to have done the trick, thanks very much smile. Btw, the start and end times seem to differ in the db by only 60 not 3600 so why the big change thoughtful ?

Longer term I'm hoping to get chance to look at integrating the lastest 1.4.1 MRBS into Moodle but it will have to wait until at least Easter as I'm on my own at the moment looking after Moodle and the school network - unless someone beats me to it of course.

Thanks again.

Allan.

In reply to Allan Morris

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Allan - I would welcome any help in maintaining the MRBS block and getting it updated to 1.4.1. I had officially forked a while ago because of changes in how MRBS was handling database calls and also because of SQL injection vulnerabilities. That said, I could help guide you through what I did in terms of making the block more "Moodle-esque". Mostly using Moodle's functions for get_records, get_string, etc. Peace - Anthony
In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by Allan Morris -
We have the same problem here with our bookings.

The server has changed to BST successfully but MRBS hasn't recognised this. Here's some output from our server to confirm :

sysadmin@chhs-vle-001-wallace:~$ date
Mon Mar 30 11:41:51 BST 2009

Am considering the change to the DB as David suggested above. Has anyone tried it?

Btw, the issue has been discussed on sourceforge in the MRBS forums when this happened back in 2008 :

http://sourceforge.net/mailarchive/message.php?msg_name=E1KvCmV-0005gF-O2%40h45xhf1.ch3.sourceforge.com




In reply to Allan Morris

Re: MRBS lost all bookings after BST time change -HELP!!

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would just note that the sourceforge posting does suggest that it is a problem entirely with MRBS and not with the Moodle plugin.

Just to make sure that we are shouting at the right people tongueout

Just looking through MRBS' change log...

http://mrbs.sourceforge.net/view_text.php?section=ChangeLog&file=ChangeLog

Shows a few tweaks related to the timezone including a timezone setting in the config file. I guess if that doesn't match reality you could have a problem.
In reply to Howard Miller

Re: MRBS lost all bookings after BST time change -HELP!!

by graham woodsford -
Thanks for the suggetions so far, guys..

Despite my request not to, 'my lot' have already started to re-book their stuff, so I don't think I'd dare do any database work now as I'd almost certainly end up with booking clashes ! We'll just put it down to experience, I think !


It does look like the version of MRBS bundled with the Moodle block is way out-of-date (I have v1.2.3 from a download early this year) and this problem looks like it has been worked around/fixed in 1.4. http://mrbs.sourceforge.net/view_text.php?section=NEWS&file=NEWS refers.

So my question now is - does anybody know how to upgrade the moodle block to MRBS 1.4.1 and still maintain all of the moodle tweaks ?

BTW, it's nice to know I'm not alone with this prob - I thought I'd done something horribly wrong when I came in to work this morning !!






In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by David Davies -
First off, the SQL fix worked a treat on our MRBS, for which many thanx.

I've hacked quite a few files to add to MRBS functionality but did keep a record of each change marked with my initials in the files. I should therefore be able to grep the directory for files containing my initials and check which code I need to amend in the new version. Hopefully whoever made the Moodle changes will have done the same. When upgrading to 1.4.1 it will also be necessary to transfer all the config settings from the old version.
In reply to David Davies

Re: MRBS lost all bookings after BST time change -HELP!!

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
We are running MRBS outside of Moodle and I can confirm that this is a bug with all versions of MRBS prior to version 1.4.1

Our users also started to re-input their bookings; so I can not run an SQL fix... We are running reports from MRBS to see what should be showing and rebooking them.
In reply to Jon Witts

Re: MRBS lost all bookings after BST time change -HELP!!

by David Davies -
I've been back in the bureau today and investigated further. To upgrade to 1.4.1 timezone functionality it appears that one only needs to make two changes to the existing files.

in web/config.inc.php the following needs to be added:

*-- snip --*

// The timezone your meeting rooms run in. It is especially important
// to set this if you're using PHP 5 on Linux. In this configuration
// if you don't, meetings in a different DST than you are currently
// in are offset by the DST offset incorrectly.
//
$timezone = "Europe/London";

*-- snip --*

If your server timezone is not that above, you will need to edit that line. q.v. http://uk3.php.net/timezones for those available.

in web/functions.inc the following needs to be added near the top of the file:

*-- snip --*

/////////////////////////////////////////
// Set timezone, if one has been provided

global $timezone;

if (isset($timezone))
{
if (function_exists("date_default_timezone_set"))
{
date_default_timezone_set($timezone);
}
else
{
putenv("TZ=$timezone");
}
}

*-- snip --*

and that's it. That code was taken straight from the latest version. Making these changes didn't affect existing times, including those fixed with the SQL fix. I have a backup server running on an old computer that MRBS backs up to on a nightly basis, and I tried it out there first. I also created a meeting in early November and then changed the server time to November. The time still displayed correctly. Tomorrow I will try creating a meeting in March and then changing the server date to April.
In reply to David Davies

Re: MRBS lost all bookings after BST time change -HELP!!

by David Davies -
Further to that, transition from GMT to DST now works a treat smile Job done!
In reply to David Davies

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
David - Could you create an issue in the tracker for this and provide a patch or diff file that I could look at applying. I'd like to get this patched up for folks as too many people are being impacted by it. Thanks - Anthony

p.s. - Just a general note, that the tracker is the best way to get my attention on issues with the MRBS code. My apologies for not responding sooner.
In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Graham - Let me know if you want to try to reconcile your database. If you are careful I think we can fix up the old ones without disturbing the new ones by using the timestamp field in the mrbs_entry table. Peace - Anthony
In reply to Howard Miller

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Howard - Sorry for the delayed response. I feel behind on reading the Moodle.org forums. Any words of wisdom to bring me up to speed with this? Could someone create an issue in the tracker with instructions for how I can recreate this and begin working on a patch? Thanks - Anthony
In reply to Anthony Borrow

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
OK, it seems that most folks affected by this have managed to work around it. There seems to be a desire to upgrade the block to the latest MRBS 1.4.x. I am not opposed to it; however, it will take some time for me to review the new code and incorporate the changes made. I will likely not get to this until the summer and even then I am not sure how much time I will have. I am really interested in passing the maintenance of this project on to someone else who is actively using it in a production environment. I am no longer at the school were it was being used which means I do not use it regularly nor have access to any production data which makes testing more difficult. If any one is interested in maintaining the MRBS block please let me know as I would be happy to assist them and share my experience of getting the code to where it is but may not have much time to help get it to where it needs to go. Peace - Anthony
In reply to graham woodsford

Re: MRBS lost all bookings after BST time change -HELP!!

by Jean-Pierre Pawlak -
Same problem: lost all our bookings this weekend.

All reservation are in database.
They show up in report.
They don't show up in day/week/month view.


We are on a shared server.

Server (phpinfo) = Default timezone America/New_York
Moodle default time zone Default = Europe/Brussels

MRBS $Id: block_mrbs.php,v 1.10 2009/06/19 10:32:36 mike1989

php 5.2.8


Any solution?




In reply to Jean-Pierre Pawlak

Re: MRBS lost all bookings after BST time change -HELP!!

by David Fountain -

It happens, I think when the server is not set with the correct time zone - so this should be your first point of attack. Otherwise this will happen every year. I think it's an MRBS issue rather than a moodle one.

Failing that then I use the following SQL (Make BACK UP first):

update mrbs_entry
set start_time = start_time - 3600
where start_time > 1238324000(needs to be the first point of time where the problem occurred)

update mrbs_entry
set end_time = end_time - 3600
where start_time > 1238324000(needs to be the first point of time where the problem occurred)

I can't remember if this time of year it is -3600 or +3600, but this SQL is fairly easy to try and to reverse if it doesn't work.

To find the start_time limits I simply add a new reservation to the first day where the problem occured with an easily found description and then look for this in the database.

In reply to David Fountain

Re: MRBS lost all bookings after BST time change -HELP!!

by Jean-Pierre Pawlak -
Hi David,

I don't think this is a DST problem.
Server is set to 'timezone America/New_York'.
Clock changes in march in New York.

There must be something wrong with timestamps in the database.
My provider (Surpass) tells me they didn't change anything on the server.
But the MySql server was restarted last friday.
That's when the issue started.

Regards

JP





In reply to Jean-Pierre Pawlak

Re: MRBS lost all bookings after BST time change -HELP!!

by David Fountain -
The timestamps is where I found problems with BST changes which is why I look at the start_time and end_time fields. To confirm this I add a new booking for a time where I know one already exists and compare. This I then used to adjust the timestamps using SQL update. The problem is finding a booking that already exists and is unique enough to use for comparison - but you have access to these through the reports...

but you say that the problem is with BST changes...but only bookings from last Friday have been affected?
In reply to David Fountain

Re: MRBS lost all bookings

by David Fountain -
Sorry I'll read the post and not the 'Subject' more thoroughly next time...not a BST issue
In reply to Jean-Pierre Pawlak

Re: MRBS lost all bookings after BST time change -HELP!!

by Jean-Pierre Pawlak -
Issue solved.
Surpass changed the server time (back?) to GMT.
Strange, they first said they didn't change anything to servertime/settings...
In reply to Jean-Pierre Pawlak

Re: MRBS lost all bookings after BST time change -HELP!!

by Allan Morris -
Recently had a staff member report all bookings after the end of March 2010 had disappeared. Just applied DavidD's php fix above and it worked first time. Thanks. smile
In reply to Allan Morris

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Whew! I'm glad the fix worked for you and regret I have not had a chance to go in and get to the root of the issue to prevent this. Peace - Anthony
In reply to Anthony Borrow

Re: MRBS lost all bookings after BST time change -HELP!!

by Allan Morris -
Anthony, if David Davies is correct in taking that PHP above from the latest version of MRBS could this not be applied to the latest source for the Moodle version? As DavidD says two small changes. Has anyone else applied the patch manually and had it work correctly?
In reply to Allan Morris

Re: MRBS lost all bookings after BST time change -HELP!!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
My apologies for the delay, I have created CONTRIB-2144 for this issue. Please feel free to vote, suggest patches, etc. It will be a while before I have a chance to get back and give the MRBS block the TLC it desperately needs. Unfortunately I am personally not using it in a production environment so the time I have to give to it is minimal. I would welcome any help from those using it who would like to become more involved in helping to co-maintain it. Peace - Anthony