View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
09004Bug reportsCentral participant databasepublic2014-05-02 15:10
ReporterIbistide Assigned Toc_schmitz  
PrioritynormalSeveritypartial_block 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09004: Cannot create new attributes with participant csv import
Description

I can upload CSV files of new participants into my database if I don't try to import fields as new attributes.

But, if I do try to create a new participant attribute, I run into the following issue. The end result is that the 'attribute_name' value is empty and is not included in the SQL INSERT statement, and thus the new record in the table can't be created (because the column 'defaultname' is required.)

If I try to add 2 new fields called "role" and "dateRegistered" with my participant import, when I press the "Continue" button, the page POSTs to the webserver the following info:

Page: http://survey.citiprogram.org/index.php?r=admin/participants/sa/uploadCSV
Form Data:
YII_CSRF_TOKEN=f729c9754ce6d61e62378faaf1ea556dfccc92dc&characterset=auto&separatorused=auto&fullfilepath=ujibb87d5x7surntjk4j&newarray%5Brole%5D=role&newarray%5BdateRegistered%5D=dateRegistered&overwrite=false&filterbea=accept

Then it sends the following command to MS SQL:

declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,N'@P1 nvarchar(2),@P2 nvarchar(5)',N'INSERT INTO [participant_attribute_names] ([attribute_type], [visible]) VALUES (@P1, @P2)',N'TB',N'FALSE'
select @p1

However, this fails with the following SQL error:

Cannot insert the value NULL into column 'defaultname', table 'LIMESURVEY.dbo.participant_attribute_names'; column does not allow nulls. INSERT fails.

The LimeSurvey interface itself doesn't display the error, it just shows "Processing" with a spinning green ring forever. The error is viewable in the 500 response from the webserver (using Chrome's inspector or Firefox's Firebug) & also logged on the SQL server.

Steps To Reproduce

Using the attached file "cantimportthesefields2.csv":

  1. Login to the Admin interface and enter the 'Central Participant Database Panel'. (Also, if desired, open the inspector in your browser to begin viewing net traffic).

  2. Click on 'Import from CSV file'

  3. Choose the cantimportthesefields2.csv file and leave options as default (Auto charset, auto separator, filter blank email addresses = yes). Click Upload.

  4. On the "Select which fields to import as attributes with your participant" screen, drag 'role' and 'dateRegistered' over to the middle column named "Attributes to be created". Click Continue.

  5. Webpage will be stuck on the 'wait' dialog. (If viewing inspector, check the net tab to see the 500 error returned for the POST.)

Additional Information

I am not a programmer, so this is probably overreach on my part, but I guess I am having an issue in the file \application\controllers\admin\participantsaction.php where the $value is not being set to anything; and perhaps because $newarray itself was not set to anything.

foreach ($newarray as $key => $value)

{

    $aData = array('attribute_type' => 'TB', 'attribute_name' => $value, 'visible' => 'FALSE');

My guess is it might have to do with the values in the POST. Some of them match perfectly to the values that are being looked for starting at line 1152.

For example, it's looking for

$characterset = Yii::app()->request->getPost('characterset');
and there is a characterset=auto in the POST.

But, it's also looking for a

$newarray = Yii::app()->request->getPost('newarray');

But there isn't a variable named newarray in the POST, instead their are one or more variable(s) named newarray[something]:

newarray[role]=role
newarray[dateRegistered]=dateRegistered

TagsNo tags attached.
Attached Files
Bug heat2
Complete LimeSurvey version number (& build)140422
I will donate to the project if issue is resolvedNo
BrowserGoogle Chrome 34.0.1847.116 m
Database type & versionServer: MSSQL Server 2012 SP1 Enterprise Edition, Database: Compatability Level 2012, Collation SQL_Latin1_General_CP1_CI_AS
Server OS (if known)Windows 2008 R2 Enterprise
Webserver software & version (if known)IIS 7.5
PHP VersionPHP 5.4.26.0

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2014-05-02 13:12

administrator   ~29935

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=14195

c_schmitz

c_schmitz

2014-05-02 15:10

administrator   ~29948

2.05+ Build 140502 released.

Related Changesets

LimeSurvey: master 4e1d7015

2014-05-02 11:11:53

c_schmitz

Details Diff
Fixed issue 09004: Cannot create new attributes with participant CSV import Affected Issues
09004
mod - application/controllers/admin/participantsaction.php Diff File
mod - application/models/ParticipantAttributeName.php Diff File

Issue History

Date Modified Username Field Change
2014-04-29 19:29 Ibistide New Issue
2014-04-29 19:29 Ibistide File Added: cantimportthesefields2.csv
2014-05-02 00:43 c_schmitz Assigned To => c_schmitz
2014-05-02 00:43 c_schmitz Status new => assigned
2014-05-02 13:11 c_schmitz Status assigned => resolved
2014-05-02 13:11 c_schmitz Fixed in Version => 2.05+
2014-05-02 13:11 c_schmitz Resolution open => fixed
2014-05-02 13:12 c_schmitz Changeset attached => LimeSurvey master 4e1d7015
2014-05-02 13:12 c_schmitz Note Added: 29935
2014-05-02 15:10 c_schmitz Note Added: 29948
2014-05-02 15:10 c_schmitz Status resolved => closed