• Home
  • How-To
  • Show Category in Front Desk Month & Day views

How-To

Show Category in Front Desk Month & Day views

This How-to shows how to display a booking's category in the Front Desk Week and Day views.

Note: This only works with ABPRo 2.0.3 beta 6 and above as the resource/category relationship was modified so the category started being stored in a booking detail. Prior to 2.0.3, beta 6, it was not.

 

There are two steps involved:

  1. Modify the query that gets booking data to include a JOIN on the category table to get the category name.
  2. Modify the display to show category name.

 

Step 1

Edit file: \components\com_rsappt_pro2\svcalendar.php

 

Around line 604 look for:

$sql = "SELECT #__sv_apptpro2_requests.*, #__sv_apptpro2_resources.resource_admins, #__sv_apptpro2_resources.id_resources as res_id, ".
"#__sv_apptpro2_resources.max_seats, #__sv_apptpro2_resources.name as resname, #__sv_apptpro2_services.name AS ServiceName, ".
"#__sv_apptpro2_resources.id_resources as resid, DATE_FORMAT(#__sv_apptpro2_requests.startdate, '%a %b %e ') as display_startdate, ";

 

Insert the red code:

$sql = "SELECT #__sv_apptpro2_requests.*, #__sv_apptpro2_resources.resource_admins, #__sv_apptpro2_resources.id_resources as res_id, ".
"#__sv_apptpro2_resources.max_seats, #__sv_apptpro2_resources.name as resname, #__sv_apptpro2_services.name AS ServiceName, ".
"#__sv_apptpro2_categories.name AS CategoryName, ".
"#__sv_apptpro2_resources.id_resources as resid, DATE_FORMAT(#__sv_apptpro2_requests.startdate, '%a %b %e ') as display_startdate, ";

 

 

Around line 620 look for:

'#__sv_apptpro2_requests LEFT JOIN '.
'#__sv_apptpro2_resources ON #__sv_apptpro2_requests.resource = '.
'#__sv_apptpro2_resources.id_resources LEFT JOIN '.
'#__sv_apptpro2_services ON #__sv_apptpro2_requests.service = '.
'#__sv_apptpro2_services.id_services ) '.

 

Insert the red code:

'#__sv_apptpro2_requests LEFT JOIN '.
'#__sv_apptpro2_resources ON #__sv_apptpro2_requests.resource = '.
'#__sv_apptpro2_resources.id_resources LEFT JOIN '.
'#__sv_apptpro2_categories ON #__sv_apptpro2_requests.category = '.
'#__sv_apptpro2_categories.id_categories LEFT JOIN '.
'#__sv_apptpro2_services ON #__sv_apptpro2_requests.service = '.
'#__sv_apptpro2_services.id_services ) '.

 

Step 2

In the same file, around line 443 look for:

$s .= " <td width=\"10%\" align=\"center\" width=\"10%\"><span class='color_".$booking->request_status."'>".translated_status($booking->request_status)."</span></td>\n";
$s .= "</tr>\n";

This is the Week view. Insert the red code to a category name to the view.

$s .= " <td width=\"15%\" align=\"left\"> ".$booking->CategoryName."</td>";
$s .= " <td width=\"10%\" align=\"center\" width=\"10%\"><span class='color_".$booking->request_status."'>".translated_status($booking->request_status)."</span></td>\n";
$s .= "</tr>\n";

 

For the Day view, around line 562 look for:

$s .= " <td align=\"center\" width=\"10%\"><span class='color_".$booking->request_status."'>".translated_status($booking->request_status)."</span></td>\n";
$s .= "</tr>\n";

Insert the red code:

$s .= " <td width=\"15%\" align=\"left\"> ".$booking->CategoryName."</td>";
$s .= " <td align=\"center\" width=\"10%\"><span class='color_".$booking->request_status."'>".translated_status($booking->request_status)."</span></td>\n";
$s .= "</tr>\n";

 

The above code inserts the category just before the booking status. You can place the new column differently if desired.