Page 1 of 1

Insert Error

Posted: Thu May 13, 2021 1:18 pm
by vario
I have a subform which only adds one row at a time. If I add two rows then "Save" I get this entry in zzzzsys_debug and only the first row is saved:

Code: Select all

2021-05-13 12:07:26 - SQL Error in <b>nuRunQuery</b>

<br>

[0] : 
===USER==========

globeadmin

===PDO MESSAGE=== 

SQLSTATE[42000]: Syntax error or access violation: 1110 Column 'calendar_nulog' specified twice

===SQL=========== 

INSERT INTO calendar  (calendar_id, `cal_employee_id`, `calendar_nulog`, `cal_type`, `cal_start`, `cal_end`, `cal_taken`, `cal_paid`, `cal_note`, `calendar_nulog`)  VALUES ('609d086ed1acf5f', 'c4ed0b75996ce3', '', 'XX', '2021-05-12', '2021-05-12', '', '', '', '{\"added\":{\"user\":\"globeadmin\",\"time\":1620904046}}');

===BACK TRACE====

/var/www/forte/core/nudata.php - line 420 (nuRunQuery)

/var/www/forte/core/nuapi.php - line 68 (nuUpdateDatabase)
The table does not have a calendar_nulog column in third position, so not sure where that's coming from. I have added the calendar_nulog column to the subform in order to show details as per https://github.com/nuBuilder/nuBuilder- ... g_activity so perhaps that has some bearing on this?

Neil.

Re: Insert Error

Posted: Thu May 13, 2021 1:28 pm
by kev1n

Re: Insert Error

Posted: Thu May 13, 2021 1:35 pm
by vario
No, tried that but same result. It also has the effect of preventing the tooltip showing nulog details (I used nuSetTooltip rather than NuMessage for showing details)

Re: Insert Error

Posted: Thu May 13, 2021 2:05 pm
by kev1n
Try replacing this line in nudata.php

Code: Select all

if($idx !== false){
with this

Code: Select all

if($idx !== false && ! ($log && substr($fields[$R],-strlen("_nulog"))=== "_nulog")){		//-- valid field names and not nulog column

Re: Insert Error

Posted: Thu May 13, 2021 2:12 pm
by vario
Working now thanks - the nulog column is still defined as "Input".

Re: Insert Error

Posted: Thu May 13, 2021 4:50 pm
by kev1n
This fix is on GIthub now.