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
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:
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.
// 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
Response
Response return mixed Either true or null if booking data is deleted then true
else null.