Author: mcantelon
Date: Thu Dec 29 14:39:51 2011
New Revision: 10473

Log:
Added optional transformation logic to note column handling.

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

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Thu Dec 29 14:28:44 2011        
(r10472)
+++ trunk/lib/task/csvImportTask.class.php      Thu Dec 29 14:39:51 2011        
(r10473)
@@ -94,7 +94,7 @@
         'RAD note - statements of responsibility' => 
'statementOfResponsibilityRelatingToPublishersSeries'
       ),
       'noteMap' => array(
-        'Rad note – conservation' => 231
+        'Rad note – conservation' => array('typeId' => 231)
       ),
       'rowInit' => function(&$self) {
         $self->informationObject = new QubitInformationObject;
@@ -322,7 +322,7 @@
       else if (isset($self->noteMap) && isset($self->noteMap[$columnName]) && 
trim($value))
       {
         // otherwise, if maps to a note, create it
-        $self->createNote($self->noteMap[$columnName], $value);
+        $self->createNote($self->noteMap[$columnName]['typeId'], $value);
       }
     });
 
@@ -339,11 +339,14 @@
     }
   }
 
-  public function createNote($typeId, $text)
+  public function createNote($typeId, $text, $transformationLogic = false)
   {
     $note = new QubitNote;
     $note->objectId = $this->informationObject->id;
     $note->typeId = $typeId;
+    if ($transformationLogic) {
+      $text = $transformationLogic(&$this, $text);
+    }
     $note->content = $text;
     $note->scope = 'QubitTerm'; # not sure if this is needed
     $note->save();

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