Scheduler timeline - failing after move to new server


#1

Hi all,
I’ve had the scheduler working fine for the last 3yrs in a stable environment. (Only use the timeline view).
Now having to move to new server.
Old server was using an older version of PHP. New server has PHP 7.2.10

-------EDIT --------
I’ve made some progress, and I now feel “close” to a solution, but not quite there yet!

Original error messages (below) solved - I had missed the line "$scheduler->render_table(“timetable… etc” from config.sys. Found this thanks to this forum post:
Scheduler - No events shown with Connector

OK, now I have the database returning data to the page, but STILL NOT DISPLAYING.

Here’s what I get:

  • timeline page loads. I can see data returning from database like:
    <start_date></start_date><end_date></end_date><section_id></section_id>

…which looks right to me.

But, data doesn’t display on the timeline.
ADDITIONALLY, if I add an event, it shows on the page, and text goes RED (I assume this is indicating that there’s an error). Saving/editing causes the following return from EVENTS_TREE_DB.PHP:

action type=‘error’ sid=‘1541667586949’ tid=‘1541667586949’

and events are not added/updated in the database.

Now, I’m completely lost, as these seem to be scheduler “internal” errors, not db, php or server errors.

Help someone please?

(and thanks)

Paul Rivers

ORIGINAL POST HERE…

Loading scheduler causes the following error:
(from events_tree_db.php) Uncaught Error: Call to undefined function mysql_query() in /var/www/html/timetable2/common/connector/db_mysql.php:11

I can ‘double-click’ to create an event, which shows the event-create dialog screen, but on saving I get:
Uncaught Error: Call to undefined function mysql_real_escape_string90 in […]timetable/common/connector/db_mysql.php:29

…and, of course, I see no activity in the database (MySQL).

I’ve hunted through all the support info I can find, including notes about minor regressions by Alex Klimenkov, and implemented suggested fixes.
Tried grabbing latest versions of db_mysqli , db_mysql and db_common from the codebase, but still going a bit mad trying to find the problem!!

I am sure this is just a connector config problem, but I’ve run out of ideas and things to try.

Help! I’m going insane! Can someone suggest where I look next?


#2

Hi,

Seems you need to change the connection to mysql

You used php_mysql, which was dropped from php 7. Instead of it you need to use PDO.

For this you need:

  • download the latest connectors from the official repository
    https://github.com/DHTMLX/connector-php

  • use PDO object to connect to db:

    $res = new PDO(“mysql:host=192.168.1.251;dbname=schedulertest”, “scheduler”, “scheduler”);
    $dbtype = “PDO”;
    require_once(‘connector/scheduler_connector.php’);
    $scheduler = new schedulerConnector($res, $dbtype);


#3

Hi Polina, Thanks for your reply. Apologies for delay - I had a week holiday!

I have made the changes to switch to PDO, but still have a problem - more info below… Please can you help?

as per your advice, config.php is now:

$res = new PDO("mysql:host=127.0.0.1;dbname=lsl_orderbook","username","password");
 
 $dbtype = "PDO";

require_once(‘connector/scheduler_connector.php’);

$scheduler = new schedulerConnector($res, $dbtype);

$scheduler->render_table(“timetable”,“id”,“start_date,end_date,text,section_id,eventkey,color,job,vehicle,office”);

----- end of config.php -------

Creating new event, I get lightbox ok. On saving, events_tree_db.exe reports same error as before. (data, action type=‘error’ sid=‘1542803422023’ tid=‘1542803422023’ etc…

Stack trace shows this error:
Fatal error : Uncaught Exception: Incorrect incoming data, ID of incoming records not recognized in /var/www/html/timetable2/common/connector/dataprocessor.php:66 Stack trace: #0 /var/www/html/timetable2/common/connector/dataprocessor.php(82): DataProcessor->get_ids() #1 /var/www/html/timetable2/common/connector/base_connector.php(490): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig)) #2 /var/www/html/timetable2/common/connector/base_connector.php(409): Connector->render() #3 /var/www/html/timetable2/common/config.php(16): Connector->render_table(‘timetable’, ‘id’, ‘start_date,end_…’) #4 /var/www/html/timetable2/data/events_tree_db.php(3): include(’/var/www/html/t…’) #5 {main} thrown in /var/www/html/timetable2/common/connector/dataprocessor.php on line 66


So, I am wondering from this error, do I have a problem with the table/data? (It’s the same as my old server, which functions ok).

Table structure is:
id int(11) Auto Increment
start_date datetime
end_date datetime
text varchar(255)
location varchar(100)
user varchar(20)
office varchar(8)
operative int(11)
job_id int(11)
section_id int(11)
eventkey int(11)
color varchar(8)
textColor varchar(8)
job varchar(8)
vehicle varchar(9)
hours decimal(5,2)
ts_returned int(11) [0]
duration int(11) [0]

(Some fields are ‘extra’ and not used by the timetable, but populated/updated by other programs. ID field for the data seems to be ok (Incrementing integer).

If it helps any more, the console also shows the error:
dhtmlxscheduler.js:4713 Uncaught TypeError: r.getElementsByTagName is not a function

HELP!


#4

While trying to solve this, I found I am getting the SAME symptoms (as below) when using your on-line sample here:-

https://docs.dhtmlx.com/scheduler/samples/06_timeline/04_tree_db.html

So maybe this latest problem is not my code/setup? Is this a timeline tree-view problem??


#5

Hi,

Seems such error can be caused if you don’t have id parameter in the request https://github.com/DHTMLX/connector-php/blob/master/codebase/dataprocessor.php#L65
which is actually strange, because this parameter is optional and the connector must understand data without id.

Could you show the code that you use to initialize the dataprocessor on the page?
In theory, if you do it in a default way without additional settings -

var dp = new dataProcessor("data/connector.php");
dp.init(scheduler);

it should work.

Also you can try to add

dp.setTransactionMode("POST", true);

after dp.init(scheduler).


#6

Thanks Polina,

I’ve added “dp.setTransactionMode(“POST”, true);” after dp.init(scheduler), but it made no difference.

the code I am using to initialize the scheduler is here:

	var date = new Date();
	date.setDate(date.getDate() -1);


	scheduler.init('scheduler_here',date,"timeline");
	scheduler.load("data/events_tree_db.php", "json");

	var dp = new dataProcessor("data/events_tree_db.php");


	scheduler.attachEvent("onTemplatesReady", function(){
	scheduler.templates.event_text=function(start,end,event){
		return "<b>" + event.text + "X</b><br><i>" + event.vehicle + "</i>";
	}

}); 

	dp.init(scheduler);
	dp.setTransactionMode("POST", true);

	scheduler.parse(elements);

Did you also note that your timeline demo in the SAMPLES section of your website also has the same problem? Maybe that could give a clue?

(samples->06 Timeline->tree mode, loading from Db)
https://docs.dhtmlx.com/scheduler/samples/06_timeline/04_tree_db.html

my server with this page is in development, with only non-personal sample data, so if you wanted me to give you a link to it I can do that, if it helps.

Thanks - hope we can get there soon :slight_smile:

Paul.


#7

Please, make sure that the fields defined in your render_table method are corresponding to the fields in your database.


#8

Thanks :slight_smile:
I’ve already checked that, as you can see from the table listing above. All the firlds in the render_table list are there.

Still stuck and need help! :frowning:


#9

You’ve mentioned that you “have a similar problem” on the following page:
https://docs.dhtmlx.com/scheduler/samples/06_timeline/04_tree_db.html
Could you please, clarify that problem and the steps to reproduce it, because the events are displaying correctly on the linked page.