0

I am a CMS Developer but am not well in PHP. So I might need your help here..

error: Notice: Undefined variable: handler in C:\wamp\www\TESTING\components\com_rsappt_pro14\rsappt_pro14_front_desk.php on line 34


source of error:

defined( '_JEXEC' ) or die( 'Restricted access' );

	// Load configuration data
	//include( JPATH_SITE . "/administrator/components/com_rsappt_pro14/config.rsappt_pro.php" );
	include( JPATH_SITE."/administrator/components/com_rsappt_pro14/config.rsappt_pro14.php" );
	include( JPATH_SITE."/components/com_rsappt_pro14/functions2.php" );
	//global $my;  
	$user =& JFactory::getUser();

	$session = &JSession::getInstance($handler, $options);
	if($session->get("front_desk_view") != "" ){
		$view = $session->get("front_desk_view");
		$session->set("front_desk_view", "");
	} else {
		$view = JRequest::getString( 'front_desk_view', 'month' );
	}

	if($session->get("front_desk_resource_filter") != "" ){
		$front_desk_resource_filter = $session->get("front_desk_resource_filter");
		$session->set("front_desk_resource_filter", "");
	} else {
		$front_desk_resource_filter = JRequest::getString( 'front_desk_resource_filter', '' );
	}

	if($session->get("front_desk_status_filter") != "" ){
		$front_desk_status_filter = $session->get("front_desk_status_filter");
		$session->set("front_desk_status_filter", "");
	} else {
		$front_desk_status_filter = JRequest::getString( 'front_desk_status_filter', '' );
	}

	if($session->get("front_desk_user_search") != "" ){
		$front_desk_user_search_filter = $session->get("front_desk_user_search");
		$session->set("front_desk_user_search", "");
	} else {
		$front_desk_user_search_filter = JRequest::getString( 'front_desk_user_search', '' );
	}

	$retore_settings = "";
	switch($view){
		case "month":
			if($session->get("front_desk_cur_month") != ""){
				$retore_settings = "'', '".$session->get("front_desk_cur_month")."', '".$session->get("front_desk_cur_year")."', ''";
			}		
			break;
		case "week":
			if($session->get("front_desk_cur_week_offset") != ""){
				$retore_settings = "'', '', '', '".$session->get("front_desk_cur_week_offset")."'";
			}
			break;
		case "day":
			if($session->get("front_desk_cur_day") != ""){
				$retore_settings = "'".$session->get("front_desk_cur_day")."', '', '', ''";
			}		
			break;
	}
	

	$showform= true;

	if(!$user->guest){
	
		$database = &JFactory::getDBO();
		// get resources
		$sql = "SELECT * FROM #__sv_apptpro_resources ".
		"WHERE resource_admins LIKE '%|".$user->id."|%' and Published=1 ".
		"ORDER BY display_order;";
		//echo $sql;
		$database->setQuery($sql);
		$res_rows = $database -> loadObjectList();
		if ($database -> getErrorNum()) {
			echo $database -> stderr();
			return false;
		}

		$database = &JFactory::getDBO();
		$sql = 'SELECT * FROM #__sv_apptpro_config';
		$database->setQuery($sql);
		$apptpro_config = NULL;
		$apptpro_config = $database -> loadObject();
		if ($database -> getErrorNum()) {
			echo "DB Err: ". $database -> stderr();
			return false;
		}

	} else{
		echo "<font color='red'>".JText::_('RS1_ADMIN_SCRN_NO_LOGIN')."</font>";

		$showform = false;
	}
	
?>

