Author: mcantelon
Date: Thu Dec 29 12:37:39 2011
New Revision: 10465

Log:
Added logic to map import columns to notes without special handlers.

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

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Thu Dec 29 12:29:31 2011        
(r10464)
+++ trunk/lib/task/csvImportTask.class.php      Thu Dec 29 12:37:39 2011        
(r10465)
@@ -93,6 +93,9 @@
         'titleStatementOfResponsibility' => 'titleStatementOfResponsibility',
         'RAD note - statements of responsibility' => 
'statementOfResponsibilityRelatingToPublishersSeries'
       ),
+      'noteMap' => array(
+        'Rad note – conservation' => 231
+      ),
       'rowInit' => function(&$self) {
         $self->information_object = new QubitInformationObject;
       },
@@ -113,13 +116,6 @@
           $self->information_object->save();
         }
 
-        //  add conservation note if specified
-        if (isset($self->rowStatusVars['conservation_note'])) {
-          # NOTE: This creates the note in the DB, but it doesn't show up
-          # on the user side yet
-          $self->createNote(231, $self->rowStatusVars['conservation_note']);
-        }
-
         //  add alpha-numeric designation if specified
         if (isset($self->rowStatusVars['alphanumeric_designation'])) {
           # NOTE: This creates the note in the DB, but it doesn't show up
@@ -161,12 +157,6 @@
       $self->rowStatusVars['start_year'] = $data;
     });
 
-    $import->addColumnHandler('Rad note – conservation', function(&$self, 
$data) {
-      if ($data) {
-        $self->rowStatusVars['conservation_note'] = $data;
-      }
-    });
-
     $import->csv($fh);
   }
 }
@@ -286,6 +276,9 @@
             $row[$index]
           );
         }
+        else if (isset($this->noteMap) && isset($this->noteMap[$columnName])) {
+          $this->createNote($this->noteMap[$columnName], $row[index]);
+        }
         else {
 
           // otherwise, if column is data and a handler is set, use it

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