From f1c54ddd40069e77d281c002d8f0e3b44d965c91 Mon Sep 17 00:00:00 2001
From: Alex
Date: Mon, 21 Dec 2015 20:31:19 +0300
Subject: [PATCH] fix lp: 1527201
---
admin/samplelist.php | 21 +++++++--------------
functions/functions.import.php | 13 ++++---------
2 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/admin/samplelist.php b/admin/samplelist.php
index b34152ac..3bd72fa7 100644
--- a/admin/samplelist.php
+++ b/admin/samplelist.php
@@ -89,13 +89,9 @@ if (isset($_POST['ed']))
unset($_POST['ed']);
unset($_POST['sample_import_id']);
-
-// print_r($_POST). ""; //посмотрим чего отравляется
if (isset($_POST['del']) && isset($_POST['type']) ) {
$a = array(); $b = array(); $cert = array(); $a = $_POST['type'];
-
- //echo " type before unset->>"; foreach($_POST['type'] as $key => $val) { echo ' | ', $key,' => ',$val,' | '; }; print "
";
foreach($_POST['del'] as $p) {
unset ($_POST['type'][$p]);
@@ -110,7 +106,6 @@ if (isset($_POST['ed']))
}
/* else { echo "", T_("You can delete string '$key'. "), "
"; } */
}
- //echo "del ->>"; foreach($_POST['del'] as $key => $val) { echo ' | ', $key,' => ',$val,' | '; }; print "
";
}
if (isset($_POST['type'])){
@@ -136,7 +131,7 @@ if (isset($_POST['ed']))
if ($eml < 2) {$ch4 = true;}
else { echo "", T_("Too many e-mail fields. Please check selected types for E-mail."), "
"; }
- if ($ch1 && $ch2 && $ch3 && $ch4) */$typecheck = true; //echo $ch1,$ch2,$ch3,$ch4, "typecheck=",$typecheck, "" ;
+ if ($ch1 && $ch2 && $ch3 && $ch4) */$typecheck = true;
if ($typecheck){
@@ -178,11 +173,10 @@ if (isset($_POST['ed']))
if (isset($_POST['var'])){
foreach($_POST['var'] as $p => $val)
- {// echo '| ',$p,' => ',$val,'+ ';
- $v = str_replace(" ", "_", $val);
-
+ {
+ $val = str_replace(array(" ,",", ",","," "," "),"_", $val);
$sql = "UPDATE sample_import_var_restrict
- SET `var` = '$v'
+ SET `var` = '$val'
WHERE sample_import_id = $sample_import_id
AND `var_id` = $p";
$db->Execute($sql);
@@ -199,7 +193,7 @@ if (isset($_POST['ed']))
$db->Execute($sql);
foreach($_POST['see'] as $p => $val)
- {// echo $p,' => ',$val,' + ';
+ {
$sql = "UPDATE sample_import_var_restrict
SET `restrict` = 0
WHERE sample_import_id = $sample_import_id
@@ -300,7 +294,7 @@ if (isset($_GET['edit']) )
$rd = $db->GetAll($sql);
$sql = "SELECT sir.var_id,
- CONCAT('') as var,
+ CONCAT('') as var,
CONCAT ('
";
+ if($sd['enabled'] == 0) print "" . T_("Select which fields from this sample to deidentify.
Deidentified fields will be permanently deleted from the sample.") . "
";
}
else
{
@@ -391,7 +385,6 @@ else
$rs = $db->GetAll($sql);
if (!empty($rs)) {
$count = count($rs);
- //print_r($rs);
print "" . T_("Fix this sample ") . "
";
print "
" . $count . " var id's not match
";
diff --git a/functions/functions.import.php b/functions/functions.import.php
index b96fe97f..83989f81 100644
--- a/functions/functions.import.php
+++ b/functions/functions.import.php
@@ -136,7 +136,7 @@ function display_table($data)
foreach ($data as $key => $value)
{
- $val = str_replace(" ", "_", $value);
+ $val = str_replace(array(" ,",", ",","," "," "),"_", $value);
$checked = "checked";
if (empty($val)) $val = "samp_$row";
@@ -219,19 +219,14 @@ function import_file($file, $description, $fields, $firstrow = 2)
if (strncmp($key, "i_", 2) == 0)
{
$selected_type[substr($key,2)] = $fields["t_" . substr($key,2)];
- $selected_name[substr($key,2)] = $fields["n_" . substr($key,2)];
-
- $restrict = 1;
+ $selected_name[substr($key,2)] = str_replace(array(" ,",", ",","," "," "),"_", $fields["n_" . substr($key,2)]);
//Set restrictions on columns
- if (isset($fields["a_" . substr($key,2)]))
- {
- $restrict = 0;
- }
+ if (isset($fields["a_" . substr($key,2)])) $restrict = 0; else $restrict = 1;
$sql = "INSERT INTO sample_import_var_restrict
(`sample_import_id`,`var`,`type`,`restrict`)
- VALUES ($id,'" . $fields["n_" . substr($key,2)] . "','" . $fields["t_" . substr($key,2)] . "',$restrict)";
+ VALUES ($id,'" . $selected_name[substr($key,2)] . "','" . $selected_type[substr($key,2)] . "',$restrict)";
$db->Execute($sql);