Author: david
Date: Wed Jun 13 22:04:56 2012
New Revision: 11770

Log:
Don't attach digital object to an information object that already has one

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

Modified: trunk/lib/task/digitalObjectLoadTask.class.php
==============================================================================
--- trunk/lib/task/digitalObjectLoadTask.class.php      Wed Jun 13 11:45:03 
2012        (r11769)
+++ trunk/lib/task/digitalObjectLoadTask.class.php      Wed Jun 13 22:04:56 
2012        (r11770)
@@ -143,6 +143,15 @@
       $path = $options['path'].$path;
     }
 
+    $sql = 'SELECT id FROM digital_object WHERE information_object_id = ?';
+
+    if (QubitPdo::fetchColumn($sql, array($informationObject->id)))
+    {
+      $this->log(sprintf('Information object id:%s (%s) already has a digital 
object. Skipping.', $informationObject->id, $informationObject->identifier));
+
+      return;
+    }
+
     // read file contents
     if (false === $content = file_get_contents($path))
     {

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