From f2ebf8f811258d7d6d39d42a1f9084b5d6495fee Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Thu, 15 Feb 2007 15:44:10 +0000 Subject: [PATCH] Fixes again git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.13@1498 839d8a87-29fc-0310-9880-83ba4fa771e5 --- classes/csvimporter.php | 44 ++++++++++++++++++++++++-------------------- modules/axletter.php | 2 +- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/classes/csvimporter.php b/classes/csvimporter.php index d8b00eb..366f7bd 100644 --- a/classes/csvimporter.php +++ b/classes/csvimporter.php @@ -175,11 +175,11 @@ class CSVImporter static $fields, $conds, $values, $thens, $elses; if (!isset($fields)) { - $fields = Env::v('csv_cond_field'); - $conds = Env::v('csv_cond'); - $values = Env::v('csv_cond_value'); - $thens = Env::v('csv_cond_then'); - $elses = Env::v('csv_cond_else'); + $fields = $_SESSION['csv_cond_field']; + $conds = $_SESSION['csv_cond']; + $values = $_SESSION['csv_cond_value']; + $thens = $_SESSION['csv_cond_then']; + $elses = $_SESSION['csv_cond_else']; } $field = $line[$fields[$key]]; $cond = $conds[$key]; @@ -274,12 +274,14 @@ class CSVImporter $next = 'values'; } if ($csv) { - $sep = Env::v('csv_separator'); - if (empty($sep)) { - $sep = ';'; + if (Env::has('csv_separator')) { + $sep = Env::v('csv_separator'); + if (empty($sep)) { + $sep = ';'; + } + $_SESSION['csv_separator'] = $sep; } - $_SESSION['csv_separator'] = $sep; - $this->setCSV($csv, null, $sep); + $this->setCSV($csv, null, $_SESSION['csv_separator']); } if ($current == 'values' && Env::has('csv_valid')) { $next = 'valid'; @@ -291,16 +293,18 @@ class CSVImporter $_SESSION['csv_action'] = Env::v('csv_action'); } if ($next == 'valid') { - $cpyfields = array('csv_value', 'csv_user_value', 'csv_cond_field', - 'csv_update', 'csv_action', 'csv_cond_field', - 'csv_cond', 'csv_cond_value', 'csv_cond_then', - 'csv_cond_else'); - foreach ($cpyfields as $field) { - $_SESSION[$field] = Env::v($field); + if ($current != 'valid') { + $cpyfields = array('csv_value', 'csv_user_value', 'csv_cond_field', + 'csv_update', 'csv_action', 'csv_cond_field', + 'csv_cond', 'csv_cond_value', 'csv_cond_then', + 'csv_cond_else'); + foreach ($cpyfields as $field) { + $_SESSION[$field] = Env::v($field); + } } - $insert = Env::v('csv_value'); - $values = Env::v('csv_user_value'); - $update = Env::v('csv_update'); + $insert = $_SESSION['csv_value']; + $values = $_SESSION['csv_user_value']; + $update = $_SESSION['csv_update']; foreach ($insert as $key=>$value) { if (empty($value)) { $insert[$key] = null; @@ -320,7 +324,7 @@ class CSVImporter $fields[] = $key; } if ($current == 'valid' && Env::has('csv_valid')) { - $this->run(Env::v('csv_action'), $insert, $update); + $this->run($_SESSION['csv_action'], $insert, $update); $page->assign('csv_done', true); $this->cleanSession($sesfields); } else { diff --git a/modules/axletter.php b/modules/axletter.php index fb384ca..114235c 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -312,7 +312,7 @@ class AXLetterModule extends PLModule $importer = new CSVImporter('axletter_ins'); $importer->registerFunction('user_id', 'email vers Id X.org', array($this, 'idFromMail')); $importer->forceValue('hash', array($this, 'createHash')); - $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flags', 'hash')); + $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash')); } function idFromMail($line, $key) -- 2.1.4