Author: david
Date: Thu Oct  8 12:31:47 2009
New Revision: 3692

Log:
Complete and test migration of 'display_as_compound_object' property to digital 
object. Fixes issue #1046.

Modified:
   trunk/lib/task/migrate/QubitMigrate107to108.class.php

Modified: trunk/lib/task/migrate/QubitMigrate107to108.class.php
==============================================================================
--- trunk/lib/task/migrate/QubitMigrate107to108.class.php       Thu Oct  8 
12:23:35 2009        (r3691)
+++ trunk/lib/task/migrate/QubitMigrate107to108.class.php       Thu Oct  8 
12:31:47 2009        (r3692)
@@ -668,7 +668,8 @@
    */
   protected function alterQubitProperties()
   {
-    // Change name of language & script properties
+    // Collate language & script properties into serialized array
+    // and change name while were at it
     $tmp = array();
     foreach ($this->data['QubitProperty'] as $key => $value)
     {
@@ -678,7 +679,6 @@
         case 'information_object_script':
         case 'language_of_information_object_description':
         case 'script_of_information_object_description':
-        case 'display_as_compound_object':
           $tmp[$value['object_id']][$value['name']][] = 
$value['value'][$value['source_culture']];
 
           unset($this->data['QubitProperty'][$key]);
@@ -715,21 +715,26 @@
 
             break;
 
-          case 'display_as_compound_object':
-            $this->data['QubitProperty'][$key]['name'] = 'displayAsCompound';
-
-            // Move property from info object to digital object
-            if (null !== ($digitalObjectKey = 
$this->getRowKey('QubitDigitalObject', 'information_object_id', $id)))
-            {
-              $this->data['QubitProperty'][$key]['object_id'] = 
$this->data['QubitDigitalObject'][$digitalObjectKey]['id'];
-            }
-
-            break;
         }
 
         $this->data['QubitProperty'][$key]['value'] = serialize($value);
       }
     }
+
+    // Move 'display_as_compound_object' property from information object to
+    // digital object, and change name & scope while we're at it
+    while ($key = $this->getRowKey('QubitProperty', 'name', 
'display_as_compound_object'))
+    {
+      $this->data['QubitProperty'][$key]['name'] = 'displayAsCompound';
+
+      // Get rid of 'scope', in this case it's repeating data we already have
+      unset($this->data['QubitProperty'][$key]['scope']);
+
+      if ($digitalObjectKey = $this->getRowKey('QubitDigitalObject', 
'information_object_id', $this->data['QubitProperty'][$key]['object_id']))
+      {
+        $this->data['QubitProperty'][$key]['object_id'] = $digitalObjectKey;
+      }
+    }
   }
 
   /**

--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to