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);functionbefore_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);functionshould_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);functionpre_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:
add_filter('post.get.booking',' post_get_booking_callback_fn',10,1);functionpost_get_booking_callback_fn ($booking_id) {// This filter would be executed before retrieving booking from database in get_booking helper. }
Usage
// for use booking helper you need to add this helper on controller or// you can autoload this helper.$this->load->helper('includes/booking');// Retrieves booking data based on a booking_id.$booking_data =get_booking($booking_id);
Request Parameters
Param
Type
Required
Default
Description
$booking_id
Integer
Yes
Null
Booking ID is the primary key for the booking table.
Response
// $response array includes following attributes:// $response['rate'] : the rate (integer) of specific booking.// $response['adult_count'] : the adult_count (integer) for specific booking (must required).// $response['children_count'] : the children_count (integer) for specific booking.// $response['company_id'] : the company_id (integer) for specific booking.// $response['state'] : the state (integer) for specific booking (must required).// $response['booking_notes'] : the booking_notes for specific booking.// $response['booking_customer_id'] : the booking_customer_id (integer) for specific booking.// $response['booked_by'] : the booked_by for specific booking.// $response['balance'] : the balance (integer) for specific booking.// $response['use_rate_plan'] : the use_rate_plan (integer) for specific booking (must required).// $response['rate_plan_id'] : the rate_plan_id (integer) for specific booking.// $response['charge_type_id'] : the charge_type_id (integer) for specific booking.// $response['source'] : the source for specific booking.// $response['is_ota_booking'] : the is_ota_booking (integer) for specific booking.// $response['pay_period'] : the pay_period (integer) for specific booking.// $response['room_type_id'] : the room_type_id (integer) for specific booking block.// and many more attributes from table booking and join with booking block and customer table.// Successfully response giving you array of booking data.Array( [booking_id] =>26 [rate] =>40 [adult_count] =>2 [children_count] =>1 [state] =>0 [booking_notes] =>0 [company_id] =>1 [booking_customer_id] => [booked_by] =>0 [balance] =>10 [balance_without_forecast] =>0 [invoice_hash] => xxxxxxxxxxxxxxxxxxxxxx [use_rate_plan] =>1 [rate_plan_id] =>1 [color] => transparent [housekeeping_notes] => [charge_type_id] =>0 [guest_review] => [is_deleted] =>0 [source] =>0 [is_ota_booking] =>0 [pay_period] =>0 [revenue] =>0 [add_daily_charge] =>0 [residual_rate] => [is_invoice_auto_sent] =>0 [name] => comapny 1 [address] => [phone] => [city] => [region] => [country] => India [website] => [email] => test@minical.io [fax] => [selling_date] =>2022-01-27 [nightly_audit_charge_id] => [time_zone] => Pacific/Midway)// If there is no booking data for any booking id provided in input or any error will return null.
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:
// The filter callback function is based on the filter.add_filter( ‘before_add_booking’, ‘before_add_booking_callback_fun’,10,1);functionbefore_add_booking_callback_fun($booking) {// code}
Filter name: should_add_booking
Description: This filter would be executed before add booking into database in get_booking helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_add_booking’, ‘example_callback_fun’,10,1);functionexample_callback_fun($booking) {// code}
hook name: pre.add.booking
Description: This hook would be executed before add booking into the database in get_booking helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.add.booking','pre_add_booking_callback_fun',10,1);functionpre_add_booking_callback_fun($booking) {// code}
hook name: post.add.booking
Description: This hook would be executed after add booking into the database in get_booking helper.
Usage:
// The filter callback function is based on the filter.add_action('post.add.booking','post_add_boking_callback_fun',10,1);functionpost_add_boking_callback_fun($booking) {// code}
Usage
// Create a new booking that will also add booking details in booking, booking block and create a new invoice for booking. $booking_id =add_booking($booking);
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
Response includes the following attributes:
if data have been added successfully it would return the key of specific booking id.
return $booking_id;
if data does not add it will return null.
function get_bookings($filter) {.....}
Supported hooks
Filter name: before_get_bookingsDescription: This filter would be executed before retrieving booking details from database in get_bookings helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘before_get_bookings’, ‘before_get_bookings_callback_fun’,10,1);functionbefore_get_bookings_callback_fun($filter) {// code}
Filter name: should_get_bookingsDescription: This filter would be executed before retrieving booking details from database in get_bookings helper.
Usage:
// The filter callback function is based on the filter.add_filter( ‘should_get_bookings’, ‘should_get_bookings_callback_fun’,10,1);functionshould_get_bookings_callback_fun($filter) {// code}
hook name: pre.get.bookings
Description: This hook would be executed before retrieving booking details from database in get_bookings helper.
Usage:
// The filter callback function is based on the filter.add_action('pre.get.bookings','pre_get_bookings_callback_fun',10,1);functionpre_get_bookings_callback_fun($filter) {// code}
hook name: post.get.bookings
Description: This hook would be executed after retrieving payment details from database in get_payments helper.
Usage:
// The filter callback function is based on the filter.add_action('post.get.bookings','post_get_bookings_callback_fun',10,1);functionpost_get_bookings_callback_fun($filter) {// code}
Usage
// Retrieves booking data based on a filter array.$booking_data =get_bookings($filter);
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.
// delete a booking data from booking table. it's a soft delete process only status will change data still existing in back end database.delete_booking($booking_id);
Request Parameters
Param
Type
Required
Description
$booking_id
integer
yes
The id of the booking corresponds to the booking table.
Response
Response return mixed Either true or null if booking data is deleted then true
else null.