From e76590a5497eac667cf9c120f835a330795972ac Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Thu, 6 Aug 2015 22:53:50 -0400 Subject: [PATCH] Fix typo in import.php Fixed bug: Sample not importing due to new sample_var table structure --- admin/import.php | 2 +- functions/functions.import.php | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/admin/import.php b/admin/import.php index b247cb0e..63b8132a 100644 --- a/admin/import.php +++ b/admin/import.php @@ -61,7 +61,7 @@ if (isset($_POST['import_form'])) } else { - print -"

" . T_("Error importing file. Please try again") . "

"; + print "

" . T_("Error importing file. Please try again") . "

"; } } else diff --git a/functions/functions.import.php b/functions/functions.import.php index 0b567a7c..b96fe97f 100644 --- a/functions/functions.import.php +++ b/functions/functions.import.php @@ -204,8 +204,8 @@ function import_file($file, $description, $fields, $firstrow = 2) (sample_import_id, description) VALUES (NULL, '$description')"; - //print("$sql
"); - //if ($db->HasFailedTrans()) { print "FAILED"; exit(); } +// print("$sql
"); +// if ($db->HasFailedTrans()) { print "FAILED"; exit(); } $rs = $db->Execute($sql); $id = $db->Insert_ID(); @@ -234,7 +234,7 @@ function import_file($file, $description, $fields, $firstrow = 2) VALUES ($id,'" . $fields["n_" . substr($key,2)] . "','" . $fields["t_" . substr($key,2)] . "',$restrict)"; $db->Execute($sql); - + $sirv_id[substr($key,2)] = $db->Insert_ID(); // } } @@ -305,6 +305,7 @@ function import_file($file, $description, $fields, $firstrow = 2) VALUES (NULL,'$id','$tzone','$dppid')"; $db->Execute($sql); + $sid = $db->Insert_Id(); @@ -315,11 +316,11 @@ function import_file($file, $description, $fields, $firstrow = 2) { $dkey = $db->Quote($data[$key - 1]); - $sql = "INSERT INTO sample_var (sample_id,var_id,var,val,type) - VALUES ('$sid','{$sirv_id[$key]}','$val',{$dkey},'{$selected_type[$key]}')"; + $sql = "INSERT INTO sample_var (sample_id,var_id,val) + VALUES ('$sid','{$sirv_id[$key]}',{$dkey})"; $db->Execute($sql); - + } $imported++;