Skip to content

Commit

Permalink
Merge branch 'fundingData-851' into 'main'
Browse files Browse the repository at this point in the history
Add funders metadata from the Funding plugin, when available.

See merge request softwares-pkp/plugins_ojs/OASwitchboard!23
  • Loading branch information
iudizm committed Jul 26, 2024
2 parents 6e56021 + 86158d6 commit bea11f2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions classes/messages/P1Pio.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use APP\facades\Repo;
use PKP\facades\Locale;
use PKP\decision\Decision;
use PKP\plugins\PluginRegistry;

class P1Pio
{
Expand Down Expand Up @@ -102,9 +103,34 @@ public function getArticleData(): array
$articleData['manuscript']['id'] = (string) $fileId;
}

$funders = $this->getFundersData();
if (!empty($funders)) {
$articleData['funders'] = $funders;
}
return $articleData;
}

public function getFundersData(): array
{
$foundFunders = [];
$fundingPlugin = PluginRegistry::getPlugin('generic', 'FundingPlugin');
if (!is_null($fundingPlugin)) {
if ($fundingPlugin->getEnabled()) {
$funderDao = DAORegistry::getDAO('FunderDAO');
$funders = $funderDao->getBySubmissionId($this->submission->getId())->toArray();
if (!empty($funders)) {
foreach ($funders as $funder) {
$foundFunders[] = [
'name' => (string) $funder->getFunderName(),
'fundref' => (string) $funder->getFunderIdentification()
];
}
}
}
}
return $foundFunders;
}

private function getAcceptanceDate(): ?string
{
$editorialDecision = $this->getSubmissionDecisions();
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<version>
<application>OASwitchboard</application>
<type>plugins.generic</type>
<release>2.0.1.1</release>
<date>2024-07-25</date>
<release>2.0.1.2</release>
<date>2024-07-26</date>
</version>

0 comments on commit bea11f2

Please sign in to comment.