Skip to content

Commit

Permalink
Resources Enhancements: Fix rebase issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
veggiematts committed Apr 20, 2015
1 parent 276c5aa commit 1611b14
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 65 deletions.
59 changes: 0 additions & 59 deletions import.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
**
**************************************************************************************************************************
*/

session_start();
include_once 'directory.php';
//print header
Expand Down Expand Up @@ -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);

Expand All @@ -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?
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 "<h2>Results</h2>";
Expand Down
6 changes: 0 additions & 6 deletions js/forms/resourceUpdateForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,6 @@
});




});



function validateForm (){
myReturn=0;
if (!validateRequired('titleText','<br />Name must be entered to continue.')) myReturn="1";
Expand Down

0 comments on commit 1611b14

Please sign in to comment.