Merge commit 'origin/core-1.0.0' into core
authorVincent Zanotti <vincent.zanotti@m4x.org>
Sat, 23 May 2009 21:07:18 +0000 (23:07 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Sat, 23 May 2009 21:07:18 +0000 (23:07 +0200)
1  2 
classes/csvimporter.php

diff --combined classes/csvimporter.php
@@@ -1,6 -1,6 +1,6 @@@
  <?php
  /***************************************************************************
 - *  Copyright (C) 2003-2008 Polytechnique.org                              *
 + *  Copyright (C) 2003-2009 Polytechnique.org                              *
   *  http://opensource.polytechnique.org/                                   *
   *                                                                         *
   *  This program is free software; you can redistribute it and/or modify   *
@@@ -64,12 -64,12 +64,12 @@@ class CSVImporte
          return true;
      }
  
-     private function getValue($line, $partial_ops, $key, $action)
+     static public function getValue($line, $key, $action, $relation = null)
      {
          if (@array_key_exists($action, $line)) {
              $value = $line[$action];
          } elseif (is_callable($action, false)) {
-             $value = call_user_func($action, $line, $partial_ops, $key);
+             $value = call_user_func($action, $line, $key, $relation);
          } else {
              $value = $action;
          }
@@@ -83,7 -83,7 +83,7 @@@
      {
          $ops = array();
          foreach ($relation as $key=>$ref) {
-             $ops[$key] = $this->getValue($line, $ops, $key, $ref);
+             $ops[$key] = $this->getValue($line, $key, $ref, $relation);
          }
          return $ops;
      }
@@@ -92,7 -92,7 +92,7 @@@
      {
          $ops = array();
          foreach ($relation as $key=>$ref) {
-             $value = $this->getValue($line, $ops, $key, $ref);
+             $value = $this->getValue($line, $key, $ref, $relation);
              if (!is_null($value) && $value != 'NULL') {
                  $value = "'" . addslashes($value) . "'";
              }