Booking_ID's and Booking state's

Help with installation and general calendar setttings

Booking_ID's and Booking state's

Postby Garfield » Thu Jan 27, 2011 1:40 am

Hi Chris,

I implemented your calendar and added my own reservation form.
When person A makes a reservation the bookings table is filled with the dates, the booking states and a unique booking_id to that transaction.

Now person B makes a reservation starting from the date person A leaves. This will create a changeover date. I add this date to the bookings table with the state for changeover date and a booking_id for this new transaction.

This results in two dates in the booking table with a different bookingstate and different booking_id. The calendar displays as expected because the latest booking_id has the booking_state for the changeover day.

Now this effectivly adds two records for the same date in the bookings table.
Your admin panel has "difficulties" coping with that, but I know this is mainly because I am filling the bookings table with records that the admin panel can normally not do (two records for the same date).

I think I already asked it in the past but I am going to ask it again just to be sure:
You are not using the field booking_id in the bookings table in your current release ? (I could not find any use for it at least in your code).
So I can use this field for my own booking admin panel without a problem (currently) ?
Garfield
 
Posts: 4
Joined: Fri Apr 30, 2010 2:44 pm

Re: Booking_ID's and Booking state's

Postby chris » Thu Jan 27, 2011 11:29 am

Hello,

Ideally I would suggest that you have a separate database table for the bookings and keep the availability table (which makes me think that the table is poorly named) just for showing availability.
So, when a new booking is made it updates the availability table accordingly and, on start and end dates it checks to see if the calendar already has a "half" state (am and pm respectively) and updates that date accordingly. For example, if it finds that the start date (which would be a "pm" state) already has an "am" booking (ie the last date of the previous booking), it would update this state to be a complete days booking.
I have done more or less this on several client sites.

All that said, if what you have is working correctly in that the calendar is displaying correctly, then maybe it is best left alone ;)
I think I already asked it in the past but I am going to ask it again just to be sure:
You are not using the field booking_id in the bookings table in your current release ? (I could not find any use for it at least in your code).
So I can use this field for my own booking admin panel without a problem (currently) ?

There is no booking_id field in the original script but there is an id_booking field (I presume that that was a simple slip) however you are correct in assuming that this field is not actually used in this version of the calendar.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Booking_ID's and Booking state's

Postby Garfield » Thu Jan 27, 2011 10:50 pm

Hi Chris,

Thank you for the great tip. I already have a seperate table for the bookings, but did not store the dates in it. I thought .. I already have a table with dates in it .. and I can link it over the field booking_id to the actual booking, but then I ran into the problems of twoo bookings on the same date. So I thought asbout changing the booking_id field to a text field, so it can accomdate more then one booking_id for a specific date.
And although this is doable, your suggested approach makes more sense.
Garfield
 
Posts: 4
Joined: Fri Apr 30, 2010 2:44 pm

Re: Booking_ID's and Booking state's

Postby lanny » Tue Feb 01, 2011 7:16 pm

Let me get this straight, Chris:

Are you suggesting that I make a table (and sub application) for actual bookings? What then is the id_booking field meant for? Who is supposed to do the booking, the admin?

Is there an API approach I could use - instead of clicking the dates on the calendar, passing the date (or date range) in a $_REQUEST array?

Actually, I should study the code more, before I ask the questions but since I typed them already, I'll let it hang here :)

Lanny
lanny
 
Posts: 4
Joined: Tue Feb 01, 2011 5:25 pm

Re: Booking_ID's and Booking state's

Postby chris » Tue Feb 01, 2011 10:13 pm

Hi,
As is, the calendar script has no actual booking capabilities.
Are you suggesting that I make a table (and sub application) for actual bookings? What then is the id_booking field meant for? Who is supposed to do the booking, the admin?

Yes, that's what I would suggest that you do. You make a table to hold all your booking data.
The "id_booking" field serves no purpose in the basic script that you downloaded. It is only there in case somebody wants to extend the calendar to add a bookings form.
As I mentioned in my previous post, if I where to add a booking function to the script, I would actually hold the booking data in a separate table (in deed this is the way I have done it on several client sites) and simply use the availability calendar to show the availability. In reality this table would then not be needed as the availability could be retrieved from this new table but that is a different issue.
Is there an API approach I could use - instead of clicking the dates on the calendar, passing the date (or date range) in a $_REQUEST array?

I'm afraid that there is no api. What you want to do goes far beyond the scope of this script which is purely for showing availability. It was never intended as a bookings script.
Of course there is no reason why you can't passed the dates as an array and update the db table that way. However, as you say, you would need to study the code a bit more to see exactly how the dates are stored in the database.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron