Migrating to 3.0 from 2.3

I have reinstalled the new source files and codebase.

My scheduler doesn’t load from my php file anymore… I get a blank error box. I have read the info on migrating, but cannot seem to figure out what code needs to be edited to use 3.0.

Scheduler.php:

<link rel="stylesheet" href="extra/dhtmlxlayout.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="extra/skins/dhtmlxlayout_dhx_skyblue.css" type="text/css" media="screen" title="no title" charset="utf-8">
    
<script src='codebase/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
<link rel='STYLESHEET' type='text/css' href='codebase/dhtmlxscheduler.css'>
    
<script src="codebase/ext/dhtmlxscheduler_units.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_active_links.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_html_templates.js" type="text/javascript" charset="utf-8"></script>

<script src="codebase/ext/dhtmlxscheduler_key_nav.js" type="text/javascript" charset="utf-8"></script>

<script src="codebase/ext/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>
    	
<script src="codebase/ext/dhtmlxscheduler_recurring.js" type="text/javascript" charset="utf-8"></script>
<!--    <link rel="stylesheet" href="codebase/ext/dhtmlxscheduler_recurring.css" type="text/css" title="no title" charset="utf-8">
 -->	
	
	
<script src="codebase/ext/dhtmlxscheduler_year_view.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_agenda_view.js" type="text/javascript" charset="utf-8"></script>
<!--	<link rel="stylesheet" href="codebase/ext/dhtmlxscheduler_ext.css" type="text/css" media="screen" title="no title" charset="utf-8"> -->
	
<script src="scheduler2pdf/client/dhtmlxscheduler_pdf.js" type="text/javascript" charset="utf-8"></script>
<script src="codebase/ext/dhtmlxscheduler_multiselect.js" type="text/javascript" charset="utf-8"></script>

<script src='codebase/ext/dhtmlxscheduler_tooltip.js' type="text/javascript" charset="utf-8"></script>
	
