How-To

Staff not limited by date restrictions

The staff and public booking screens use the same code for processing the 'Disable Dates Before' and 'Disable Dates After' settings. This How-to shows how to have the staff booking screen either not restricted at all, or restricted by different limits than the public screen.

The grid is built in file \components\com_rsappt_pro2\gad_ajax.php*
The function that processes the settings, to determine if a row should be displayed, is showrow() in file 
\components\com_rsappt_pro2\functions2.php

There are 2 steps invoved in the How-to

  1. Modify to call to showrow() to tell it the call is from the front desk screen
  2. Modify the function showrow() to behave differently for staff vs public.

 

Step 1

Edit file: 
\components\com_rsappt_pro2\gad_ajax.php*

 

Around line 339 look for:

    $sr = showrow($res_row, $grid_date, $weekday["wday"]);

Change to:

    $sr = showrow($res_row, $grid_date, $weekday["wday"], $front_desk);

 

Around line 591 look for:

    $sr = showrow($res_detail, $strDate, $weekday);

Change to:

    $sr = showrow($res_detail, $strDate, $weekday, $front_desk);

 

Step 2

Edit file:

\components\com_rsappt_pro2\functions2.php

 

Around line 509 look for:

    function showrow($res_detail, $grid_date, $weekday){

Change to:

    function showrow($res_detail, $grid_date, $weekday, $front_desk){

 

In this example I will modify the Disable Dates After to be hard coded to 14 for staff.

Around line 588 look for:

    if($res_detail->disable_dates_after == "XDays"){
        if(strtotime($grid_date) >= strtotime("+ ".strval($res_detail->disable_dates_after_days)." day")){
            return "disabled";
        }
    }

Change to:

    if($res_detail->disable_dates_after == "XDays"){
        if($front_desk == "Yes"){
            if(strtotime($grid_date) >= strtotime("+14 day")){
            return "disabled";
            }
        } else {
            if(strtotime($grid_date) >= strtotime("+ ".strval($res_detail->disable_dates_after_days)." day")){
            return "disabled";
            }
        }
    }

 

Another example here is if you want to have the staff not restricted at all by Disable Dates After.

Change to:

    if($res_detail->disable_dates_after == "XDays"){
        if($front_desk != "Yes"){
            if(strtotime($grid_date) >= strtotime("+ ".strval($res_detail->disable_dates_after_days)." day")){
            return "disabled";
            }
        }
    }

 

That's all.

 

 

 

*For Time on Y-Axis, the file is gad_ajax2.php.