View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
04996 | Bug reports | Import/Export | public | 2011-03-03 15:59 | 2011-03-10 12:28 |
Reporter | yohann | Assigned To | lemeur | ||
Priority | high | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.91RC4 | ||||
Fixed in Version | 1.91RC5 | ||||
Summary | 04996: Conditions based on Token attributes are exported in xml but aren't imported | ||||
Description | condition based on token:attribute_1 == constant aren't imported, export give the fallowing: | ||||
Steps To Reproduce | create a condition based on token:attribute | ||||
Tags | No tags attached. | ||||
Attached Files | import_function.patch (2,023 bytes)
--- import_functions.php.orig 2011-03-03 16:05:27.801926002 +0100 +++ import_functions.php 2011-03-03 16:34:45.301926002 +0100 @@ -1404,7 +1404,7 @@ $insertdata[(string)$key]=(string)$value; } // replace the qid for the new one (if there is no new qid in the $aQIDReplacements array it mean that this condition is orphan -> error, skip this record) - if (isset($aQIDReplacements[$insertdata['qid']])) + if (isset($aQIDReplacements[$insertdata['qid']]) ) { $insertdata['qid']=$aQIDReplacements[$insertdata['qid']]; // remap the qid } @@ -1412,11 +1412,18 @@ if (isset($aQIDReplacements[$insertdata['cqid']])) { $insertdata['cqid']=$aQIDReplacements[$insertdata['cqid']]; // remap the qid + list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$insertdata["cfieldname"],3); + } + elseif (strpos($insertdata['cfieldname'], 'TOKEN:ATTRIBUTE_') !== false) // condition is valid but based on token attribute instead of previous question + { + // this is a bit dirty but i don't want to move to much of existing code so i do the sstuff here and then continue + $query=$connect->GetInsertSQL($tablename,$insertdata); + $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg()); + $results['conditions']++; + continue; } else continue; // a problem with this answer record -> don't consider - list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$insertdata["cfieldname"],3); - // replace the gid for the new one in the cfieldname(if there is no new gid in the $aGIDReplacements array it means that this condition is orphan -> error, skip this record) if (!isset($aGIDReplacements[$oldcgid])) continue; import_functions.patch (2,065 bytes)
--- import_functions.php.orig 2011-03-03 16:05:27.801926002 +0100 +++ import_functions.php 2011-03-04 14:41:24.633098003 +0100 @@ -1404,7 +1404,7 @@ $insertdata[(string)$key]=(string)$value; } // replace the qid for the new one (if there is no new qid in the $aQIDReplacements array it mean that this condition is orphan -> error, skip this record) - if (isset($aQIDReplacements[$insertdata['qid']])) + if (isset($aQIDReplacements[$insertdata['qid']]) ) { $insertdata['qid']=$aQIDReplacements[$insertdata['qid']]; // remap the qid } @@ -1412,11 +1412,19 @@ if (isset($aQIDReplacements[$insertdata['cqid']])) { $insertdata['cqid']=$aQIDReplacements[$insertdata['cqid']]; // remap the qid + list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$insertdata["cfieldname"],3); + } + elseif (strpos($insertdata['cfieldname'], 'TOKEN:ATTRIBUTE_') !== false) // condition is valid but based on token attribute instead of previous question + { + // this is a bit dirty but i don't want to move to much of existing code so i do the sstuff here and then continue + unset($insertdata["cid"]); + $query=$connect->GetInsertSQL($tablename,$insertdata); + $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data<br />\$query<br />\n".$connect->ErrorMsg()); + $results['conditions']++; + continue; } else continue; // a problem with this answer record -> don't consider - list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$insertdata["cfieldname"],3); - // replace the gid for the new one in the cfieldname(if there is no new gid in the $aGIDReplacements array it means that this condition is orphan -> error, skip this record) if (!isset($aGIDReplacements[$oldcgid])) continue; | ||||
Bug heat | 8 | ||||
Complete LimeSurvey version number (& build) | 9716 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | firefox | ||||
Database type & version | 145 | ||||
Server OS (if known) | Linux (Ubuntu) | ||||
Webserver software & version (if known) | apache2 | ||||
PHP Version | 5.3.3-1ubuntu9.3 with Suhosin-Patch (cli) (built: Jan 12 2011 16:08:14) | ||||
here is a patch (a bit dirty but works for me) if cqid is 0 it doesn't just skip the condition, but instead look for "TOKEN_ATTRIBUTE" in cfiedname, if there is a string like that we insert conditions data and increment condition counter before we continue |
|
Sorry about the first patch, i forgot to unsed cid so it works the first time, but fail once the id of condidion exists, the second patch is better (one line more which unset cid before insert condition in database) |
|
Fixed in rev 9851 and 9852. |
|
1.91RC5 released. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-03 15:59 | yohann | New Issue | |
2011-03-03 16:45 | yohann | Note Added: 14312 | |
2011-03-03 16:45 | yohann | File Added: import_function.patch | |
2011-03-03 17:23 | limech | Issue Monitored: limech | |
2011-03-07 15:49 | yohann | Issue Monitored: yohann | |
2011-03-07 15:50 | yohann | File Added: import_functions.patch | |
2011-03-07 15:52 | yohann | Note Added: 14317 | |
2011-03-07 15:53 | yohann | Issue End Monitor: yohann | |
2011-03-07 16:55 | Mazi | Assigned To | => lemeur |
2011-03-07 16:55 | Mazi | Status | new => assigned |
2011-03-07 18:35 | lemeur | Note Added: 14321 | |
2011-03-07 18:35 | lemeur | Status | assigned => resolved |
2011-03-07 18:35 | lemeur | Fixed in Version | => 1.91RC5 |
2011-03-07 18:35 | lemeur | Resolution | open => fixed |
2011-03-10 12:28 | c_schmitz | Note Added: 14379 | |
2011-03-10 12:28 | c_schmitz | Status | resolved => closed |
2021-08-02 19:28 | guest | Bug heat | 6 => 8 |