//only insert provider as note if it's been submitted if ($_POST['providerText'] && !$_POST['organizationID'] && $_POST['resourceStatus'] == 'progress') { $resourceNote->noteText = "Provider: " . $_POST['providerText'] . "\n\n" . $_POST['noteText']; } else { $resourceNote->noteText = $_POST['noteText']; } $resourceNote->save(); } //first remove the organizations if this is a saved request $resource->removeResourceOrganizations(); if ($_POST['organizationID'] && $organizationRoleID) { $resourceOrganizationLink = new ResourceOrganizationLink(); $resourceOrganizationLink->resourceID = $resourceID; $resourceOrganizationLink->organizationID = $_POST['organizationID']; $resourceOrganizationLink->organizationRoleID = $organizationRoleID; $resourceOrganizationLink->save(); } $yearArray = array(); $yearArray = explode(':::', $_POST['years']); $subStartArray = array(); $subStartArray = explode(':::', $_POST['subStarts']); $subEndArray = array(); $subEndArray = explode(':::', $_POST['subEnds']); $fundNameArray = array(); $fundNameArray = explode(':::', $_POST['fundNames']); $paymentAmountArray = array(); $paymentAmountArray = explode(':::', $_POST['paymentAmounts']); $currencyCodeArray = array(); $currencyCodeArray = explode(':::', $_POST['currencyCodes']); $orderTypeArray = array(); $orderTypeArray = explode(':::', $_POST['orderTypes']);
} // Find role $organizationRoles = $organizationRole->getArray(); if (($roleID = array_search($data[$_POST['role']], $organizationRoles)) == 0) { // If role is not found, fallback to the first one. $roleID = '1'; } } // Let's link the resource and the organization. // (this has to be done whether the module Organization is in use or not) if ($organizationID && $roleID) { $organizationLink = new ResourceOrganizationLink(); $organizationLink->organizationRoleID = $roleID; $organizationLink->resourceID = $resource->resourceID; $organizationLink->organizationID = $organizationID; $organizationLink->save(); } } } elseif ($deduping_count == 1) { $resources = $resourceObj->getResourceByIsbnOrISSN($deduping_values); $resource = $resources[0]; } // 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;