Author: david
Date: Mon Nov 21 11:58:22 2011
New Revision: 10344

Log:
Standardize access point parsers.  Reverses revision 10339.

Modified:
   trunk/lib/QubitCsvImport.class.php

Modified: trunk/lib/QubitCsvImport.class.php
==============================================================================
--- trunk/lib/QubitCsvImport.class.php  Mon Nov 21 11:31:02 2011        (r10343)
+++ trunk/lib/QubitCsvImport.class.php  Mon Nov 21 11:58:22 2011        (r10344)
@@ -317,7 +317,7 @@
     $n = 0;
     foreach (explode('|', $parameters['subjectAccessPoints']) as 
$new_subjectAccessPoint)
     {
-      if (0 == strlen($new_subjectAccessPoint))
+      if (0 == strlen(trim($new_subjectAccessPoint)))
       {
         continue;
       }
@@ -348,25 +348,26 @@
     }
 
     $n = 0;
-    $new_placeAccessPoints = $this->places = array();
-    if (0 < strlen($parameters['placeAccessPoints']))
+    foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
     {
-      foreach (explode('|', $parameters['placeAccessPoints']) as 
$new_placeAccessPoint)
+      if (0 == strlen(trim($new_placeAccessPoint)))
       {
-        // 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();
+        continue;
+      }
 
-          $this->places[$place->__toString()] = $place;
-        }
+      // 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();
 
-        $new_placeAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->places[$new_placeAccessPoint], 'module' => 'term'));
-        $n++;
+        $this->places[$place->__toString()] = $place;
       }
+
+      $new_placeAccessPoints['new'.$n] = 
$this->context->routing->generate(null, 
array($this->places[$new_placeAccessPoint], 'module' => 'term'));
+      $n++;
     }
     $parameters['placeAccessPoints'] = $new_placeAccessPoints;
 

-- 
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