<?php if($showform){?>
<link href="./components/com_rsappt_pro14/sv_apptpro.css" rel="stylesheet">
<script language="JavaScript" src="./components/com_rsappt_pro14/script.js"></script>
<script language="javascript">
	window.onload = function() {
		buildFrontDeskView( <?php echo $retore_settings ?>);	
	} 	

	function goDetail(id){
		document.getElementById("id").value=id;
		document.getElementById("redirect").value="detail";
		submitbutton('');
		return false;		
	}

	function goManifest(resid, startdate, starttime, endtime){
		document.getElementById("redirect").value="manifest";
		document.getElementById("resid").value=resid;
		document.getElementById("startdate").value=startdate;
		document.getElementById("starttime").value=starttime;
		document.getElementById("endtime").value=endtime;
		submitbutton('');
		return false;		
	}

	function toggleTotals(){
		if(document.getElementById("cur_day") != null){
			buildFrontDeskView( document.getElementById("cur_day").value);
		}
	}
	
	function goDayView(day){
		document.getElementById("view").selectedIndex=0;
		buildFrontDeskView(day);
	}

	function sendReminders(which){
		if(which=="Email"){
			document.getElementById("redirect").value="reminders2";
		} else {
			document.getElementById("redirect").value="reminders2_sms";
		}	
		submitbutton('');
		return false;		
	}
	
	function doSearch(){
/*		if(document.getElementById("user_search").value==""){
			alert("<?php echo JText::_('RS1_FRONTDESK_SCRN_SEARCH_HELP');?>");
			return false;
		}*/
		buildFrontDeskView();
	}

	
	function doAddNew(){
		document.getElementById("redirect").value="fd_gad";
		submitbutton('');
		return false;		
	}

	function submitenter(myfield,e)
	{
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
		
		if (keycode == 13)
		   {
		   doSearch();
		   return false;
		   }
		else
		   return true;
		}

</script>
<div id="sv_apptpro_front_desk">
<form name="adminForm" action="" method="post">
    <table width="100%">
        <tr>
          <td align="left" colspan="2"> <h3><?php echo JText::_('RS1_FRONTDESK_SCRN_TITLE');?></h3></td>
          <td align="right"><?php echo $user->name ?></td>
        </tr>
        <tr><td colspan="3"><div id="reminder_links" style="visibility:hidden; display:none; text-align:right">
			<a href="javascript:sendReminders('Email');"><?php echo JText::_('RS1_ADMIN_SCRN_SEND_REMINDERS');?></a>&nbsp;|&nbsp;
			<a href="javascript:sendReminders('SMS');"><?php echo JText::_('RS1_ADMIN_SCRN_SEND_REMINDERS_SMS');?></a>&nbsp;			
        	</div></td>
        <tr>
         <td align="left">&nbsp;&nbsp;<select id="view" name="view" onchange="buildFrontDeskView()" style="font-size:11px">
            <option value="day" <?php if($view == "day"){ echo " selected ";}?>><?php echo JText::_('RS1_FRONTDESK_SCRN_VIEW_DAY');?></option>
            <option value="week" <?php if($view == "week"){ echo " selected ";}?>><?php echo JText::_('RS1_FRONTDESK_SCRN_VIEW_WEEK');?></option>
            <option value="month" <?php if($view == "month"){ echo " selected ";}?>><?php echo JText::_('RS1_FRONTDESK_SCRN_VIEW_MONTH');?></option>
            </select> </td>
          <td align="right"></td>          
          <td align="right"><input type="text" id="user_search" name="user_search" size="20" class="sv_apptpro_request_text" onKeyPress="return submitenter(this,event)"
          	title="<?php echo JText::_('RS1_FRONTDESK_SCRN_SEARCH_HELP');?>" value="<?php echo $front_desk_user_search_filter ?>" />
            <input type="button" onclick="doSearch();" class="sv_apptpro_request_text" value="<?php echo JText::_('RS1_FRONTDESK_SCRN_SEARCH');?>" /></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;&nbsp;<input type="button" onclick="doAddNew();" class="sv_apptpro_request_text" value="<?php echo JText::_('RS1_FRONTDESK_SCRN_ADDNEW');?>" /></td>
          <td align="right">
			<input type="checkbox" id="showSeatTotals" name="showSeatTotals" onclick="toggleTotals();"/><?php echo JText::_('RS1_FRONTDESK_SCRN_SHOW_SEAT_TOTALS');?>&nbsp;&nbsp;&nbsp;&nbsp;
            <select name="resource_filter" id="resource_filter" onchange="buildFrontDeskView();" style="font-size:11px" >&nbsp;&nbsp;
            <option value=""><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_RESOURCE_NONE');?></option>
              <?php
				$k = 0;
				for($i=0; $i < count( $res_rows ); $i++) {
				$res_row = $res_rows[$i];
				?>
              <option value="<?php echo $res_row->id; ?>" <?php if($front_desk_resource_filter == $res_row->id){echo " selected='selected' ";} ?>><?php echo stripslashes($res_row->description); ?></option>
              <?php $k = 1 - $k; 
				} ?>
            </select>            &nbsp;&nbsp;
          <select id="status_filter" name="status_filter" onchange="buildFrontDeskView()" style="font-size:11px">
            <option value=""><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_NONE');?></option>
            <option value="new" <?php if($front_desk_status_filter == "new"){ echo " selected ";}?> class="color_new" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_NEW');?></option>
            <option value="accepted" <?php if($front_desk_status_filter == "accepted"){ echo " selected ";}?> class="color_accepted" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_ACCEPTED');?></option>
            <option value="pending" <?php if($front_desk_status_filter == "pending"){ echo " selected ";}?> class="color_pending" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_PENDING');?></option>
            <option value="declined" <?php if($front_desk_status_filter == "declined"){ echo " selected ";}?> class="color_declined" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_DECLINED');?></option>
            <option value="canceled" <?php if($front_desk_status_filter == "canceled"){ echo " selected ";}?> class="color_canceled" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_CANCELED');?></option>
            <option value="no_show" <?php if($front_desk_status_filter == "no_show"){ echo " selected ";}?> class="color_no_show" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_NO_SHOW');?></option>
            <option value="attended" <?php if($front_desk_status_filter == "attended"){ echo " selected ";}?> class="color_attended" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_ATTENDED');?></option>
            <option value="completed" <?php if($front_desk_status_filter == "completed"){echo " selected ";} ?> class="color_completed" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_COMPLETED');?></option>
            <!--<option value="deleted" <?php if($front_desk_status_filter == "deleted"){echo " selected ";} ?> class="color_deleted" ><?php echo JText::_('RS1_ADMIN_SCRN_REQUEST_STATUS_DELETED');?></option>-->
            </select>&nbsp;&nbsp;         
           </td>
        </tr> 
    </table>

<div id="calview_here">&nbsp;</div>

<input type="hidden" name="id" id="id" value="<?php echo $row->id; ?>">
<input type="hidden" name="uid" id="uid" value="<?php echo $user->id; ?>">
<input type="hidden" id="script_path" name="script_path" value="<?php echo SCRIPTPATH?>" />
<input type="hidden" name="redirect" id="redirect" value="" />
<input type="hidden" name="listpage" id="listpage" value="front_desk" />
<input type="hidden" name="startdate" id="startdate" value="" />
<input type="hidden" name="starttime" id="starttime" value="" />
<input type="hidden" name="endtime" id="endtime" value="" />
<input type="hidden" name="resid" id="resid" value="" />

  <br />
  <?php if($apptpro_config->hide_logo == 'No'){ ?>
    <span style="font-size:10px"> Appointment Booking Pro Ver. 1.4.4 - Copyright 2008-20<?php echo date("y");?> - <a href='http://www.softventures.com' target="_blank">Soft Ventures, Inc.</a></span>
  <?php } ?> 
</form>
</div>
<?php } ?>

Kindly help me with this

this the line error: $session = &JSession::getInstance($handler, $options);

Edited by Narue: added code tags

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by cwarn23
0

If you look at the error message it is telling you that it found an undefined variable "handler" in module rsappt_pro14_front_desk.php on line 34. Since you don't have a reference to "handler" on line 34 in the module that you have posted, I suspect that this isn't module rsappt_pro14_front_desk.php. There is a reference to $handler on line 10 in this module. You could post some or all of the code (including line 34) from module rsappt_pro14_front_desk.php. The bottom line is probably that $handler wasn't defined somewhere and that might be the result of some other error. It might be that it is supposed to be defined in one of the two modules included prior to line 10 in this module. It may also be that something wasn't defined (correctly) in a config module and that has rippled through a number of modules and ended up creating this error. You will probably need to find out where $handler is supposed to be defined before you can make any sense of this.

Edited by chrishea: n/a

0

Try replacing the problem line with the following:

$session = &JSession::getInstance(NULL, $options);

When E_Notice is disabled that is the equivalent to what is set. To problem with your code is that $handler was never set a value. So I have put into getInstance an empty variables default value for you. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.