View Issue Details

This issue affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
12740Bug reportsImport/Exportpublic2017-10-23 11:51
ReporterTonisOrmisson Assigned ToLouisGac 
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version3.0.0-beta.x 
Summary12740: Error saving groups while importing survey
Description

Imported a very simple survey from 2.7x version to latest develop brancg and got the error described below

Additional Information

CDbException

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

/var/www/html/uuring4/framework/db/CDbCommand.php(358)

346 {
347 if($this->_connection->enableProfiling)
348 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute');
349
350 $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
351 $message=$e->getMessage();
352 Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
353 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
354
355 if(YII_DEBUG)
356 $message.='. The SQL statement executed was: '.$this->getText().$par;
357
358 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
359 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
360 }
361 }
362
363 /*
364
Executes the SQL statement and returns query result.
365 This method is for executing an SQL query that returns result set.
366
@param array $params input parameters (name=>value) for the SQL execution. This is an alternative
367 to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
368
them in this way can improve the performance. Note that if you pass parameters in this way,
369 you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
370
Please also note that all values are treated as strings in this case, if you need them to be handled as
Stack Trace
#0

  • /var/www/html/uuring4/framework/db/ar/CActiveRecord.php(1083): CDbCommand->execute()
    #1
  • /var/www/html/uuring4/framework/db/ar/CActiveRecord.php(811): CActiveRecord->insert(null)
    #2
    – /var/www/html/uuring4/application/models/QuestionGroup.php(141): CActiveRecord->save()
    136 {
    137 $group = new self;
    138 foreach ($data as $k => $v){
    139 $group->$k = $v;
    140 }
    141 if (!$group->save()){
    142 return false;
    143 }
    144 else {
    145 return $group->gid;
    146 }
    #3
    – /var/www/html/uuring4/application/helpers/admin/import_helper.php(1010): QuestionGroup->insertRecords(array("sid" => "283725", "group_name" => "kysimused", "group_order" => "1", "description" => "", ...))
    1005 if (isset($aGIDReplacements[$oldgid]))
    1006 {
    1007 switchMSSQLIdentityInsert('groups',true);
    1008 $insertdata['gid']=$aGIDReplacements[$oldgid];
    1009 }
    1010 $newgid = QuestionGroup::model()->insertRecords($insertdata) or safeDie(gT("Error").": Failed to insert data [3]
    ");
    1011 if (!isset($aGIDReplacements[$oldgid]))
    1012 {
    1013 $aGIDReplacements[$oldgid]=$newgid; // add old and new qid to the mapping array
    1014 $results['groups']++;
    1015 }
    #4
    – /var/www/html/uuring4/application/helpers/admin/import_helper.php(730): XMLImportSurvey("/var/www/html/uuring4/tmp/hi48fbmepmewdk6n4bjiahidpfm4ei.lss", null, null, null, ...)
    725 {
    726 $sExtension = "";
    727 }
    728 if ($sExtension == 'lss')
    729 {
    730 return XMLImportSurvey($sFullFilePath, null, $sNewSurveyName, $DestSurveyID, $bTranslateLinksFields);
    731 }
    732 elseif ($sExtension == 'txt' || $sExtension == 'tsv')
    733 {
    734 return TSVImportSurvey($sFullFilePath);
    735 }
    #5
    – /var/www/html/uuring4/application/controllers/admin/surveyadmin.php(1294): importSurveyFile("/var/www/html/uuring4/tmp/hi48fbmepmewdk6n4bjiahidpfm4ei.lss", true)
    1289 // Now, we have the survey : start importing
    1290 Yii::app()->loadHelper('admin/import');
    1291
    1292 if ($action == 'importsurvey' && !$aData['bFailed'])
    1293 {
    1294 $aImportResults=importSurveyFile($sFullFilepath,(Yii::app()->request->getPost('translinksfields')=='1'));
    1295 if (is_null($aImportResults))
    1296 {
    1297 $aImportResults=array(
    1298 'error'=>gT("Unknown error while reading the file, no survey created.")
    1299 );
    #6
    unknown(0): SurveyAdmin->copy()
    #7
    – /var/www/html/uuring4/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs(SurveyAdmin, array())
    104 elseif($param->isDefaultValueAvailable())
    105 $ps[]=$param->getDefaultValue();
    106 else
    107 return false;
    108 }
    109 $method->invokeArgs($object,$ps);
    110 return true;
    111 }
    112 }
    #8
    – /var/www/html/uuring4/application/core/Survey_Common_Action.php(87): CAction->runWithParamsInternal(SurveyAdmin, ReflectionMethod, array("r" => "admin/survey/sa/copy", "sa" => "copy"))
    82 $oMethod = new ReflectionMethod($this, $sDefault);
    83 }
    84
    85 // We're all good to go, let's execute it
    86 // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
    87 return parent::runWithParamsInternal($this, $oMethod, $params);
    88 }
    89
    90 /
    91 Some functions have different parameters, which are just an alias of the
    92
    usual parameters we're getting in the url. This function just populates
    #9
    – /var/www/html/uuring4/framework/web/CController.php(308): Survey_Common_Action->runWithParams(array("r" => "admin/survey/sa/copy", "sa" => "copy"))
    303 {
    304 $priorAction=$this->_action;
    305 $this->_action=$action;
    306 if($this->beforeAction($action))
    307 {
    308 if($action->runWithParams($this->getActionParams())===false)
    309 $this->invalidActionParams($action);
    310 else
    311 $this->afterAction($action);
    312 }
    313 $this->_action=$priorAction;
    #10
    – /var/www/html/uuring4/framework/web/CController.php(286): CController->runAction(SurveyAdmin)
    281 @see runAction
    282
    /
    283 public function runActionWithFilters($action,$filters)
    284 {
    285 if(empty($filters))
    286 $this->runAction($action);
    287 else
    288 {
    289 $priorAction=$this->_action;
    290 $this->_action=$action;
    291 CFilterChain::create($this,$action,$filters)->run();
    #11
    – /var/www/html/uuring4/framework/web/CController.php(265): CController->runActionWithFilters(SurveyAdmin, array())
    260 {
    261 if(($parent=$this->getModule())===null)
    262 $parent=Yii::app();
    263 if($parent->beforeControllerAction($this,$action))
    264 {
    265 $this->runActionWithFilters($action,$this->filters());
    266 $parent->afterControllerAction($this,$action);
    267 }
    268 }
    269 else
    270 $this->missingAction($actionID);
    #12
    – /var/www/html/uuring4/application/controllers/AdminController.php(179): CController->run("survey")
    174 $this->redirect(array('/admin/authentication/sa/login'));
    175 }
    176 }
    177 }
    178
    179 return parent::run($action);
    180 }
    181
    182 /

    183 Routes all the actions to their respective places
    184

    #13
    – /var/www/html/uuring4/framework/web/CWebApplication.php(282): AdminController->run("survey")
    277 {
    278 list($controller,$actionID)=$ca;
    279 $oldController=$this->_controller;
    280 $this->_controller=$controller;
    281 $controller->init();
    282 $controller->run($actionID);
    283 $this->_controller=$oldController;
    284 }
    285 else
    286 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".',
    287 array('{route}'=>$route===''?$this->defaultController:$route)));
    #14
    – /var/www/html/uuring4/framework/web/CWebApplication.php(141): CWebApplication->runController("admin/survey/sa/copy")
    136 foreach(array_splice($this->catchAllRequest,1) as $name=>$value)
    137 $_GET[$name]=$value;
    138 }
    139 else
    140 $route=$this->getUrlManager()->parseUrl($this->getRequest());
    141 $this->runController($route);
    142 }
    143
    144 /
    145 Registers the core application components.
    146
    This method overrides the parent implementation by registering additional core components.
    #15
    – /var/www/html/uuring4/framework/base/CApplication.php(185): CWebApplication->processRequest()
    180 public function run()
    181 {
    182 if($this->hasEventHandler('onBeginRequest'))
    183 $this->onBeginRequest(new CEvent($this));
    184 register_shutdown_function(array($this,'end'),0,false);
    185 $this->processRequest();
    186 if($this->hasEventHandler('onEndRequest'))
    187 $this->onEndRequest(new CEvent($this));
    188 }
    189
    190 /

    #16
    – /var/www/html/uuring4/index.php(195): CApplication->run()
    190 require_once APPPATH . 'core/LSYii_Application' . EXT;
    191
    192 $config = require_once(APPPATH . 'config/internal' . EXT);
    193
    194 Yii::$enableIncludePath = false;
    195 Yii::createApplication('LSYii_Application', $config)->run();
    196
    197 / End of file index.php /
    198 / Location: ./index.php /
    2017-10-03 14:17:16 nginx/1.10.3 Yii Framework/1.1.18
TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)Version 3.0.0-beta.3
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmariadb
Server OS (if known)ubuntu
Webserver software & version (if known)nginx
PHP Version5.6

Users monitoring this issue

There are no users monitoring this issue.

Activities

LouisGac

LouisGac

2017-10-23 11:51

developer   ~44794

no lss file to test, but it should be fixed by now

Issue History

Date Modified Username Field Change
2017-10-03 13:44 TonisOrmisson New Issue
2017-10-23 10:49 LouisGac Assigned To => LouisGac
2017-10-23 10:49 LouisGac Status new => assigned
2017-10-23 11:51 LouisGac Status assigned => closed
2017-10-23 11:51 LouisGac Resolution open => fixed
2017-10-23 11:51 LouisGac Note Added: 44794