Author: mcantelon
Date: Fri Apr 13 12:43:52 2012
New Revision: 11440

Log:
Added suppot for qubitParentId column when importing information objects to a 
parent that has been created in the Qubit UI rather than by another import.

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

Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php       Fri Apr 13 10:13:59 
2012        (r11439)
+++ trunk/lib/task/import/csvImportTask.class.php       Fri Apr 13 12:43:52 
2012        (r11440)
@@ -254,6 +254,7 @@
       'variableColumns' => array(
         'legacyId',
         'parentId',
+        'qubitParentId',
         'descriptionStatus',
         'publicationStatus',
         'levelOfDetail',
@@ -350,24 +351,32 @@
 
         $self->object->setPublicationStatus($pubStatusTermId);
 
-        if (isset($self->rowStatusVars['parentId']) && 
!$self->rowStatusVars['parentId'])
+        if (
+          isset($self->rowStatusVars['qubitParentId'])
+          && $self->rowStatusVars['qubitParentId']
+        )
         {
-          $parentId = QubitInformationObject::ROOT_ID;
+          $parentId = $self->rowStatusVars['qubitParentId'];
         } else {
-          if ($mapEntry = $self->fetchKeymapEntryBySourceAndTargetName(
-            $self->rowStatusVars['parentId'],
-            $self->getStatus('sourceName'),
-            'information_object'
-          ))
+          if (isset($self->rowStatusVars['parentId']) && 
!$self->rowStatusVars['parentId'])
           {
-            $parentId = $mapEntry->target_id;
+            $parentId = QubitInformationObject::ROOT_ID;
           } else {
-            $error = 'For legacyId '
-              . $self->rowStatusVars['legacyId']
-              .' Could not find parentId '
-              . $self->rowStatusVars['parentId']
-              .' in key_map table';
-            print $self->logError($error);
+            if ($mapEntry = $self->fetchKeymapEntryBySourceAndTargetName(
+              $self->rowStatusVars['parentId'],
+              $self->getStatus('sourceName'),
+              'information_object'
+            ))
+            {
+              $parentId = $mapEntry->target_id;
+            } else {
+              $error = 'For legacyId '
+                . $self->rowStatusVars['legacyId']
+                .' Could not find parentId '
+                . $self->rowStatusVars['parentId']
+                .' in key_map table';
+              print $self->logError($error);
+            }
           }
         }
 

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