public function onCalculateAdvanceTime(int $advance, string $datetime, object $service) : int

Fires while checking whether the booking time is in the past or not.


Description

Trigger hook to let the plugins can calculate their own advance time, also known as Booking Minutes Restrictions.

In example, by returning 60, the check-in will be allowed only in case the current time plus 60 minutes is equals or lower than the selected check-in.


Parameters

$advance

(int)  The default "advance" amount configured from the settings page.

$datetime

(string)  The check-in date and time.

$service

(object)  The details of the booked service.

Return Value

Integer. The overwritten "advance" amount (in minutes).


Example

/**
 * Trigger event to let the plugins can calculate their own advance time,
 * also known as "Booking Minutes Restrictions".
 * Only the highest returned value will be used, also compared to the
 * default one.
 *
 * @param   integer  $advance   The default "advance" amount.
 * @param   string   $datetime  The check-in date and time.
 * @param   object   $service   The details of the booked service.
 *
 * @return  integer  The overwritten "advance" amount (in minutes).
 */
public function onCalculateAdvanceTime($advance, $datetime, $service)
{
    /**
     * @todo manipulate advance time here
     */

    return $advance;
}

Changelog

VersionDescription
1.7.0 The $datetime parameter is now a date string instead of a UNIX timestamp.
The $service parameter has been changed from array to object.
1.6.6 Introduced.
Last Update: 2021-10-05 17:17
Helpful?