Get 25% OFF any product. Use your coupon code today:

public function onStatusChangeReservation(object $data) : void

Fires every time the status of an appointment changes.

It is possible to use the following code to access the details of the changed appointment.

VAPLoader::import('libraries.order.factory');
$order = VAPOrderFactory::getAppointments($data->id_order);

Description

Trigger hook to let the plugins be notified every time the status of the reservations change.


Parameters

$data

(object)  The object holding the details of the new status.

Return Value

None.


Example

/**
 * Trigger event to let the plugins be notified every time the status of the orders change.
 *
 * @param   object  $data  The order status details.
 *
 * @return  void
 */
public function onStatusChangeReservation($data)
{
    // check whether the previous status code was not approved
    $was_not_approved = empty($data->prev) || !JHtml::_('vaphtml.status.isapproved', 'appointments', $data->prev);
    // check whether the new status is approved
    $is_approved = JHtml::_('vaphtml.status.isapproved', 'appointments', $data->status);

    if ($was_not_approved && $is_approved) {
        /**
         * @todo do stuff when the status actually becomes approved
         */
    }
}

Changelog

Version Description
1.7.11 Introduced a new property to access the previously set status code.
1.6.6 Introduced.
Last Update: 12 hours ago.
Helpful?