Author: mcantelon
Date: Fri Aug 31 17:06:12 2012
New Revision: 12240

Log:
Added handling to resource type column to accessions import.

Modified:
   trunk/lib/task/import/csvAccessionImportTask.class.php

Modified: trunk/lib/task/import/csvAccessionImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvAccessionImportTask.class.php      Fri Aug 31 
17:04:24 2012        (r12239)
+++ trunk/lib/task/import/csvAccessionImportTask.class.php      Fri Aug 31 
17:06:12 2012        (r12240)
@@ -261,19 +261,16 @@
     {
       if ($data)
       {
-        $cvaToQubit = array(
-          'Private records' => 'Private transfer',
-          'Public records'  => 'Public transfer'
-        );
-
         if (isset($self->object) && is_object($self->object))
         {
-          $self->object->resourceTypeId = $self->translateNameToTermId(
-            'resource type',
-            $data,
-            $cvaToQubit,
-            $self->getStatus('resourceTypes')
-          );
+          $term_id = array_search($data, $self->getStatus('resourceTypes'));
+
+          if (!$term_id)
+          {
+            throw new sfException('Could not find a way to handle resource 
type value "'. $data .'".');
+          } else {
+            $self->object->resourceTypeId = $term_id;
+          }
         }
       }
     });
@@ -288,7 +285,7 @@
 
           if (!$term_id)
           {
-            throw new sfException('Could not find a way to handle acquisition 
type value "Transfer".');
+            throw new sfException('Could not find a way to handle acquisition 
type value "'. $data .'".');
           } else {
             $self->object->acquisitionTypeId = $term_id;
           }

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