Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#418 How to make a booking in my own script?

open
nobody
None
1
2013-11-19
2013-11-19
Anonymous
No

I want to write a script that make bookings for times they should not be booked. these are daily repeatet bookings but for each week other times.

Can you explain me how do i make a booking in my script?
I have tried this, but it dont works:
$skip = 0;
$booking = array();
$booking['create_by'] = "Server";
$booking['name'] = "-";
$booking['type'] = "E";
$booking['description'] = "";
$booking['room_id'] = 1;
$booking['start_time'] = 1384851600;
$booking['end_time'] = 1384855200;
$booking['rep_type'] = REP_DAILY;
$booking['rep_opt'] = "0";
$booking['rep_num_weeks'] = 1;
$booking['end_date'] = 1385028000;
$booking['ical_uid'] = 0;
$booking['ical_sequence'] = 1;
$booking['ical_recur_id'] = "1111";

$bookings = array($booking);
$result = mrbsMakeBookings($bookings, NULL, FALSE, $skip, 45320, FALSE, "series");

if ($result['valid_booking'])
{
  echo "Booked"; // only for test
}

it would be very nice if someone could explain me how to make a booking. many thanks!

Discussion

  • From what you say I understand that what you want to do is make a booking for every day of this week, then not next week, but then every day of the week after, etc.

    If that's the case then mrbsMakeBookings isn't capable of making a daily booking for every day of this week every other week. But what you can do is

    (a) make a weekly booking for every other week where each booking lasts a week, eg starting on Monday morning and ending on Sunday evening. For that kind of booking you'd need to set rep_num_weeks to 2 (ie every second week). You'd also need to set rep_opt to the booking day. rep_opt is a seven character string that gives the days that the booking is for, represented by 1 or 0, with the first character being Sunday, eg '0100000' for every Monday. (I think that in this case you just specify the day the booking starts)

    (b) or else you can make a booking that starts on Monday morning and just lasts one day, but then set rep_opt to '1111111' to replicate the booking on every day of the week. (I haven't checked all of this so I may be wrong)

    If you want the booking to work with iCalendars then you'll also need to make sure that the ical_uid is a globally unique id.

    Another, possibly easier, way of doing all this is to run a script from the command line calling edit_entry_handler.php and passing the form parameters through to edit_entry_handler.

    Of course, I'm assuming that you have a good reason for wanting to run a script and just using MRBS to block book times that cannot be booked isn't a solution?

    Campbell

     

  • Anonymous
    2013-11-19

    thanks for help! Yor answer (b) is that what we need. but i will try the command line method in the next days.
    the reason is, we have set the booking times from 06:00 to 20:00. But in some month we dont want to allow booking at 06 or 07 'clock. So we make bookings on this time, that no one else can book at this time. we do it for a year in advance.

     
  • OK. I still think it will probably be quicker and easier just to book out the rooms from MRBS through the browser. You can select multiple rooms by using Ctrl-click or Shift-click.

    Campbell

     


Anonymous


Cancel   Add attachments