Author: mcantelon
Date: Fri Aug 31 14:23:21 2012
New Revision: 12236

Log:
Added creator(s) import 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 
00:03:11 2012        (r12235)
+++ trunk/lib/task/import/csvAccessionImportTask.class.php      Fri Aug 31 
14:23:21 2012        (r12236)
@@ -172,25 +172,6 @@
         }
       },
 
-      /* import logic to execute before saving accession */
-      'preSaveLogic' => function(&$self)
-      {
-        if ($self->object)
-        {
-          if (
-            isset($self->rowStatusVars['creators'])
-            && $self->rowStatusVars['creators']
-          )
-          {
-            $creators = explode('|', $self->rowStatusVars['creators']);
-            foreach($creators as $creator)
-            {
-              // put some stuff here
-            }
-          }
-        }
-      },
-
       /* import logic to save accession */
       'saveLogic' => function(&$self)
       {
@@ -205,6 +186,25 @@
       {
         if(isset($self->object) && is_object($self->object))
         {
+          if ($self->object)
+          {
+            if (
+              isset($self->rowStatusVars['creators'])
+              && $self->rowStatusVars['creators']
+            )
+            {
+              $creators = explode('|', $self->rowStatusVars['creators']);
+              foreach($creators as $creator)
+              {
+                // fetch/create actor
+                $actor = $self->createOrFetchActor($creator);
+
+                // create relation between accession and creator
+                $self->createRelation($actor->id, $self->object->id, 
QubitTerm::CREATION_ID);
+              }
+            }
+          }
+
           if (
             isset($self->rowStatusVars['DONOR'])
             && $self->rowStatusVars['DONOR']

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