Skip to content

Commit 39faf7c

Browse files
Merge pull request #39 from lepidus/main
Feature/format ISBN with hyphens (OMP 3.4.0)
2 parents 7574fde + b87bf81 commit 39faf7c

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed

classes/factories/ThothPublicationFactory.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ private function getIsbnByPublicationFormat($publicationFormat)
7272
$identificationCodes = $publicationFormat->getIdentificationCodes()->toArray();
7373
foreach ($identificationCodes as $identificationCode) {
7474
if ($identificationCode->getCode() == '15' || $identificationCode->getCode() == '24') {
75-
return $identificationCode->getValue();
75+
$isbn = $identificationCode->getValue();
76+
try {
77+
$isbn13 = \Biblys\Isbn\Isbn::convertToIsbn13($isbn);
78+
return str_replace('-', '', $isbn13) === $isbn ? $isbn13 : $isbn;
79+
} catch (Exception $e) {
80+
return $isbn;
81+
}
7682
}
7783
}
7884

classes/services/ThothBookService.inc.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,12 @@ public function validate($publication)
9090
}
9191

9292
$publicationFormats = DAORegistry::getDAO('PublicationFormatDAO')
93-
->getApprovedByPublicationId($publication->getId())
94-
->toArray();
93+
->getByPublicationId($publication->getId());
9594
foreach ($publicationFormats as $publicationFormat) {
96-
if ($publicationFormat->getIsAvailable()) {
97-
$errors = array_merge(
98-
$errors,
99-
ThothService::publication()->validate($publicationFormat)
100-
);
101-
}
95+
$errors = array_merge(
96+
$errors,
97+
ThothService::publication()->validate($publicationFormat)
98+
);
10299
}
103100

104101
return $errors;

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

locale/en/locale.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ msgid "plugins.generic.thoth.register.warning"
8585
msgstr "The submission metadata can not be submitted to Thoth because of the following errors:"
8686

8787
msgid "plugins.generic.thoth.validation.isbn"
88-
msgstr "\"{$isbn}\" of \"{$formatName}\" publication format is not a valid ISBN-13. A valid ISBN-13 must be exactly 17 characters (numbers and hyphens)."
88+
msgstr "\"{$isbn}\" of \"{$formatName}\" publication format is not a valid ISBN-13."
8989

9090
msgid "plugins.generic.thoth.validation.doiExists"
9191
msgstr "A work with DOI \"{$doi}\" already exists."

locale/es/locale.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ msgid "plugins.generic.thoth.register.warning"
8585
msgstr "Los metadatos de envio no pueden ser enviados a Thoth debido a los siguientes errores:"
8686

8787
msgid "plugins.generic.thoth.validation.isbn"
88-
msgstr "\"{$isbn}\" del formato de publicación \"{$formatName}\" no es un ISBN-13 válido. Un ISBN-13 válido debe tener exactamente 17 caracteres (números y guiones)."
88+
msgstr "\"{$isbn}\" del formato de publicación \"{$formatName}\" no es un ISBN-13 válido."
8989

9090
msgid "plugins.generic.thoth.validation.doiExists"
9191
msgstr "Un trabajo con el DOI \"{$doi}\" ya existe."

locale/pt_BR/locale.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ msgid "plugins.generic.thoth.register.warning"
8585
msgstr "Os metadados da submissão não podem ser enviados para Thoth devido aos seguintes erros:"
8686

8787
msgid "plugins.generic.thoth.validation.isbn"
88-
msgstr "\"{$isbn}\" do formato de publicação \"{$formatName}\" não é um ISBN-13 válido. Um ISBN-13 válido deve ter exatamente 17 caracteres (números e hífens)."
88+
msgstr "\"{$isbn}\" do formato de publicação \"{$formatName}\" não é um ISBN-13 válido."
8989

9090
msgid "plugins.generic.thoth.validation.doiExists"
9191
msgstr "Um trabalho com o DOI \"{$doi}\" já existe."

version.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<version>
44
<application>thoth</application>
55
<type>plugins.generic</type>
6-
<release>0.2.8.0</release>
7-
<date>2025-05-01</date>
6+
<release>0.2.8.1</release>
7+
<date>2025-05-16</date>
88
<lazy-load>1</lazy-load>
99
<class>ThothPlugin</class>
1010
</version>

0 commit comments

Comments
 (0)