Author: mcantelon
Date: Tue Jan  3 16:56:03 2012
New Revision: 10552

Log:
Roughed out rights creation for import.

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

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Tue Jan  3 15:58:02 2012        
(r10551)
+++ trunk/lib/task/csvImportTask.class.php      Tue Jan  3 16:56:03 2012        
(r10552)
@@ -245,6 +245,54 @@
           );
         }
 
+        // add copyright info
+        if (isset($self->rowStatusVars['copyrightStatusOrRightsholder']))
+        {
+          $statusOrRightsholder = 
$self->rowStatusVars['copyrightStatusOrRightsholder'];
+          if ($statusOrRightsholder == 'Public Domain')
+          {
+            // add allow record specifiying "Public Domain" for 
COPYRIGHT_STATUS
+            //
+          } else {
+print 'Creating right for '. $self->informationObject->title ."\n";
+            // add "Disallow" record for act "Replicate" specifiy 
COPYRIGHT_STATUS for "Rights Holder" (createActor)
+
+            $actor = new QubitRightsHolder;
+            $actor->parentId = QubitActor::ROOT_ID;
+            $actor->authorizedFormOfName = $statusOrRightsholder;
+            $actor->save();
+
+            /*
+            $actor = $self->createOrFetchActor($statusOrRightsholder);
+
+            $query = "SELECT id FROM rights_holder WHERE id=?";
+            $statement = $self->sqlQuery($query, array($actor->id));
+
+print 'Q:'. $query ." | ". $actor->id ."\n";
+            if (!($term = $statement->fetch(PDO::FETCH_OBJ)))
+            {
+              $rightsHolder = new QubitRightsHolder;
+              $rightsHolder->id = $actor->id;
+              $rightsHolder->save();
+            }
+            */
+
+            $right = new QubitRights;
+            $right->restriction = 1;
+            $right->rightsHolderId = $actor->id;
+            $right->basisId = 170;
+            $right->actId = 305;
+            $right->copyrightStatusId = 306;
+            $right->save();
+
+            $relation = new QubitRelation;
+            $relation->subjectId = $self->informationObject->id;
+            $relation->objectId = $right->id;
+            $relation->typeId = QubitTerm::RIGHT_ID;
+            $relation->save();
+          }
+        }
+
         if (isset($self->rowStatusVars['creators'])
           && count($self->rowStatusVars['creators']))
         {
@@ -337,6 +385,16 @@
       $self->rowStatusVars['datesOfCreation'] = $data;
     });
 
+    $import->addColumnHandler('COPYRIGHT_STATUS', function(&$self, $data)
+    {
+      $self->rowStatusVars['copyrightStatusOrRightsholder'] = $data;
+    });
+
+    $import->addColumnHandler('COPYRIGHT_EXPIRES', function(&$self, $data)
+    {
+      $self->rowStatusVars['copyrightExpireYear'] = $data;
+    });
+
     $import->addColumnHandler('subjectAccessPoints', function(&$self, $data)
     {
       if ($data)

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