Scheduler not saving ... no errors found

Unfortunately, I’m working on Intranet sites and cannot provide access to the sites in question.

I created a Scheduler calendar on my localhost Apache server 2.4 using PHP 5.6.28 and MySQL 5.6 and the MySQLi connector. It works great. When I transfer it to our Windows Server 2012 with IIS 8.5 and PHP 5.6.19 (everything else matches localhost), it stops saving. I get the generic XML action=error, but no details. When I search the PHP, IIS, and mySQL logs, I cannot find any errors, but the data will not update.

I used a mysqldump file to transfer the entire database to my IIS server. The existing entries show on the calendar just fine. So, I know I am connecting with the database. It just won’t insert or update any new data submissions.

Both processes seem to function identically, except that I get a “<action type=‘error’ sid=‘1500499424480’ tid=‘1500499424480’ ></action>” returned from the IIS server:

Localhost

500493948750_!nativeeditor:	inserted
1500493948750_comments:	Test2
1500493948750_emp_name:	Todd Giammona
1500493948750_emp_title:		Manager
1500493948750_end_date:		2017-07-19 12:00
1500493948750_event_length:	
1500493948750_event_pid:	
1500493948750_id:			1500493948750
1500493948750_rec_pattern:	
1500493948750_rec_type:	
1500493948750_start_date:		2017-07-19 11:00
1500493948750_status:		Training
1500493948750_text:			Manager &ndash; Training
ids:						1500493948750

IIS Server

1500488078879_!nativeeditor_status:	inserted
1500488078879_comments:		Test2
1500488078879_emp_name:		Todd Giammona
1500488078879_emp_title:			Manager
1500488078879_end_date:			2017-07-19 12:00
1500488078879_event_length:			
1500488078879_event_pid:	
1500488078879_id:				1500488078879
1500488078879_rec_pattern:	
1500488078879_rec_type:	
1500488078879_start_date:			2017-07-19 11:00
1500488078879_status:			Ed Leave
1500488078879_text:				Manager &ndash; Ed Leave
ids:							1500488078879

dhtmlxScheduler_connector.php

require ("../js/scheduler/connector/scheduler_connector.php"); // connector file
require ("../js/scheduler/connector/db_mysqli.php");

$mySQLi = mysqli_connect("localhost", '<admin-username>', '<admin-pwd>', "medlegal-sched"); // db connection
                                                                               
// connector object; parameters: db connection and the type of the used db
$Conn = new SchedulerConnector($mySQLi, "MySQLi");

$Conn->render_table("`medlegal-employee-events`", "id", "start_date,end_date,text,rec_type,event_length,event_pid,emp_title,emp_name,status,comments"); 

Javascript

// locale settings to adjust labels and fields for our needs
	scheduler.locale.labels.section_description = 'Employee Title';
	scheduler.locale.labels.section_text = 'Text';
	scheduler.locale.labels.section_checkbox = 'Checkbox';
	scheduler.locale.labels.section_radiobutton = 'Radiobutton';
	scheduler.locale.labels.section_select = 'Select';
	scheduler.locale.labels.section_template = 'Template';
	scheduler.locale.labels.week_agenda_tab = "Week A.";

	// Scheduler config options for presenting the calendar the way we want
	scheduler.config.occurrence_timestamp_in_utc = true;	
	scheduler.config.include_end_by = true;
	scheduler.config.repeat_date = "%m/%d/%Y";
	scheduler.config.repeat_precise = true;
	scheduler.config.max_month_events = 5;
	scheduler.config.multi_day = true;
	scheduler.config.mark_now = true;
	scheduler.config.full_day = true;
	scheduler.config.xml_date="%Y-%m-%d %H:%i";	
	scheduler.config.hour_date = "%g:%i%a";
	scheduler.config.form_date = "%m/%d/%Y %H:%i%a";
	scheduler.config.header_date = "%m/%d/%Y";
	scheduler.config.form_all_day = "%m/%d/%Y";
	scheduler.config.event_duration = 60;
	scheduler.config.auto_end_date = true;
	scheduler.config.first_hour = 7;
	scheduler.config.last_hour = 19;
	scheduler.config.start_on_monday = true;
	scheduler.config.resize_month_events = user_access > 3 ? true : false;	
	scheduler.config.prevent_cache = true;	

