Skip to content

Commit

Permalink
Fixed issue #19859: Some broken LSA can not be imported (part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Dec 13, 2024
1 parent 5c7e0b6 commit e0dbb25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2434,6 +2434,7 @@ function XMLImportResponses($sFullFilePath, $iSurveyID, $aFieldReMap = array())
libxml_disable_entity_loader(true);
}
SurveyDynamic::model($iSurveyID)->refreshMetadata();
$survey = Survey::model()->findByAttributes(['sid' => $iSurveyID]); // Avoid caching
if (Yii::app()->db->schema->getTable($survey->responsesTableName) !== null) {
$DestinationFields = Yii::app()->db->schema->getTable($survey->responsesTableName)->getColumnNames();
while ($oXMLReader->read()) {
Expand Down Expand Up @@ -2470,7 +2471,12 @@ function XMLImportResponses($sFullFilePath, $iSurveyID, $aFieldReMap = array())
}
}
}
tracevar($aInsertData);
if ($survey->datestamp == "Y" && empty($aInsertData['startdate'])) {
$aInsertData['startdate'] = "1980-01-01";
}
if (empty($aInsertData['startlanguage'])) {
$aInsertData['startlanguage'] = $survey->language;
}
SurveyDynamic::sid($iSurveyID);
$response = new SurveyDynamic();
$response->setAttributes($aInsertData, false);
Expand Down

0 comments on commit e0dbb25

Please sign in to comment.