Author: mcantelon
Date: Fri Jan 27 13:27:07 2012
New Revision: 10756
Log:
Added logic to prevent duplicate rightsholder creation.
Modified:
trunk/lib/task/import/csvImportTask.class.php
Modified: trunk/lib/task/import/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvImportTask.class.php Fri Jan 27 10:02:00
2012 (r10755)
+++ trunk/lib/task/import/csvImportTask.class.php Fri Jan 27 13:27:07
2012 (r10756)
@@ -355,14 +355,18 @@
$rightsHolderId = FALSE;
if ($self->rowStatusVars['copyrightHolder'])
{
- // add rightsholder
- $actor = new QubitRightsHolder;
- $actor->parentId = QubitActor::ROOT_ID;
- $actor->authorizedFormOfName =
$self->rowStatusVars['copyrightHolder'];
- $actor->save();
-
+ $actor =
$self->createOrFetchActor($self->rowStatusVars['copyrightHolder']);
$rightsHolderId = $actor->id;
+ $query = "SELECT id FROM rights_holder WHERE id=?";
+ $statement = $self->sqlQuery($query, array($rightsHolderId));
+ $result = $statement->fetch(PDO::FETCH_OBJ);
+
+ // if actor isn't already a rightsholder, make it one
+ if (!$result) {
+ $query = "INSERT INTO rights_holder (id) VALUES (?)";
+ $statement = $self->sqlQuery($query,
array($rightsHolderId));
+ }
}
$rightAndRelation = array(
'restriction' => 1,
--
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.