scheduler.attachEvent("onEventSave",function(id,data){
		// use the text field to set the title in the calendar view
		data.text = data['emp_title'] + ' &ndash; ' + data['status'];
					
	    return true;
	});

	// Modify the time scale, so we have taller time slots (displays more info per entry)
	var step = 15;
	var formatFunc = scheduler.date.date_to_str("%H:%i");	
	scheduler.config.hour_size_px=(60/step)*22;
	scheduler.templates.hour_scale = function(date){
		html="";
		for (var i=0; i<60/step; i++){
			html += "<div style='height:22px;line-height:22px;'>" + formatFunc(date) + "</div>";
			date = scheduler.date.add(date,step,"minute");
		}
		return html;
	}
	
	scheduler.init('scheduler_here', new Date(), "month");	

scheduler.load(INC_ROOT + "dhtmlxScheduler_connector.php");	
var emp_dp = new dataProcessor(INC_ROOT + "dhtmlxScheduler_connector_emp.php");
emp_dp.init(scheduler);

emp_dp.attachEvent("onBeforeUpdate", function(id, state, data){
	console.log('Ready to update');

	// any custom logic here
	return true;
});
	
emp_dp.attachEvent("onAfterUpdate", function(id, action, tid, response){		
	if (action=='error'){
		webix.message({'type':'error','text':'An unknown error prevented your update from saving correctly.'});
	}
	    // any custom logic here
	    return true;
	});

Hope somebody can help shed some light on this!

Thanks!
localhost-medlegal-sched-export-0719.sql.zip (1.54 KB)

Finally figured out how to enable server side debugging and got the following errors, which I don’t know how to fix:
data

start_date => 2017-04-17 07:00
end_date => 2017-04-17 08:00
text => All employees &ndash; ALL-SCUT
id => 1500590654130
event_pid => 
event_length => 
rec_pattern => 
rec_type => 
emp_title => All employees
emp_name => All Employees
status => ALL-SCUT
comments => Test
created => 2017-07-20 15:44
createdby => 1
!nativeeditor_status => inserted

Resultant query

INSERT INTO `medlegal-employee-events`(`start_date`,`end_date`,`text`,`rec_type`,`event_length`,`event_pid`,`emp_title`,`emp_name`,`status`,`comments`,`created`,`createdby`,`updatedby`) VALUES ('2017-04-17 07:00','2017-04-17 08:00','All employees &ndash; ALL-SCUT','','','','All employees','All Employees','ALL-SCUT','Test','2017-07-20 15:44','1','')

Error

exception 'Exception' with message 'MySQL operation failed
Incorrect integer value: '' for column 'event_length' at row 1' in F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\db_mysqli.php:16
Stack trace:
#0 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\db_common.php(905): MySQLiDBDataWrapper->query('INSERT INTO `me...')
#1 [internal function]: DBDataWrapper->insert(Object(DataAction), Object(DataRequestConfig))
#2 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\dataprocessor.php(248): call_user_func(Array, Object(DataAction), Object(DataRequestConfig))
#3 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\dataprocessor.php(189): DataProcessor->check_exts(Object(DataAction), 'insert')
#4 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\dataprocessor.php(116): DataProcessor->inner_process(Object(DataAction))
#5 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\base_connector.php(639): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#6 F:\data\web\site\apps\medlegal_scheduling\js\scheduler\connector\base_connector.php(547): Connector->render()
#7 F:\data\web\site\apps\medlegal_scheduling\inc\dhtmlxScheduler_connector_emp.php(22): Connector->render_table('`medlegal-emplo...', 'id', 'start_date,end_...')
#8 {main}

Found the problem!

MySQL is running in “strict” mode on my production servers. Your query builder (db_common.php) builds queries with empty quotes in fields with null values.

MySQL must have “NULL” passed to integer fields like “event_length” and “event_pid”.

For now, I have modified your query builder to use "INSERT IGNORE " and "UPDATE IGNORE ", since I will be handling the data validation myself.

For future versions, it might be useful to have a configuration option that specifies field types. Then, your query builder could pass empty quotes for string fields and NULL for other fields.