Author: mcantelon
Date: Fri Jan 6 17:33:03 2012
New Revision: 10595
Log:
Added createRightAndRelation method for import class and add support for
creating public domain records.
Modified:
trunk/lib/QubitFlatfileImport.class.php
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php Fri Jan 6 16:14:58 2012
(r10594)
+++ trunk/lib/QubitFlatfileImport.class.php Fri Jan 6 17:33:03 2012
(r10595)
@@ -459,6 +459,33 @@
return $terms;
}
+ public function createRightAndRelation($options)
+ {
+ // add right
+ $right = new QubitRights;
+
+ $allowedOptions = array(
+ 'rightsHolderId',
+ 'restriction',
+ 'basisId',
+ 'actId',
+ 'copyrightStatusId'
+ );
+
+ $this->setPropertiesFromArray($right, $options, $allowedOptions);
+
+ $right->save();
+
+ // add relation
+ $relation = new QubitRelation;
+ $relation->subjectId = $this->informationObject->id;
+ $relation->objectId = $right->id;
+ $relation->typeId = QubitTerm::RIGHT_ID;
+ $relation->save();
+
+ return $relation;
+ }
+
public function appendWithLineBreakIfNeeded($oldContent, $newContent)
{
return ($oldContent) ? $oldContent ."\n". $newContent : $newContent;
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Fri Jan 6 16:14:58 2012
(r10594)
+++ trunk/lib/task/csvImportTask.class.php Fri Jan 6 17:33:03 2012
(r10595)
@@ -299,7 +299,7 @@
// add copyright info
if (isset($self->rowStatusVars['copyrightStatus']) &&
$self->rowStatusVars['copyrightStatus'])
{
- switch ($self->rowStatusVars['copyrightStatus'])
+ switch (strtolower($self->rowStatusVars['copyrightStatus']))
{
case 'under copyright':
print "Adding rights for ". $self->informationObject->title
."...\n";
@@ -311,26 +311,27 @@
$actor->authorizedFormOfName =
$self->rowStatusVars['copyrightHolder'];
$actor->save();
- // add "Disallow" record for act "Replicate"
- $right = new QubitRights;
- $right->restriction = 1;
- $right->rightsHolderId = $actor->id;
- $right->basisId = 170;
- $right->actId = 305;
- $right->copyrightStatusId = 306;
- $right->save();
-
- // add relation
- $relation = new QubitRelation;
- $relation->subjectId = $self->informationObject->id;
- $relation->objectId = $right->id;
- $relation->typeId = QubitTerm::RIGHT_ID;
- $relation->save();
+ $self->createRightAndRelation(array(
+ 'rightsHolderId' => $actor->id,
+ 'restriction' => 1,
+ 'basisId' => 170,
+ 'actId' => 305,
+ 'copyrightStatusId' => 306
+ ));
} else {
throw new sfException('Copyright holder not specified');
}
break;
+ case 'public domain':
+ $self->createRightAndRelation(array(
+ 'restriction' => 1,
+ 'basisId' => 170,
+ 'actId' => 305,
+ 'copyrightStatusId' => 307
+ ));
+ break;
+
default:
throw new sfException('Copyright status "'
. $self->rowStatusVars['copyrightStatus']
--
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.