Author: mcantelon
Date: Mon Jan  2 12:24:20 2012
New Revision: 10510

Log:
Added lookup of note types to avoid use of magic numbers.

Modified:
   trunk/lib/task/csvImportTask.class.php

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Mon Jan  2 12:02:37 2012        
(r10509)
+++ trunk/lib/task/csvImportTask.class.php      Mon Jan  2 12:24:20 2012        
(r10510)
@@ -67,6 +67,11 @@
     );
     $defaultStatusTypeId = QubitTerm::STATUS_TYPE_PUBLICATION_ID;
 
+    // Get note type ID => name mapping
+    foreach(QubitFlatfileImport::getTaxomoyTerms(37) as $termId => $term) {
+      $noteTypes[$termId] = $term->name;
+    }
+
     // Define import
     $import = new QubitFlatfileImport(array(
       'columns' => fgetcsv($fh, 60000), // 1st row supplies column names/order
@@ -126,8 +131,8 @@
         'titleProperOfPublishersSeries' => 'titleProperOfPublishersSeries'
       ),
       'noteMap' => array(
-        'radNoteConservation' => array('typeId' => 231),
-        'radNoteGeneral' => array('typeId' => 125),
+        'radNoteConservation' => array('typeId' => array_search('Conservation 
note', $noteTypes)),
+        'radNoteGeneral' => array('typeId' => array_search('General note', 
$noteTypes)),
         'OLD PHOTO NO' => array(
           'typeId' => 247,
           'transformationLogic' => function(&$self, $text)

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