Class BookingEntry

Description

Booking entry object for creating/editing booking

Located in /inc/bb/bookingentry.php (line 42)

DBO
   |
   --DBRow
      |
      --BookingEntry
Variable Summary
Method Summary
BookingEntry BookingEntry (integer $id, BumblebeeAuth $auth, array $instrumentid, [integer $minunbook = ''], [string $ip = ''], [SimpleDate $start = ''], [SimpleTime $duration = ''], [string $granlist = ''])
void checkValid ()
integer delete ([ $unused = null])
void display ()
void fill ()
void sync ()
void update ( $data)
void _bookingEntryShort (integer $id, integer $instrumentid)
void _checkAuth (BumblebeeAuth $auth, integer $instrumentid)
void _checkIsFree ()
void _checkMinNotice ()
boolean _checkTimesAdjoining (string $field, SimpleDate $checktime)
void _getEmailText (array $instrument, array $user)
void _legalSlot ()
integer _makeTempBooking (integer $instrument, string $start, string $duration)
boolean _permittedFuture ()
void _removeTempBooking (integer $tmpid)
Variables
integer $euid (line 46)
  • var: EUID of booking user @see BumblebeeAuth
array $instrumentid (line 56)
  • var: list of instrument id numbers
boolean $isShort = false (line 54)
  • var: object not fully constructed (using short constructor for deleting booking only
integer $minunbook (line 52)
  • var: minimum notice in hours to be given for unbooking an instrument
TimeSlotRule $slotrules (line 44)
  • var: rules for when the instrument can be booked
integer $uid (line 48)
  • var: UID of booking user @see BumblebeeAuth
BumblebeeAuth $_auth (line 50)
  • var: auth object for checking user permissions

Inherited Variables

Inherited from DBRow

DBRow::$autonumbering
DBRow::$deleteFromTable
DBRow::$extrarows
DBRow::$includeAllFields
DBRow::$insertRow
DBRow::$isDeleted
DBRow::$newObject
DBRow::$recNum
DBRow::$recStart
DBRow::$restriction
DBRow::$use2StepSync

Inherited from DBO

DBO::$changed
DBO::$DEBUG
DBO::$deletable
DBO::$dumpheader
DBO::$editable
DBO::$errorMessage
DBO::$fatal_sql
DBO::$fields
DBO::$id
DBO::$idfield
DBO::$idfieldreal
DBO::$ignoreId
DBO::$isValid
DBO::$namebase
DBO::$oob_errorMessage
DBO::$oob_status
DBO::$suppressValidation
DBO::$table
Methods
Constructor BookingEntry (line 70)

Create a new BookingEntry object

BookingEntry BookingEntry (integer $id, BumblebeeAuth $auth, array $instrumentid, [integer $minunbook = ''], [string $ip = ''], [SimpleDate $start = ''], [SimpleTime $duration = ''], [string $granlist = ''])
  • integer $id: booking id number (existing number or -1 for new)
  • BumblebeeAuth $auth: authorisation object
  • array $instrumentid: list of instrument id of instruments to be booked
  • integer $minunbook: minimum notice to be given for unbooking (optional)
  • string $ip: IP address of person making booking (for recording) (optional)
  • SimpleDate $start: when the booking should start (optional)
  • SimpleTime $duration: length of the booking (optional)
  • string $granlist: timeslotrule picture (optional)
checkValid (line 417)

override the default checkValid() method with a custom one that also checks that the booking is permissible (i.e. the instrument is indeed free)

A temp booking is made by _checkIsFree if all tests are OK. This temporary booking secures the slot (no race conditions) and is then updated by the sync() method.

void checkValid ()

Redefinition of:
DBRow::checkValid()
check the validity of the data
delete (line 676)

delete the entry by marking it as deleted, don't actually delete the

  • return: from statuscodes
integer delete ([ $unused = null])
  • $unused

Redefinition of:
DBRow::delete()
Delete this object's row from the database.
display (line 433)
void display ()

Redefinition of:
DBRow::display()
fill (line 248)

override the default fill() method with a custom one that allows us to...

  • work out what the startticks parameter is for generating links to the current calendar
  • check permissions on whether we should be allowed to change the dates

void fill ()

Redefinition of:
DBRow::fill()
Perform the SQL lookup to fill the object with the current data
sync (line 262)

override the default sync() method with a custom one that allows us to...

  • send a booking confirmation email to the instrument supervisors
  • update the representation of times

void sync ()

Redefinition of:
DBRow::sync()
Synchronise this object's fields with the database
update (line 235)

override the default update() method with a custom one that allows us to:

  • munge the start and finish times to fit in with the permitted granularity

void update ( $data)
  • $data

Redefinition of:
DBRow::update()
Update the object with the user-submitted data
_bookingEntryShort (line 196)

secondary constructor that we can use just for deleting

void _bookingEntryShort (integer $id, integer $instrumentid)
  • integer $id: booking id number (existing number or -1 for new)
  • integer $instrumentid: instrument id of instrument to be booked
_checkAuth (line 220)

check our admin status

void _checkAuth (BumblebeeAuth $auth, integer $instrumentid)
  • BumblebeeAuth $auth: authorisation object
  • integer $instrumentid: instrument id of instrument to be booked
_checkIsFree (line 448)

check that the booking slot is indeed free before booking it

Here, we make a temporary booking and make sure that it is unique for that timeslot This is to prevent a race condition for checking and then making the new booking.

void _checkIsFree ()
_checkMinNotice (line 310)

make sure that a non-admin user is not trying to unbook the instrument with less than the minimum notice

void _checkMinNotice ()
_checkTimesAdjoining (line 615)

check if this booking is adjoining existing bookings -- it can explain why the booking is at funny times.

  • return: there is a booking adjoining this time
  • global: string $TABLEPREFIX: prefix prepended to all table names in the db
boolean _checkTimesAdjoining (string $field, SimpleDate $checktime)
  • string $field: SQL name of the field to be checked (stoptime, bookwhen)
  • SimpleDate $checktime: time to check to see if it is adjoining the new booking
_getEmailText (line 387)

get the email text from the configured template with standard substitutions

  • todo: //TODO: graceful error handling for fopen, fread
void _getEmailText (array $instrument, array $user)
  • array $instrument: instrument data (name => , longname => )
  • array $user: user data (name => , username => )
_legalSlot (line 529)

Ensure that the entered data fits the granularity criteria specified for this instrument

void _legalSlot ()
_makeTempBooking (line 639)

make a temporary booking for this slot to eliminate race conditions for this booking

  • return: booking id number of the temporary booking
integer _makeTempBooking (integer $instrument, string $start, string $duration)
  • integer $instrument: instrument id
  • string $start: date time string for the start of the booking
  • string $duration: time string for the duration of the booking
_permittedFuture (line 581)

Check that the booking is not too far into the future

  • return: the booking is permitted
boolean _permittedFuture ()
_removeTempBooking (line 665)

remove the temporary booking for this slot

void _removeTempBooking (integer $tmpid)
  • integer $tmpid: booking id number of the temporary booking
_sendBookingEmail (line 339)

if appropriate, send an email to the instrument supervisors to let them know that the

booking has been made

void _sendBookingEmail ()
_setDefaultDiscount (line 289)

Work out what the default discount for this timeslot is from the timeslotrules

void _setDefaultDiscount ()

Inherited Methods

Inherited From DBRow

DBRow::DBRow()
DBRow::addElement()
DBRow::addElements()
DBRow::checkValid()
DBRow::delete()
DBRow::display()
DBRow::displayAsTable()
DBRow::displayInTable()
DBRow::fill()
DBRow::fillWithDefaults()
DBRow::setId()
DBRow::sync()
DBRow::text_dump()
DBRow::update()
DBRow::_sqlvals()
DBRow::_twoStageSync()
DBRow::__clone()

Inherited From DBO

DBO::DBO()
DBO::display()
DBO::log()
DBO::setEditable()
DBO::setNamebase()
DBO::text_dump()
DBO::__clone()

Documentation generated on Tue, 06 Mar 2007 10:00:53 +0000 by phpDocumentor 1.3.0