It is now possible to display questions or notifications when saving a reservation. Similar to a field validation, these can be configured flexibly. They can either be displayed only as a notification, change reservation data or saving can be cancelled. A total of eight question/answer pairs can be defined.
The function is enabled by setting the default value for 's_reser' / 'questbsave' to 'Y'. The questions are defined via 'Field Validation' for 's_reser' / 'questionX' (where 'X' = number 1-8). The condition and the question/notification are specified here; format as in the following example ($data contains the reservation data, e.g. data['s_reser']['RUSER01']):
if (CONDITON...){
$errors['QUESTIONX'] = array(
"key" => "X",
"question" => "Question shown to the user",
"caption" => "Header of the question",
"option1" => ["value" => "Y", "label" => "Yes Button"],
"option2" => ["value" => "N", "label" => "No Button"]
);
}
return true;
The behaviour of the responses is defined via 's_reser' / 'responseX' ('X' = number 1-8). Attention, in this case $data is the reservation object! To read the data from the reservation, e.g. $reserData = $data->getData() is required: If 'true' is returned, the reservation is saved. If 'false' is returned, saving is cancelled. The reservation data can be changed with 'setData'.
if ($value == 'N') {
$reserData.... = ...;
$data->setData($reserData);
//return false;
}
return true;