Skip to content

Commit

Permalink
Merge branch 'add-issn-data-checking-and-string-conversion' into 'sta…
Browse files Browse the repository at this point in the history
…ble-3_3_0'

Add checking of ISSN data before using it as string

See merge request softwares-pkp/plugins_ojs/OASwitchboard!34
  • Loading branch information
iudizm committed Aug 12, 2024
2 parents 4102e6f + b3573cc commit 460c144
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions classes/messages/P1Pio.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,23 @@ public function getJournalData(): array
$journal = $journalDao->getById($journalId);

$journalData = [
'name' => $journal->getLocalizedName(),
'id' => $this->chooseIssn($journal),
'eissn' => $journal->getData('onlineIssn'),
'issn' => $journal->getData('printIssn')
'name' => (string) $journal->getLocalizedName(),
'id' => (string) $this->chooseIssn($journal)
];

if (!empty($journal->getData('onlineIssn'))) {
$journalData['eissn'] = (string) $journal->getData('onlineIssn');
}
if (!empty($journal->getData('printIssn'))) {
$journalData['issn'] = (string) $journal->getData('printIssn');
}

return $journalData;
}

private function chooseIssn($journal)
private function chooseIssn($journal): string
{
return $journal->getData('onlineIssn') ?: $journal->getData('printIssn') ?: null;
return $journal->getData('onlineIssn') ?: $journal->getData('printIssn') ?: '';
}

public function getContent(): array
Expand Down

0 comments on commit 460c144

Please sign in to comment.