Skip to content

Commit 433a747

Browse files
committed
Merge branch 'filter_authors_3_3_0-989' into 'stable-3_3_0'
Filter chapter authors from Thoth work See merge request softwares-pkp/plugins_ojs/thoth-omp-plugin!72
2 parents 8b8bdd9 + 5529e45 commit 433a747

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

classes/services/ThothContributionService.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ public function registerByPublication($publication)
5555
{
5656
$authors = DAORegistry::getDAO('AuthorDAO')->getByPublicationId($publication->getId());
5757
$primaryContactId = $publication->getData('primaryContactId');
58+
59+
$chapterAuthorDao = DAORegistry::getDAO('ChapterAuthorDAO');
60+
$chapterAuthors = $chapterAuthorDao->getAuthors($publication->getId())->toArray();
61+
$chapterAuthorIds = array_map(fn ($chapterAuthor) => $chapterAuthor->getId(), $chapterAuthors);
62+
63+
$authors = array_filter($authors, function ($author) use ($chapterAuthorIds, $primaryContactId) {
64+
return $author->getId() === $primaryContactId || !in_array($author->getId(), $chapterAuthorIds);
65+
});
66+
5867
$thothBookId = $publication->getData('thothBookId');
5968
foreach ($authors as $author) {
6069
$this->register($author, $thothBookId, $primaryContactId);

version.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<application>thoth</application>
55
<type>plugins.generic</type>
66
<release>0.1.7.1</release>
7-
<date>2025-04-22</date>
7+
<date>2025-04-28</date>
88
<lazy-load>1</lazy-load>
99
<class>ThothPlugin</class>
1010
</version>

0 commit comments

Comments
 (0)