Reply To: Problem with availability of a ressource

Hi!

Thanks for your post.

I implement it after line 437, but it doesn´t work.

Hope it was the right place, please hab a look at it.

It´s inside the “send” mode.

It works, if another required field is missing and the error is set.

Than my error message appears in the right format.

If no other error is in the form (missing required filed) tehers no error and the booking is possible.

Maybe some flaf missing?

———————————————————–
if($mode == ‘send’){
$explode_customs = explode(‘,’, substr($_POST[‘customs’],0,-1));
foreach($explode_customs as $cstm){
if(!empty($cstm)){
$check = easyreservations_auto_approve($res, false);
if(!$check){
$error[] = ‘easy-form-from’;
$error[] = __(‘Bitte kontaktieren Sie fuer eine Buchung in diesem Zeitraum unsere Hotline’ , ‘easyReservations’ );
}
$error[] = $cstm;
$error[] = sprintf(__( ‘%1$s is required’ , ‘easyReservations’ ), ucfirst(str_replace(‘easy-custom-req-‘, ”, $cstm)));
}
}
if(!empty($_POST[‘new_custom’])){
$explode_customs = explode(‘,’, substr($_POST[‘new_custom’],0,-1));
$custom_fields = get_option(‘reservations_custom_fields’);

foreach($explode_customs as $c_id){
$c_id = str_replace(‘easy-new-custom-‘, ”, $c_id);
if(isset($custom_fields[‘fields’][$c_id]) && $custom_fields[‘fields’][$c_id][‘required’]){
$error[] = ‘easy-new-custom-‘.$c_id;
$error[] = sprintf(__( ‘%1$s is required’ , ‘easyReservations’ ), $custom_fields[‘fields’][$c_id][‘title’]);
}
}
}

————————————————-

…I now moved your code some lines up (outside the empty check loop) and now it works fine for me!

Thanks a lot.

Maybe in the future you find a solution to hide these occupied ressources from search form results too 🙂