public function onValidateZipCode(string $zip, array $accepted, int $id_employee, array $services) : bool

Fires while validating a ZIP code.


Description

It is possible to use this hook to enhance or change the default algorithm while checking whether a specific ZIP code is allowed or not.


Parameters

$zip

(string)  The ZIP code to validate.

$accepted

(array)  An array of accepted ZIP codes, built as:

[
    {
        "from": "65000",
        "to": "65010"
    },
    {
        "from": "62156",
        "to": "62156"
    }
]
$id_employee

(int)  The ID of the booked employee. In case the employee was not selectable this value will be lower than 0.

$services

(array)  An array of booked services.

Return Value

Boolean. True to accept the ZIP code anyway, false to deny the ZIP code, null to rely on the default algorithm.


Example

/** 
 * It is possible to use this hook to enhance or change the default algorithm
 * while checking whether a specific ZIP code is allowed or not.
 *
 * @param   string   $zip       The ZIP code to validate.
 * @param   array    $accepted  An array of accepted ZIP codes.
 * @param   integer  $id_emp    The employee ID (0 or -1 mean global).
 * @param   array    $services  An array of booked services.
 *
 * @return  mixed    $status    True to accept the ZIP code, false to deny the
 *                              ZIP Code, null to rely on the default algorithm.
 */
public function onValidateZipCode($zip, $accepted, $id_emp, $services)
{
    /**
     * @todo implement here your own algorithm for the ZIP codes validation
     */
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 15:46
Helpful?