Skip to content

Commit 76af155

Browse files
committed
Merge branch 'format_isbn_3_4_0-1002' into 'main'
Formatting ISBN with hyphens See merge request softwares-pkp/plugins_ojs/thoth-omp-plugin!81
2 parents 6c85140 + 72df5e1 commit 76af155

4 files changed

Lines changed: 20 additions & 17 deletions

File tree

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.

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-15</date>
88
<lazy-load>1</lazy-load>
99
<class>ThothPlugin</class>
1010
</version>

0 commit comments

Comments
 (0)