Author: mcantelon
Date: Wed Jan 4 16:21:59 2012
New Revision: 10561
Log:
Updated rights handling for import to work with new import columns.
Modified:
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Wed Jan 4 15:45:05 2012
(r10560)
+++ trunk/lib/task/csvImportTask.class.php Wed Jan 4 16:21:59 2012
(r10561)
@@ -57,8 +57,6 @@
*/
public function execute($arguments = array(), $options = array())
{
-print ini_get('memory_limit'); exit();
-
if ($options['rows-until-update'] &&
!is_numeric($options['rows-until-update']))
{
throw new sfException('rows-until-update must be an integer');
@@ -257,35 +255,43 @@
}
// add copyright info
- if (isset($self->rowStatusVars['copyrightStatusOrRightsholder']))
+ if (isset($self->rowStatusVars['copyrightStatus']))
{
- $statusOrRightsholder =
$self->rowStatusVars['copyrightStatusOrRightsholder'];
- if ($statusOrRightsholder == 'Public Domain')
+ switch ($self->rowStatusVars['copyrightStatus'])
{
- // add allow record specifiying "Public Domain" for
COPYRIGHT_STATUS
- //
- } else {
- // add rightsholder
- $actor = new QubitRightsHolder;
- $actor->parentId = QubitActor::ROOT_ID;
- $actor->authorizedFormOfName = $statusOrRightsholder;
- $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();
+ case 'under copyright':
+ print "Adding rights for ". $self->informationObject->title
."...\n";
+ if ($self->rowStatusVars['copyrightHolder'])
+ {
+ // add rightsholder
+ $actor = new QubitRightsHolder;
+ $actor->parentId = QubitActor::ROOT_ID;
+ $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();
+ } else {
+ throw new sfException('Copyright holder not specified');
+ }
+ break;
- // add relation
- $relation = new QubitRelation;
- $relation->subjectId = $self->informationObject->id;
- $relation->objectId = $right->id;
- $relation->typeId = QubitTerm::RIGHT_ID;
- $relation->save();
+ default:
+ throw new sfException('Copyright status not handled: adjust
script or import data');
+ break;
}
}
@@ -398,17 +404,22 @@
$self->rowStatusVars['datesOfCreation'] = $data;
});
- $import->addColumnHandler('COPYRIGHT_STATUS', function(&$self, $data)
+ $import->addColumnHandler('copyrightStatus', function(&$self, $data)
{
if (trim($data))
{
- $self->rowStatusVars['copyrightStatusOrRightsholder'] = $data;
+ $self->rowStatusVars['copyrightStatus'] = $data;
}
});
- $import->addColumnHandler('COPYRIGHT_EXPIRES', function(&$self, $data)
+ $import->addColumnHandler('copyrightExpires', function(&$self, $data)
+ {
+ $self->rowStatusVars['copyrightExpires'] = $data;
+ });
+
+ $import->addColumnHandler('copyrightHolder', function(&$self, $data)
{
- $self->rowStatusVars['copyrightExpireYear'] = $data;
+ $self->rowStatusVars['copyrightHolder'] = $data;
});
$import->addColumnHandler('subjectAccessPoints', function(&$self, $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.