Skip to the content.

Cancelling a booking

Should you wish to cancel a booking, you can with the code below.


try {
    if ($id = filter_input(INPUT_GET, 'id')) {
        $b = new tabs\apiclient\Booking($id);
        $b->get();
        
        // Create a new cancelled booking object and set the
        // tabs user
        $canc = new \tabs\apiclient\CancelledBooking();
        $canc->setReason('test booking');
        
        // Add provisional to booking and update
        $b->setCancelledbooking($canc);
        $b->update();
        
        header('Location: index.php?id=' . $b->getId());
        exit();
    }

} catch(Exception $e) {
    echo $e->getMessage();
}