Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports: Allow for a Native XML file to be imported if the primary contact ID is not provided #9862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kennydude
Copy link

This pull request includes a fix for an edge case where importing native XML which does not contain a primary contact as it would throw a SQL integrity constraint error.

@CLAassistant
Copy link

CLAassistant commented Apr 3, 2024

CLA assistant check
All committers have signed the CLA.

@asmecher
Copy link
Member

asmecher commented Apr 5, 2024

@defstat, could you please take a look at this one?

Copy link
Contributor

@defstat defstat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kennydude thanks so much for your contribution. Just one minor syntax change and it is ready to be merged!

@@ -88,7 +88,10 @@ public function handleElement($node)
$publicationId = Repo::publication()->dao->insert($publication);
$publication = Repo::publication()->get($publicationId);
// Non-persisted temporary ID, will be updated and stored once the authors get parsed
$publication->setData('primaryContactId', $node->getAttribute('primary_contact_id'));
$pci = $node->getAttribute('primary_contact_id');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do it like this

if ($pci = $node->getAttribute('primary_contact_id')) {
   $publication->setData('primaryContactId', $pci);
}

to match other places in the code base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants