diff --git a/import.php b/import.php index a3560a5..990cc24 100644 --- a/import.php +++ b/import.php @@ -16,7 +16,6 @@ ** ************************************************************************************************************************** */ - session_start(); include_once 'directory.php'; //print header @@ -98,19 +97,11 @@ unset($deduping_values); $resource = new Resource(); $resourceObj = new Resource(); -<<<<<<< HEAD -======= - ->>>>>>> R17702: Add repeatable parent resources. foreach ($deduping_columns as $value) { $deduping_values[] = $data[$value]; } $deduping_count = count($resourceObj->getResourceByIsbnOrISSN($deduping_values)); if ($deduping_count == 0) { -<<<<<<< HEAD -======= - ->>>>>>> R17702: Add repeatable parent resources. // Convert to UTF-8 $data = array_map(function($row) { return mb_convert_encoding($row, 'UTF-8'); }, $data); @@ -125,7 +116,6 @@ $resource->providerText = $data[$_POST['providerText']]; $resource->statusID = 1; $resource->save(); -<<<<<<< HEAD $resource->setIsbnOrIssn($deduping_values); $inserted++; // Do we have to create an organization or attach the resource to an existing one? @@ -221,15 +211,10 @@ $organizationLink->save(); } } -======= - - $inserted++; ->>>>>>> R17702: Add repeatable parent resources. } elseif ($deduping_count == 1) { $resources = $resourceObj->getResourceByIsbnOrISSN($deduping_values); $resource = $resources[0]; } -<<<<<<< HEAD // Do we have a parent resource to create? if ($data[$_POST['parentResource']] && ($deduping_count == 0 || $deduping_count == 1) ) { // Search if such parent exists @@ -263,50 +248,6 @@ } } } -======= - - // Do we have a parent resource to create? - if ($data[$_POST['parentResource']] && ($deduping_count == 0 || $deduping_count == 1) ) { - - // Search if such parent exists - $numberOfParents = count($resourceObj->getResourceByTitle($data[$_POST['parentResource']])); - $parentID = null; - if ($numberOfParents == 0) { - // If not, create parent - $parentResource = new Resource(); - $parentResource->createLoginID = $loginID; - $parentResource->createDate = date( 'Y-m-d' ); - $parentResource->titleText = $data[$_POST['parentResource']]; - $parentResource->statusID = 1; - $parentResource->save(); - $parentID = $parentResource->resourceID; - - $parentInserted++; - - } elseif ($numberOfParents == 1) { - // Else, attach the resource to its parent. - $parentResource = $resourceObj->getResourceByTitle($data[$_POST['parentResource']]); - $parentID = $parentResource[0]->resourceID; - - $parentAttached++; - } - - if ($numberOfParents == 0 || $numberOfParents == 1) { - $resourceRelationship = new ResourceRelationship(); - $resourceRelationship->resourceID = $resource->resourceID; - $resourceRelationship->relatedResourceID = $parentID; - $resourceRelationship->relationshipTypeID = '1'; //hardcoded because we're only allowing parent relationships - if (!$resourceRelationship->exists()) { - $resourceRelationship->save(); - } - } - - } - - - - } ->>>>>>> R17702: Add repeatable parent resources. $row++; } print "