Have Staff Booking screen position to future date
If your staff are booking several weeks in advance, this how-to shows modifications to get the 'Add Another Booking' link to position to the same date as the booking just made.
There are 3 steps involved:
- Edit the Front Desk booking screen to support setting date via a querystring parameter.
- Edit the front desk confirmation screen to fetch the start date of the current booking and put it in a hidden field.
- Edit the Front Desk controller to look for the date and append it to the 'Add Another Booking' call.
Step 1.
Edit file: \components\com_rsappt_pro3\views\booking_screen_fd\tmpl\default.php
Around lime 255 look for:
$gridwidth = $apptpro_config->gad_grid_width."px";
$namewidth = $apptpro_config->gad_name_width."px";
Add the red code in front..
// this overrides the disable-dates-before setting
if(JRequest::getVar('mystartdate','')!=""){
$grid_date = JRequest::getVar('mystartdate',''); // usage http://....&mystartdate=2009-09-14
}
$gridwidth = $apptpro_config->gad_grid_width."px";
$namewidth = $apptpro_config->gad_name_width."px";
Step 2.
Edit file: \components\com_rsappt_pro3\views\fd_confirmation\tmpl\default.php
Around line 80 look for:
<input type="hidden" name="frompage_item" value="<?php echo $itemid ?>" />
Add the red code:
<input type="hidden" name="frompage_item" value="<?php echo $itemid ?>" />
<input type="hidden" name="req_date" value="<?php echo $req_date ?>" />
Around line 48 insert:
// get booking date so book-another can position to same date
$sql = 'SELECT startdate FROM #__sv_apptpro3_requests WHERE id_requests ='.$req_id;
try{
$database->setQuery($sql);
$req_date = NULL;
$req_date = $database -> loadResult();
} catch (RuntimeException $e) {
logIt($e->getMessage(), "fd_conf_tmpl_default", "", "");
echo JText::_('RS1_SQL_ERROR');
return false;
}
Step 3.
Edit file: \components\com_rsappt_pro3\controllers\front_desk.php
Around line 788 look for:
function do_book_another(){
$frompage_item = JRequest::getVar('frompage_item');
Add the red code:
function do_book_another(){
$frompage_item = JRequest::getVar('frompage_item');
$req_date = JRequest::getString('req_date', "");
if($req_date != ""){ $req_date = "&mystartdate=".$req_date;}
A few line further down, look for (and add red code):
if($seo == "1"){
$this->setRedirect( JRoute::_('index.php?option=com_rsappt_pro3&view=front_desk&task=add_booking&Itemid='.$frompage_item.$req_date ));
} else {
$this->setRedirect( 'index.php?option=com_rsappt_pro3&view=front_desk&task=add_booking&Itemid='.$frompage_item.$req_date );
}
Now the Add Another Booking link will set the grid date to the same date as the last booking.