View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
06501Bug reportsImport/Exportpublic2012-09-20 14:12
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00RC9 
Fixed in Version2.00RC9 
Summary06501: Import excel with same title for 2 group make Duplicate entry
Description

If there are the same title for 2 group, exporting and importing the survey in excel format make integrity violation.

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '187-en' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO limen_groups (sid, group_name, group_order, randomization_group, grelevance, description, language, gid) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7)

import_helper line 4352
$newgid = Groups::model()->insertRecords($insertdata) or safeDie($clang->gT('Error').": Failed to insert group<br />\<br />\n");

Steps To Reproduce

Try to import excel survey file included

Additional Information

Same think for:

  • 2 question with same title
  • 2 sub question with same title

etc ...

The problem is the test with $gname test : if $gename is same then take the old gid.
I think it's for multi-lingual survey : but it don't work.

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)120819
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionMysql 5
Server OS (if known)debian/linux
Webserver software & version (if known)apache
PHP VersionPHP Version 5.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-08-19 14:30

reporter   ~20521

This is not a bug, but rather the way the Excel import was designed:
(1) Within the primary language:
(a) all question names (column C) must be the unique
(b) all group titles (column C) must be unique
(2) Each additional language must use the same group titles and question names as the primary language - this is how the Excel loader knows how to map the secondary languages to the generated group and question ids for the primary language

http://docs.limesurvey.org/Excel+Survey+Structure#Limitations

DenisChenu

DenisChenu

2012-08-19 14:46

developer   ~20524

If it's a design issue, we have to test if there are integrity violation before inserting group.

TMSWhite

TMSWhite

2012-08-19 14:52

reporter   ~20526

That's an option too. Either way, if the whole survey doesn't load properly, the user should get a message about why it failed to load, and the partially loaded survey should be deleted.

DenisChenu

DenisChenu

2012-08-19 14:59

developer   ~20528

Oups, bad bug number , see http://bugs.limesurvey.org/view.php?id=6502#c20527

For a quick and dirty fix.

DenisChenu

DenisChenu

2012-08-19 19:50

developer   ~20532

Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=9387

Related Changesets

LimeSurvey: Yii 11365e29

2012-08-19 10:46:43

DenisChenu

Details Diff
Fixed issue 06501 : Import excel with same title for 2 group make Duplicate entry
Fixed issue : Import excel make multi sub question with the same code for additional langage
Dev : put an error control on group insertion, don't change excel system : group title have to be the same
Dev : use $gid in fullqname to have same code for question on different group.
Dev : some warning for attribute or default value, don't delete the survey
Affected Issues
06501
mod - application/helpers/admin/import_helper.php Diff File

Issue History

Date Modified Username Field Change
2012-08-19 09:30 DenisChenu New Issue
2012-08-19 09:30 DenisChenu File Added: limesurvey_survey_samegrouptitle.xls
2012-08-19 14:30 TMSWhite Note Added: 20521
2012-08-19 14:30 TMSWhite Status new => feedback
2012-08-19 14:46 DenisChenu Note Added: 20524
2012-08-19 14:46 DenisChenu Status feedback => new
2012-08-19 14:52 TMSWhite Note Added: 20526
2012-08-19 14:59 DenisChenu Note Added: 20528
2012-08-19 17:47 DenisChenu Assigned To => DenisChenu
2012-08-19 17:47 DenisChenu Status new => assigned
2012-08-19 19:50 DenisChenu Changeset attached => LimeSurvey Yii 11365e29
2012-08-19 19:50 DenisChenu Note Added: 20532
2012-08-19 19:50 DenisChenu Resolution open => fixed
2012-08-19 19:55 DenisChenu Status assigned => resolved
2012-08-19 19:55 DenisChenu Fixed in Version => 2.00RC9
2012-09-20 14:12 c_schmitz Status resolved => closed