<style type="text/css" media="screen">
	html, body{
		margin:0px;
		padding:0px;
		height:100%;
		overflow: hidden;
	}
	
	.dhx_calendar_click {
		background-color: #C2D5FC !important;
		
	.dhx_multi_select_userselect input {
		vertical-align: middle;
	}
	
	
	
	</style>
<script type="text/javascript" charset="utf-8">

	
	function doOnLoad() {
		
		scheduler.config.wide_form = true;
	
	var prev = null;
	var curr = null;
	var next = null;
	
	    var step = 10;
		var format = scheduler.date.date_to_str("%h:%i %A");
		
		scheduler.config.hour_size_px=(60/step)*21;

		scheduler.locale.labels.section_apptstatus="Status";
		scheduler.locale.labels.section_reason= "Reason";
		scheduler.locale.labels.section_howheard= "How Heard";
		scheduler.locale.labels.section_promos= "Promos";
		scheduler.locale.labels.section_name = "Name";
		scheduler.locale.labels.section_offices="Office";

		scheduler.config.multi_day = true;
		scheduler.config.details_on_create=true;
		scheduler.config.details_on_dblclick=true;
		
		scheduler.config.first_hour=7;

		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.config.prevent_cache = true;
		
		scheduler.config.agenda_start = new Date(); //now
        scheduler.config.agenda_end = scheduler.date.add(new Date(), 1, "month"); //1 month from a current date
		
		dhtmlXTooltip.config.className = 'dhtmlXTooltip tooltip';
		dhtmlXTooltip.config.timeout_to_display = 50;
		dhtmlXTooltip.config.delta_x = 10;
		dhtmlXTooltip.config.delta_y = 60;
		
	
	scheduler.templates.tooltip_text = function(start,end,event) {
		return "<b>Name:</b> "+event.name+"<br/><b>Comments:</b> "+event.text+"<br/><b>Office:</b> "+scheduler.getLabel("office_ID", event.office_ID) + "<br/><b>Reason:</b> " +scheduler.getLabel("reason", event.reason);
		}
		scheduler.templates.tooltip_date_format=scheduler.date.date_to_str("%Y-%m-%d %H:%i");
	
		scheduler.templates.event_text = function(start, end, event) {
			var result = "<b>Name:</b> " + "<a href='http://www.michelshearing.com/admin_apptinformation.php?Calendar_Id="+event.id+"'>"+event.name+"</a>" + "<br/><b>Reason:</b> " +scheduler.getLabel("reason", event.reason);
			return result;
			
			/* var users=[];
			if (event.user_id){
				users = event.user_id.split(",");
				for (var i=0; i < users.length; i++)
					users[i] = scheduler.getLabel("user_id",users[i])
			}
			result += users.join(",");
			
			return result; */
		}

		scheduler.config.hour_date="%h:%i %A";
		
		scheduler.config.full_day  = true;
		
		scheduler.init('scheduler_here',null,"week");
		scheduler.load("php/events_rec.php?Office_ID=<?php echo $_GET['Office_ID']; ?>&Status=<?php echo $_GET['Status']; ?>&Provider=<?php echo $_GET['Provider']; ?>");
		
		var dp = new dataProcessor("php/events_rec.php?Office_ID=<?php echo $_GET['Office_ID']; ?>&Status=<?php echo $_GET['Status']; ?>&Provider=<?php echo $_GET['Provider']; ?>");
		dp.init(scheduler);
		
			var calendar = scheduler.renderCalendar({
			container:"cal_here", 
			navigation:true,
			handler:function(date){
				scheduler.setCurrentView(date, scheduler._mode);
			}
		});
		
		scheduler.form_blocks.textarea.set_value=function(node,value,ev){
        node.firstChild.value=value||"";
        var style = ev.company_ID?"<?php echo $_SESSION['Company_ID']; ?>":"none";
        node.style.display=style; // editor area
        node.previousSibling.style.display=style; //section header
        scheduler.setLightboxSize(); //correct size of lightbox
 
    }
								
		scheduler.linkCalendar(calendar);
		
	    scheduler.attachEvent("onBeforeLightbox", function (event_id){
        var ev = scheduler.getEvent(event_id);
        if(scheduler._new_event){
        ev.patient_ID= "<?php echo $_GET['Patient_ID']; ?>";
        ev.name= "<?php echo $_GET['First']; ?> " + "<?php echo $_GET['Last']; ?>";
		ev.office_ID = "<?php echo $_GET['Office_ID']; ?>";
		ev.company_ID = "<?php echo $_SESSION['Company_ID']; ?>";
		ev.appt_status = "2";
}
        return true;
});

  

	scheduler.config.lightbox.sections=[
	        {name:"apptstatus", height:20, map_to:"appt_status", type:"select", options:scheduler.serverList("apptstatus")},
		{name:"name", height:20, map_to:"name", type:"textarea"},
		{name:"description", height:50, map_to:"text", type:"textarea", focus:true},
		{name:"offices", height:20, type:"select", options:scheduler.serverList("offices"), map_to:"office_ID"},
		{name:"reason", height:20, type:"select", map_to:"reason", options:scheduler.serverList("reason")},
		{name:"howheard", height:20, type:"select", map_to:"howheard_ID", options:scheduler.serverList("howheard")},
		{name:"promos", height:20, type:"select", map_to:"promo_ID", options:scheduler.serverList("promos")},
		{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
		{name:"time", height:115, type:"time", map_to:"auto"}
		]
	
	}
</script>

Here’s my event_rec.php:

<?php
	include ('../codebase/connector/scheduler_connector.php');
	include ('../common/config.php');
	
	$res=mysql_connect($server, $user, $pass);
	mysql_select_db($db_name);
	
	$office_id = $_GET['Office_ID'];
	$company_ID = $_SESSION['Company_ID'];
	
	if ($_GET['Status'] == "all") {
	
		$status_query = "SELECT ID FROM appt_status";
        $status_result = mysql_query($status_query);

		$viewall = array();
		while($row3 = mysql_fetch_assoc($status_result)){
  		$viewall[] = $row3['ID'];
  		$allids = implode(",", $viewall);
														}

		$appt_progress = $allids;
	} else {
	$appt_progress = $_GET['Status'];
	}
	
	function default_values($action){
		global $office_id;
		
		$event_type = $action->get_value("event_type");
		if ($event_type == "")
			$event_type = 0;
			
		$action->set_value("office_ID",$office_id);
	}
	
	function delete_related($action){
		global $scheduler;
		
		$status = $action->get_status();
		$type =$action->get_value("rec_type");
		$pid =$action->get_value("event_pid");
		//when serie changed or deleted we need to remove all linked events
		if (($status == "deleted" || $status == "updated") && $type!=""){
			$scheduler->sql->query("DELETE FROM events_rec WHERE event_pid='".$scheduler->sql->escape($action->get_id())."'");
		}
		if ($status == "deleted" && $pid !=0){
			$scheduler->sql->query("UPDATE events_rec SET rec_type='none' WHERE event_id='".$scheduler->sql->escape($action->get_id())."'");
			$action->success();
		}
		
	}
	function insert_related($action){
		$status = $action->get_status();
		$type =$action->get_value("rec_type");
		
		if ($status == "inserted" && $type=="none")
			$action->set_status("deleted");
	}
	
	$scheduler = new schedulerConnector($res);

	$scheduler->event->attach("beforeProcessing","delete_related");
	$scheduler->event->attach("afterProcessing","insert_related");
	

	$list_query = "SELECT ID AS value, Category AS label FROM previsit_categories WHERE Company_ID = '" . addslashes($_SESSION['Company_ID']) . "'";
    $result = mysql_query($list_query);
    $list = array("-1" => "None...");
    if($list){
        while ($row = mysql_fetch_assoc($result)){
            $list[$row['value']] = $row['label'];
        }
    }

   $scheduler->set_options("reason", $list);  
	
	//option
	
	$status2 = new OptionsConnector($res);
	$status2->render_table("appt_status","ID","ID(value),Status(label)");
	$scheduler->set_options("apptstatus", $status2);	
	
	$offices_query = "SELECT Office_ID AS value, Office AS label FROM offices WHERE Company_ID = '" . addslashes($_SESSION['Company_ID']) . "'";
    $result = mysql_query($offices_query);
    $offices = array();
    //if($offices){
        while ($row = mysql_fetch_assoc($result)){
            $offices[$row['value']] = $row['label'];
        //}
    }

   $scheduler->set_options("offices", $offices);  
	
	//next option
	
	$howheard_query = "SELECT ID AS value, Category AS label FROM how_heard_cat WHERE Company_ID = '" . addslashes($_SESSION['Company_ID']) . "'";
    $result = mysql_query($howheard_query);
    $howheard = array("-1" => "None...");
    if($howheard){
        while ($row = mysql_fetch_assoc($result)){
            $howheard[$row['value']] = $row['label'];
        }
    }

   $scheduler->set_options("howheard", $howheard);   
      
   //next option
   
    $promos_query = "SELECT promos.ID AS value, CONCAT(offices.Office, ' ' , how.Category, ' ',Date) AS label FROM promos 
	LEFT JOIN how_heard_cat how ON how.ID =promos.Type 
	LEFT JOIN offices ON offices.Office_ID = promos.Area
	WHERE promos.Company_ID = '" . addslashes($_SESSION['Company_ID']) . "' ORDER BY Date DESC";
    $result = mysql_query($promos_query);
    $promos = array("-1" => "None...");
    if($promos){
        while ($row = mysql_fetch_assoc($result)){
            $promos[$row['value']] = $row['label'];
        }
    }

    $scheduler->set_options("promos", $promos);

//render sql
	
	$scheduler->render_sql("select * from events_rec where office_ID IN ($office_id) AND appt_status IN ($appt_progress) AND Company_ID = '" . addslashes($_SESSION['Company_ID']) . "'","event_id","start_date,end_date,text,rec_type,event_pid,event_length,office_ID,reason,patient_ID,name, howheard_ID,promo_ID, company_ID, appt_status");

?>

a) be sure that old files are not cached
b) are you using any other dhtmlx component on the page? In such case you need to update them to version 3.0 as well.

