Author: david
Date: Fri Nov 18 17:07:49 2011
New Revision: 10339

Log:
Init some vars, avoid some warnings

Modified:
   trunk/lib/QubitCsvImport.class.php

Modified: trunk/lib/QubitCsvImport.class.php
==============================================================================
--- trunk/lib/QubitCsvImport.class.php  Fri Nov 18 13:07:09 2011        (r10338)
+++ trunk/lib/QubitCsvImport.class.php  Fri Nov 18 17:07:49 2011        (r10339)
@@ -343,21 +343,25 @@
     }
 
     $n = 0;
-    foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
+    $new_placeAccessPoints = $this->places = array();
+    if (0 < strlen($parameters['placeAccessPoints']))
     {
-      // if the place does not exist, create it
-      if (!in_array($new_placeAccessPoint, $this->places) && 
!empty($new_placeAccessPoint))
+      foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
       {
-        $place = new QubitTerm();
-        $place->taxonomyId = QubitTaxonomy::PLACE_ID;
-        $place->name = $new_placeAccessPoint;
-        $place->save();
+        // if the place does not exist, create it
+        if (!in_array($new_placeAccessPoint, $this->places) && 
!empty($new_placeAccessPoint))
+        {
+          $place = new QubitTerm();
+          $place->taxonomyId = QubitTaxonomy::PLACE_ID;
+          $place->name = $new_placeAccessPoint;
+          $place->save();
 
-        $this->places[$place->__toString()] = $place;
-      }
+          $this->places[$place->__toString()] = $place;
+        }
 
-      $new_placeAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->places[$new_placeAccessPoint], 'module' => 'term'));
-      $n++;
+        $new_placeAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->places[$new_placeAccessPoint], 'module' => 'term'));
+        $n++;
+      }
     }
     $parameters['placeAccessPoints'] = $new_placeAccessPoints;
 
@@ -480,20 +484,24 @@
     }
 
     $n = 0;
-    foreach (explode('|', $parameters['creators']) as $new_creator)
+    $new_creators = $this->names = array();
+    if (0 < strlen($parameters['creators']))
     {
-      // if the name does not exist, create it
-      if (!in_array($new_creator, $this->names) && !empty($new_creator))
+      foreach (explode('|', $parameters['creators']) as $new_creator)
       {
-        $name = new QubitActor();
-        $name->authorizedFormOfName = $new_creator;
-        $name->save();
+        // if the name does not exist, create it
+        if (!in_array($new_creator, $this->names) && !empty($new_creator))
+        {
+          $name = new QubitActor();
+          $name->authorizedFormOfName = $new_creator;
+          $name->save();
 
-        $this->names[$name->__toString()] = $name;
-      }
+          $this->names[$name->__toString()] = $name;
+        }
 
-      $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($this->names[$new_creator], 'module' => 'actor'));
-      $n++;
+        $new_creators['new'.$n] = $this->context->routing->generate(null, 
array($this->names[$new_creator], 'module' => 'actor'));
+        $n++;
+      }
     }
     $parameters['creators'] = $new_creators;
 
@@ -598,4 +606,4 @@
     return $this->rootObject;
   }
 
-}
\ No newline at end of file
+}

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to