Author: mcantelon
Date: Wed Feb 15 16:07:12 2012
New Revision: 10905

Log:
Made tweaks to import rights creation.

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

Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php       Wed Feb 15 15:57:36 
2012        (r10904)
+++ trunk/lib/task/import/csvImportTask.class.php       Wed Feb 15 16:07:12 
2012        (r10905)
@@ -423,16 +423,24 @@
               case 'under copyright':
                 print "Adding rights for ". $self->object->title ."...\n";
                 $rightsHolderId = FALSE;
-                if ($self->rowStatusVars['copyrightHolder'])
+                $rightsHolderName = $self->rowStatusVars['copyrightHolder'];
+                $rightsHolderName = ($rightsHolderName) ? $rightsHolderName : 
'Unknown';
+                $rightsHolder = 
$self->createOrFetchRightsHolder($rightsHolderName);
+                $rightsHolderId = $rightsHolder->id;
+
+                $rightsHolderName = trim(strtolower($rightsHolderName));
+                if (
+                  $rightsHolderName == 'city of vancouver'
+                  || strpos($rightsHolderName, 'city of vancouver') === 0
+                )
                 {
-                  $rightsHolder = $self->createOrFetchRightsHolder(
-                    $self->rowStatusVars['copyrightHolder']
-                  );
-                  $rightsHolderId = $rightsHolder->id;
+                  $restriction = 1;
+                } else {
+                  $restriction = 0;
                 }
 
                 $rightAndRelation = array(
-                  'restriction'       => 1,
+                  'restriction'       => $restriction,
                   'basisId'           => 170,
                   'actId'             => 305,
                   'copyrightStatusId' => array_search(
@@ -451,19 +459,31 @@
                 break;
 
               case 'unknown':
-                $self->createRightAndRelation(array(
-                  'restriction'       => 1,
+                $rightsHolder   = $self->createOrFetchRightsHolder('Unknown');
+                $rightsHolderId = $rightsHolder->id;
+
+                $rightAndRelation = array(
+                  'rightsHolderId'    => $rightsHolderId,
+                  'restriction'       => 0,
                   'basisId'           => 170,
                   'actId'             => 305,
                   'copyrightStatusId' => array_search(
                     'Unknown',
                     $self->getStatus('copyrightStatusTypes')
                   )
-                ));
+                );
+
+                if ($self->rowStatusVars['copyrightExpires'])
+                {
+                  $rightAndRelation['endDate'] = 
$self->rowStatusVars['copyrightExpires'];
+                }
+
+                $self->createRightAndRelation($rightAndRelation);
                 break;
 
               case 'public domain':
-                $self->createRightAndRelation(array(
+
+                $rightAndRelation = array(
                   'restriction'       => 1,
                   'basisId'           => 170,
                   'actId'             => 305,
@@ -471,7 +491,14 @@
                     'Public domain',
                     $self->getStatus('copyrightStatusTypes')
                   )
-                ));
+                );
+
+                if ($self->rowStatusVars['copyrightExpires'])
+                {
+                  $rightAndRelation['endDate'] = 
$self->rowStatusVars['copyrightExpires'];
+                }
+
+                $self->createRightAndRelation($rightAndRelation);
                 break;
 
               default:

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