Skip to content

Commit

Permalink
Fix export error
Browse files Browse the repository at this point in the history
  • Loading branch information
Antti-Jussi Nygård authored and Antti-Jussi Nygård committed Mar 6, 2024
1 parent 2c0eb80 commit a9bfef8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions FundingPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use APP\pages\submission\SubmissionHandler;
use APP\submission\Submission;
use APP\template\TemplateManager;
use APP\facades\Repo;
use PKP\db\DAORegistry;

import('lib.pkp.classes.plugins.GenericPlugin');
Expand Down Expand Up @@ -304,23 +305,25 @@ function addCrossrefElement($hookName, $params) {
$context = $request->getContext();
$funderDAO = DAORegistry::getDAO('FunderDAO');
$funderAwardDAO = DAORegistry::getDAO('FunderAwardDAO');
$submissionDao = DAORegistry::getDAO('SubmissionDAO');

$crossrefFRNS = 'http://www.crossref.org/fundref.xsd';
$rootNode=$preliminaryOutput->documentElement;
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:fr', $crossrefFRNS);
$articleNodes = $preliminaryOutput->getElementsByTagName('journal_article');
foreach ($articleNodes as $articleNode) {
$doiDataNode = $articleNode->getElementsByTagName('doi_data')->item(0);

$aiProgramDataNode = $articleNode->getElementsByTagNameNS('http://www.crossref.org/AccessIndicators.xsd', 'program')->item(0);
$doiNode = $doiDataNode->getElementsByTagName('doi')->item(0);

$doi = $doiNode->nodeValue;

$programNode = $preliminaryOutput->createElementNS($crossrefFRNS, 'fr:program');
$programNode->setAttribute('name', 'fundref');

$publishedSubmission = $submissionDao->getByPubId('doi', $doi);
$publishedSubmission = Repo::submission()->getByDoi($doi, $context->getId());
assert($publishedSubmission);

$funders = $funderDAO->getBySubmissionId($publishedSubmission->getId());
while ($funder = $funders->next()) {
$groupNode = $preliminaryOutput->createElementNS($crossrefFRNS, 'fr:assertion');
Expand Down Expand Up @@ -375,7 +378,7 @@ function addDataCiteElement($hookName, $params) {
$submissionId = $idsArray[2];
// Add the parent fundingReferences element
$fundingReferencesNode = $preliminaryOutput->createElementNS($dataciteFRNS, 'fundingReferences');
$publishedSubmission = Services::get('submission')->get($submissionId);
$publishedSubmission = Repo::submission()->get($submissionId);
assert($publishedSubmission);
$funders = $funderDAO->getBySubmissionId($publishedSubmission->getId());
while ($funder = $funders->next()) {
Expand Down Expand Up @@ -413,7 +416,7 @@ function addOpenAIREFunderElement($hookName, $params) {
$fundingReferences =& $params[1];
$funderDAO = DAORegistry::getDAO('FunderDAO');
$funderAwardDAO = DAORegistry::getDAO('FunderAwardDAO');
$publishedSubmission = Services::get('submission')->get($submissionId);
$publishedSubmission = Repo::submission()->get($submissionId);
assert($publishedSubmission);
$funders = $funderDAO->getBySubmissionId($publishedSubmission->getId());
while ($funder = $funders->next()) {
Expand Down
2 changes: 1 addition & 1 deletion version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>
<application>funding</application>
<type>plugins.generic</type>
<release>3.4.0.1</release>
<release>3.4.0.2</release>
<date>2023-03-26</date>
<lazy-load>1</lazy-load>
<class>FundingPlugin</class>
Expand Down

0 comments on commit a9bfef8

Please sign in to comment.