How-To

Add Service column to Customer History

You will need to modify the query that fetches customer data to JOIN to the services table, then add the appropriate column to the display.

 

Edit file:
\components\com_rsappt_pro3\views\customer_history\tmpl\default.php

 


First change the query. 

Around line 139 look for:

// find requests
$sql = "SELECT #__sv_apptpro3_requests.*, #__sv_apptpro3_resources.resource_admins, ".
"#__sv_apptpro3_resources.name as resname, ".
"CONCAT(#__sv_apptpro3_requests.startdate,#__sv_apptpro3_requests.starttime) as startdatetime, ".

 

Add the red code:

// find requests
$sql = "SELECT #__sv_apptpro3_requests.*, #__sv_apptpro3_resources.resource_admins, ".
"#__sv_apptpro3_resources.name as resname, ".
"#__sv_apptpro3_services.name as srvname, ".
"CONCAT(#__sv_apptpro3_requests.startdate,#__sv_apptpro3_requests.starttime) as startdatetime, ".

 

 

Around line 155 look for:

$sql = $sql." FROM #__sv_apptpro3_requests INNER JOIN #__sv_apptpro3_resources ".
"ON #__sv_apptpro3_requests.resource = #__sv_apptpro3_resources.id_resources ".
"WHERE request_status!='deleted' AND ";

 

Add the red code:

$sql = $sql." FROM #__sv_apptpro3_requests INNER JOIN #__sv_apptpro3_resources ".
"ON #__sv_apptpro3_requests.resource = #__sv_apptpro3_resources.id_resources ".
" INNER JOIN #__sv_apptpro3_services ".
" ON #__sv_apptpro3_requests.service = #__sv_apptpro3_services.id_services ".
"WHERE request_status!='deleted' AND ";

 

 

 


Now we need to change the display. We will add the service after the resource for this example.

 

The table headers start around line 373.

<th class="title" align="left"><?php echo JHTML::_( 'grid.sort', JText::_('RS1_HISTORY_SCRN_RESID_COL_HEAD'), 'resname', $direction, $ordering); ?></th>
<th class="title" align="left"><?php echo JHTML::_( 'grid.sort', JText::_('RS1_HISTORY_SCRN_DATE_COL_HEAD'), 'startdatetime', $direction, $ordering); ?></th>

 

Add column header:

<th class="title" align="left"><?php echo JHTML::_( 'grid.sort', JText::_('RS1_HISTORY_SCRN_RESID_COL_HEAD'), 'resname', $direction, $ordering); ?></th>
<th class="title" align="left"><?php echo JHTML::_( 'grid.sort', "Service", 'srvname', $direction, $ordering); ?></th>
<th class="title" align="left"><?php echo JHTML::_( 'grid.sort', JText::_('RS1_HISTORY_SCRN_DATE_COL_HEAD'), 'startdatetime', $direction, $ordering); ?></th>

 

And the data area a few lines below..

<td align="left"><?php echo JText::_(stripslashes($row->resname)); ?>&nbsp;</td>
<td align="left"><?php echo $row->display_startdate; ?></td>

 

<td align="left"><?php echo JText::_(stripslashes($row->resname)); ?>&nbsp;</td>
<td align="left"><?php echo JText::_(stripslashes($row->srvname)); ?>&nbsp;</td>
<td align="left"><?php echo $row->display_startdate; ?></td>