Skip to content

Commit f040206

Browse files
Merge pull request #38 from lepidus/stable-3_3_0
Feature/format ISBN with hyphens (OMP 3.3.0)
2 parents 48cf68c + e108c1d commit f040206

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,13 @@ public function validate($publication)
8989
}
9090

9191
$publicationFormats = DAORegistry::getDAO('PublicationFormatDAO')
92-
->getApprovedByPublicationId($publication->getId())
92+
->getByPublicationId($publication->getId())
9393
->toArray();
9494
foreach ($publicationFormats as $publicationFormat) {
95-
if ($publicationFormat->getIsAvailable()) {
96-
$errors = array_merge(
97-
$errors,
98-
ThothService::publication()->validate($publicationFormat)
99-
);
100-
}
95+
$errors = array_merge(
96+
$errors,
97+
ThothService::publication()->validate($publicationFormat)
98+
);
10199
}
102100

103101
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_US/locale.po

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

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

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

locale/es_ES/locale.po

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

8484
msgid "plugins.generic.thoth.validation.isbn"
85-
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)."
85+
msgstr "\"{$isbn}\" del formato de publicación \"{$formatName}\" no es un ISBN-13 válido."
8686

8787
msgid "plugins.generic.thoth.validation.doiExists"
8888
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
@@ -82,7 +82,7 @@ msgid "plugins.generic.thoth.register.warning"
8282
msgstr "Os metadados da submissão não podem ser enviados para Thoth devido aos seguintes erros:"
8383

8484
msgid "plugins.generic.thoth.validation.isbn"
85-
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)."
85+
msgstr "\"{$isbn}\" do formato de publicação \"{$formatName}\" não é um ISBN-13 válido."
8686

8787
msgid "plugins.generic.thoth.validation.doiExists"
8888
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.1.10.0</release>
7-
<date>2025-05-01</date>
6+
<release>0.1.10.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)