// Individual does not exist and is not defined in the import file.
// Or the panel to which is referred is not yet parsed.
// It's assumed that in the import file panels are listed above individuals referring to them.
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): Individual "'.htmlspecialchars($aLine['panelid']).'" does not exist in the database and is not defined (properly) in this import file.<BR>When referring to panels that are also defined in the import file, make sure they are defined above the individuals referring to them. Therefore, make sure that in the import file individual "'.htmlspecialchars($aLine['panelid']).'" is defined above individual "'.htmlspecialchars($aLine['id']).'".');
}
// It is not allowed to import a record where the panelid and id are the same.
// In theory, they could mean to link to the DB entry with this ID, but we're not going to risk that.
if($aLine['panelid']==$aLine['id']){
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The \'Panel ID\' can not link to itself; this field is used to indicate to which panel this individual belongs.');
}elseif(!$bPanelInDB&&!$bPanelInFile){
// Individual does not exist and is not defined in the import file.
// Or the panel to which is referred is not yet parsed.
// It's assumed that in the import file panels are listed above individuals referring to them.
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): Individual "'.htmlspecialchars($aLine['panelid']).'" does not exist in the database and is not defined (properly) in this import file.<BR>When referring to panels that are also defined in the import file, make sure they are defined above the individuals referring to them. Therefore, make sure that in the import file individual "'.htmlspecialchars($aLine['panelid']).'" is defined above individual "'.htmlspecialchars($aLine['id']).'".');
}
// A panel from the import file is preferred, as that describes the new
// panel size to which the new records must conform.
$nPanel=false;
// Find the referred panel in the file first, otherwise check the database.
$nPanel=$_DB->query('SELECT panel_size FROM '.TABLE_INDIVIDUALS.
' WHERE id = ?',array($aLine['panelid']))->fetchColumn();
$nPanelSize=$_DB->query('SELECT panel_size FROM '.TABLE_INDIVIDUALS.' WHERE id = ?',
array($aLine['panelid']))->fetchColumn();
}
if($nPanel!==false&&$nPanel==1){
if($nPanelSize==1){
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): Panel ID "'.htmlspecialchars($aLine['panelid']).'" refers to an individual, not a panel (group of individuals). If you want to configure that individual as a panel, set its \'Panel size\' field to a value higher than 1.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): Panel size of Individual "'.htmlspecialchars($aLine['id']).'" must be lower than the panel size of Individual "'.htmlspecialchars($aLine['panelid']).'".');
// It is not allowed to import a record where the fatherid or motherid are the same as the individual id.
// In theory, they could mean to link to the DB entry with this ID, but we're not going to risk that.
if($aLine[$sParentalField]==$aLine['id']){
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The \''.$sParentalField.'\' can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual.');
@@ -1853,28 +1863,25 @@ if (POST || $_FILES) { // || $_FILES is in use for the automatic loading of file
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): Individual "'.htmlspecialchars($aLine[$sParentalField]).'" does not exist in the database and is not defined (properly) in this import file.<BR>When referring to parents that are also defined in the import file, make sure they are defined above the children referring to them. Therefore, make sure that in the import file individual "'.htmlspecialchars($aLine[$sParentalField]).'" is defined above individual "'.htmlspecialchars($aLine['id']).'".');
}
// It is not allowed to import a record where the fatherid or motherid are the same as the individual id.
if($aLine[$sParentalField]==$aLine['id']){
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The \''.$sParentalField.'\' can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual.');
$zParentData=$_DB->query('SELECT '.($bGenderColumnActive?'':'"" AS ').
'`Individual/Gender`, panel_size FROM '.TABLE_INDIVIDUALS.' WHERE id = ?',
array($aLine[$sParentalField]))->fetchAssoc();
}
if($_DB->query('SELECT ac.colid FROM '.TABLE_ACTIVE_COLS.' AS ac WHERE ac.colid = ?',array('Individual/Gender'))->fetchColumn()){
$zParentData=array();
if($bParentInDB){
$zParentData=$_DB->query('SELECT `Individual/Gender`, panel_size FROM '.TABLE_INDIVIDUALS.' WHERE id = ?',array($aLine[$sParentalField]))->fetchAssoc();
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" refers to an panel (group of individuals), not an individual. If you want to configure that panel as an individual, set its \'Panel size\' field to value 1.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" refers to an panel (group of individuals), not an individual. If you want to configure that panel as an individual, set its \'Panel size\' field to value 1.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" you entered does not refer to a male individual.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" you entered does not refer to a female individual.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" you entered does not refer to a male individual.');
lovd_errorAdd('import','Error ('.$sCurrentSection.', line '.$nLine.'): The '.$sParentalField.' "'.htmlspecialchars($aLine[$sParentalField]).'" you entered does not refer to a female individual.');
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Columns, line 9\): The field [\s\S]col_order[\s\S] must contain a positive integer, "abc" does not match\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Columns, line 9\): Incorrect value for field [\s\S]col_order[\s\S], which needs to be numeric, between 0 and 255\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Columns, line 9\): Incorrect value for field [\s\S]standard[\s\S], which should be 0 or 1\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Columns, line 9\): Select option #3 "yes\(\)[\s\S]* = Consanguineous parents" not understood\.[\s\S]*$/',$bodyText));
...
...
@@ -72,9 +74,7 @@ class FalseInsertImportTest extends LOVDSeleniumWebdriverBaseTestCase
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 48\): Panel size of Individual "00000006" must be lower than the panel size of Individual "00000002"\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 49\): Individual "00000022" does not exist in the database and is not defined \(properly\) in this import file\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 49\): Individual "00000022" does not exist in the database and is not defined \(properly\) in this import file\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 50\): Individual "00000008" does not exist in the database and is not defined \(properly\) in this import file\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 50\): The [\s\S]fatherid[\s\S] can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 50\): Individual "00000008" does not exist in the database and is not defined \(properly\) in this import file\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 50\): The [\s\S]motherid[\s\S] can not link to itself; this field is used to indicate which individual in the database is the parent of the given individual\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 51\): The fatherid "00000002" refers to an panel \(group of individuals\), not an individual\. If you want to configure that panel as an individual, set its [\s\S]Panel size[\s\S] field to value 1\.[\s\S]*$/',$bodyText));
$this->assertTrue((bool)preg_match('/^[\s\S]*Error \(Individuals, line 51\): The motherid "00000002" refers to an panel \(group of individuals\), not an individual\. If you want to configure that panel as an individual, set its [\s\S]Panel size[\s\S] field to value 1\.[\s\S]*$/',$bodyText));