The above code looks correct. And if you are using only public API ( looks as your case ) - there is no any special migration steps required. The format of data is also the same.

Also, please be sure that you have replaced all files in codebase forlder ( js, css, images ) with ones from the new version.

I have tried all you suggested… I feel I am missing something here.

I have both codebases in my directory online… when I rotate between both of them, of course, codebase 2.3 works fine… 3.0 doesn’t pull any data from event_rec.php.

I am using the newest 3.0 sources directory also. Sources 3.0 works fine with 2.3 codebase.

I know the minical doesn’t work properly when I’m using the new 3.0 codebase. But, isn’t the minical.js a part of the new 3.0 codebase? So it should work fine. Either way, when I remove the minical references from my scheduler.php page, the data still doesn’t load and I get that blank error box.

Any other suggestions?
I’ll keep digging…

Can you create any sample, where scheduler 3.0 doesn’t work for you and send it to the support@dhtmlx.com ( or maybe a demo link ) ?

Yes, I will email you. Thanks.

Did my email work? I got this auto response:

This is the mail system at host homiemail-mx19.g.dreamhost.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

If you are a current customer of DreamHost, please contact our
technical support team here

https://panel.dreamhost.com/support

If you are not a customer please use our contact form at.

http://dreamhost.com/contact

If you do so, please include this email in your support ticket. You can
delete your own text from the attached returned message.

               Dreamhost Email Support

