Booking Helper Functions

The helper you can use to create, delete, get and update booking.

function get_booking($booking_id) {...}

Supported hooks

Filter name: before_get_booking Description: This filter would be executed before retrieving booking from database in get_booking helper. Usage:

 add_filter('before_get_booking', 'before_get_booking_callback_fn', 10, 1);
 
 function before_get_booking_callback_fn ($booking_id) {
   // This filter would be executed before retrieving booking from database in get_booking helper.
 }

Filter name: should_get_booking Description: This filter would be executed before retrieving booking from database in get_booking helper. Usage:

add_filter('should_get_booking', 'should_get_booking_callback_fn', 10, 1);

 function should_get_booking_callback_fn ($booking_id) {
   // This filter would be executed before retrieving booking from database in get_booking helper.
 }

Hook name : pre.get.booking Description: This hook would be executed before retrieving booking from database in get_booking helper. Usage:

add_filter('pre.get.booking', 'pre_get_booking_callback_fn', 10, 1);

 function pre_get_booking_callback_fn ($booking_id) {
   // This filter would be executed before retrieving booking from database in get_booking helper.
 }

Hook name : post.get.booking Description: This hook would be executed after retrieving booking from database in get_booking helper. Usage:

Usage

Request Parameters

Param
Type
Required
Default
Description

$booking_id

Integer

Yes

Null

Booking ID is the primary key for the booking table.

Response

function add_booking($booking) {...}

Supported hooks

Filter name: before_add_booking Description: This filter would be executed before add booking into database in get_booking helper. Usage:

Filter name: should_add_booking Description: This filter would be executed before add booking into database in get_booking helper. Usage:

hook name: pre.add.booking Description: This hook would be executed before add booking into the database in get_booking helper. Usage:

hook name: post.add.booking Description: This hook would be executed after add booking into the database in get_booking helper. Usage:

Usage

Request Parameters

Parameters in array format includes following attributes:

Param
Type
Required
Default
Description

room_id

Integer

Yes

Null

The room_id for specific booking block.

check_in_date

Date_time

Yes

date

The check_in_date for specific booking block.(must required date in gmdate() format)

check_out_date

Date_time

Yes

date

the check_out_date for specific booking block(must required date in gmdate() format)

room_type_id

Integer

Yes

Null

The room_type_id for specific booking block.

rate

Integer

The rate of specific booking.

adult_count

Integer

Yes

Null

The adult_count for specific booking (must require).

children_count

Integer

Null

The children_count for specific booking.

company_id

Integer

Yes

Null

The company for specific booking(must require).

state

Integer

Yes

0

The state for specific booking.

booking_notes

Text

Null

The booking_notes for specific booking.

booking_customer_id

Integer

Yes

Null

The booking_customer_id it's the customer id from the customer table for a specific booking.

balance

Integer

0.00

The balance for the specific booking.

use_rate_plan

Integer

Yes

0

The use_rate_plan for specific booking (must require).

rate_plan_id

Integer

Yes

0

The rate_plan_id it's id from the rate plan table for specific booking.

charge_type_id

Integer

0

The charge_type_id for specific booking.

source

Integer

0

The source of booking for specific booking.

is_ota_booking

Integer

0

The is_ota_booking conforms for specific booking.

pay_period

Integer

0

The pay_period for specific booking.

room_type_id

Integer

Yes

0

The room_type_id for specific booking block.

booking_type

Integer

0

The booking_type for hook function.

booking_from

Integer

0

The booking_from for hook function.

housekeeping_notes

Text

Null

The housekeeping_notes for specific booking.

revenue

Integer

0

The revenue for specific booking.

add_daily_charge

Integer

0

The add_daily_charge for specific booking.

residual_rate

Integer

0

The residual_rate for specific booking.

is_invoice_auto_sent

Integer

0

The is_invoice_auto_sent for specific booking.

Response

function get_bookings($filter) {.....}

Supported hooks

Filter name: before_get_bookings Description: This filter would be executed before retrieving booking details from database in get_bookings helper. Usage:

Filter name: should_get_bookings Description: This filter would be executed before retrieving booking details from database in get_bookings helper. Usage:

hook name: pre.get.bookings Description: This hook would be executed before retrieving booking details from database in get_bookings helper. Usage:

hook name: post.get.bookings Description: This hook would be executed after retrieving payment details from database in get_payments helper. Usage:

Usage

Request Parameters

parameter array filter required for booking details.

Param
Type
Required
Default
Description

company_id

Integer

Yes

Null

The company id for a specific booking.

booking_id

Integer

Yes

Null

The primary key id of the booking table for a specific booking.

customer_id

Integer

Yes

Null

The customer_id for a specific booking.

room_id

Integer

Yes

Null

The room_id for a specific booking.

Response

function delete_booking($booking_id) {.....}

Usage

Request Parameters

Param
Type
Required
Description

$booking_id

integer

yes

The id of the booking corresponds to the booking table.

Response

Last updated