When I insert a link, connector tries to insert the link in wrong table (task table)


#1

Hello Everybody, I installed succesfully gantt and configured connector.
On the client side I have:

gantt.init(“gantt_here”);
gantt.load("preventivi/connector.php?preventivo=1);
var dp = new gantt.dataProcessor("preventivi/connector.php?preventivo=1);
dp.init(gantt);

And the cnnector.php file is:

<?php require_once("db_config.php"); require_once("../../assets/plugins/dhtmlx_gantt/connector/gantt_connector.php"); function my_update($data) { $data->add_field("preventivo",$_GET['preventivo']); } $res = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASS); $dbtype = "PDO"; $gantt = new JSONGanttConnector($res, $dbtype); $gantt->enable_log('/home/site/public_html/downloads/log.txt',true); if($gantt->is_select_mode()) { $gantt->mix("open", 1); $gantt->filter("preventivo", $_GET['preventivo']); $gantt->render_links("gantt_links_preventivi", "id", "source, target, type, preventivo"); $gantt->render_table("gantt_tasks_preventivi", "id", "start_date, duration, text, progress, parent, color, textColor, preventivo"); } else { $gantt->event->attach("beforeInsert", "my_update"); $gantt->render_links("gantt_links_preventivi", "id", "source, target, type"); $gantt->render_table("gantt_tasks_preventivi", "id", "start_date, duration, text, progress, parent, color, textColor"); } ?>

All works well but when I try to insert a link I notice a very strange behaviour: connector tries to insert the link not in gantt_links_preventivi table but in gantt_tasks_preventivi as shown in log file:

====================================
Log started, 15/03/2019 03:09:13

SELECT id,start_date,duration,text,progress,parent,color,textColor,preventivo FROM gantt_tasks_preventivi WHERE preventivo = ‘1’

SELECT id,source,target,type,preventivo FROM gantt_links_preventivi

Done in 0.0015499591827393s

====================================
Log started, 15/03/2019 03:09:22

DataProcessor object initialized
1552658953951_source => 16
1552658953951_target => 19
1552658953951_type => 1
1552658953951_id => 1552658953951
1552658953951_!nativeeditor_status => inserted
ids => 1552658953951

Row data [1552658953951]
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted

adding field: preventivo, with value: 1

Incorrect field name used: start_date

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: start_date

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: duration

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: duration

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: text

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: text

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: progress

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: progress

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: parent

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: parent

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: color

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: color

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: textColor

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

Incorrect field name used: textColor

data
source => 16
target => 19
type => 1
id => 1552658953951
!nativeeditor_status => inserted
preventivo => 1

INSERT INTO gantt_tasks_preventivi(start_date,duration,text,progress,parent,color,textColor,preventivo) VALUES (’’,’’,’’,’’,’’,’’,’’,‘1’)

Exception: PDO - sql execution failed
Incorrect datetime value: ‘’ for column ‘start_date’ at row 1 in /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/db_pdo.php:20
Stack trace:
#0 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/db_common.php(732): PDODBDataWrapper->query(‘INSERT INTO gan…’)
#1 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/dataprocessor.php(221): DBDataWrapper->insert(Object(DataAction), Object(DataRequestConfig))
#2 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/dataprocessor.php(168): DataProcessor->check_exts(Object(DataAction), ‘insert’)
#3 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/dataprocessor.php(97): DataProcessor->inner_process(Object(DataAction))
#4 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/gantt_connector.php(180): DataProcessor->process(Object(DataConfig), Object(DataRequestConfig))
#5 /home/site/public_html/assets/plugins/dhtmlx_gantt/connector/base_connector.php(411): GanttConnector->render()
#6 /home/site/public_html/admin/preventivi/connector.php(24): Connector->render_table(‘gantt_tasks_pre…’, ‘id’, ‘start_date, dur…’)
#7 {main}

Edit operation finished
0 => action:error; sid:1552658953951; tid:1552658953951;

Done in 0.0014891624450684

What happens? I’ve tried everything but I couldn’t figure out where the problem is!
has anyone had this problem?
Thanks


#2

Hello,
Thank you for reporting about the issue. I was able to reproduce it. Looks like, it happens only in the latest version (6.1.1). I told the dev team about it, they will include the fix in the 6.1.2 version. Please, wait until it is released. If you have the Pro/Trial version, you can contact the support team and mention this topic, and we’ll send you the newer version.