<ernstsoft@gmail.com> (expanded from <support@dhtmlx.com>): host
   gmail-smtp-in.l.google.com[74.125.127.27] said: 552-5.7.0 Our system
   detected an illegal attachment on your message. Please 552-5.7.0 visit
   http://mail.google.com/support/bin/answer.py?answer=6590 to 552 5.7.0
   review our attachment guidelines. e9si3926197pbd.274 (in reply to end of
   DATA command)

Final-Recipient: rfc822; ernstsoft@gmail.com
Original-Recipient: rfc822;support@dhtmlx.com
Action: failed
Status: 5.7.0
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 552-5.7.0 Our system detected an illegal attachment on
   your message. Please 552-5.7.0 visit
   http://mail.google.com/support/bin/answer.py?answer=6590 to 552 5.7.0
   review our attachment guidelines. e9si3926197pbd.274

I tried sending twice.

Let me know. Thanks.

If you get your email server up and going, please let me know. I’ll try emailing the issue I’ve been having again. Thanks.

Hello,

Our mail system seem to work ok.
Error message:

What is the size of your attachment, are there executable files?

Please try reducing size of your attachment or upload it to some file sharing site with the password protection and email/PM us a link with a password.

Kind regards,
Ilya

Sorry about that! My attachment must have been too large. I resent it. It didn’t come back, so it should be good. :stuck_out_tongue:

Hey Ilya… not sure if you or not but I sent the attachement and was told there was probably an issue with my server side code.

I found out the issue after checking the error log:

“PHP Fatal error: Call to private method Connector::xmlentities() from context ‘SchedulerConnector’ in /home1/pathtofile/dhtmlxScheduler/codebase/connector/scheduler_connector.php on line 44”

When I change the xmlentities () function from protected to public, all my problems go away!! I am able to use the same php code that worked well with codebase 2.3.

I see now on codebase2.3 base_connector.php, that function was set to public, which is why I was able to use 2.3 and not 3.0 this whole time.

We will investigate this case and include fix in the next update.
Thanks for the provided info.

Thank you for your great support!!!