Skip to content

Commit 9d73046

Browse files
committed
Merge branch 'issue-addsAccentuationTreatmentInCheckingTheNamesOfDoiAuthors-#169' into 'master'
Removes accentuation of the authors name of submission and of DOI. See merge request softwares-pkp/plugins_ojs/doiscielo!2
2 parents 23144ab + e1cf67a commit 9d73046

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

classes/ScreeningChecker.inc.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ public function checkDoiFromAuthor($authorSubmission, $authorsCrossref) {
6969
for($i = 0; $i < count($authorsCrossref); $i++) {
7070
$nameAuthorCrossref = $authorsCrossref[$i]['given'] . " " . $authorsCrossref[$i]['family'];
7171

72-
$tokensAuthorSubmission = explode(" ", $authorSubmission);
73-
$tokensAuthorCrossref = explode(" ", $nameAuthorCrossref);
72+
$authorSubmissionNameWithoutAccentuation = $this->removeAccentuation($authorSubmission);
73+
$authorCrossrefNameWithoutAccentuation = $this->removeAccentuation($nameAuthorCrossref);
74+
75+
$tokensAuthorSubmission = explode(" ", $authorSubmissionNameWithoutAccentuation);
76+
$tokensAuthorCrossref = explode(" ", $authorCrossrefNameWithoutAccentuation);
7477

7578
$firstNameAuthorSubmission = $tokensAuthorSubmission[0];
7679
$firstNameAuthorCrossref = $tokensAuthorCrossref[0];
@@ -119,6 +122,17 @@ public function checkAuthorSurnameWhenSingleName($tokensAuthorSubmission,$tokens
119122
return $equalsName;
120123
}
121124

125+
public function removeAccentuation($authorName){
126+
$nameWithoutAccentuation = iconv('UTF-8', 'ASCII//TRANSLIT', $authorName);
127+
128+
if ($nameWithoutAccentuation == false) {
129+
error_log("Failure at accent removing from author's name during DOI Screening");
130+
return $authorName;
131+
}
132+
133+
return $nameWithoutAccentuation;
134+
}
135+
122136
public function checkDoiArticle($itemCrossref) {
123137
return $itemCrossref['type'] == 'journal-article';
124138
}

tests/ScreeningCheckerTest.php

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ public function testDoiAuthorNameEqualsSubmissionAuthorName(): void
8282

8383
$authorsCrossrefCase1 = array(array('given' => "Síntique", 'family' => "Priscila Alves Lopes"));
8484
$authorsCrossrefCase2 = array(array('given' => "Maria", 'family' => "Síntique Lopes"));
85+
$authorsCrossrefCase3 = array(array('given' => "Yves", 'family' => "Schafer Weiss"));
8586

86-
$authorSubmission = "Síntique Priscila Alves Lopes";
87+
$authorSubmissionCase1 = "Síntique Priscila Alves Lopes";
88+
$authorSubmissionCase2 = "Yves Schäfer Weiß";
8789

88-
$this->assertTrue($checker->checkDoiFromAuthor($authorSubmission, $authorsCrossrefCase1));
89-
$this->assertFalse($checker->checkDoiFromAuthor($authorSubmission, $authorsCrossrefCase2));
90+
$this->assertTrue($checker->checkDoiFromAuthor($authorSubmissionCase1, $authorsCrossrefCase1));
91+
$this->assertFalse($checker->checkDoiFromAuthor($authorSubmissionCase1, $authorsCrossrefCase2));
92+
$this->assertTrue($checker->checkDoiFromAuthor($authorSubmissionCase2, $authorsCrossrefCase3));
9093

9194
}
9295

@@ -131,6 +134,30 @@ public function testDoiAuthorNameWithMiddleNameDifferentSubmissionAuthorName():
131134
$this->assertFalse($checker->checkDoiFromAuthor($authorSubmission, $authorsCrossref));
132135
}
133136

137+
public function testRemoveAccentuation(): void
138+
{
139+
$checker = new ScreeningChecker();
140+
$nameResultedCase1 = $checker->removeAccentuation("Síntique Priscila Alves Lopes");
141+
$nameResultedCase2 = $checker->removeAccentuation("Yves Müller Schröder");
142+
143+
$nameExpectedCase1 = "Sintique Priscila Alves Lopes";
144+
$nameExpectedCase2 = "Yves Muller Schroder";
145+
146+
$this->assertEquals($nameResultedCase1,$nameExpectedCase1);
147+
$this->assertEquals($nameResultedCase2,$nameExpectedCase2);
148+
}
149+
150+
public function testDoiAuthorNameWithoutAccentuationEqualsSubmissionAuthorNameWithAccentuation(): void
151+
{
152+
$checker = new ScreeningChecker();
153+
154+
$authorsCrossref = array(array('given' => "Sintique", 'family' => "Lopes"));
155+
156+
$authorSubmission = "Síntique Priscila Alves Lopes";
157+
158+
$this->assertTrue($checker->checkDoiFromAuthor($authorSubmission, $authorsCrossref));
159+
}
160+
134161
public function testCheckDoiArticle(): void
135162
{
136163
$checker = new ScreeningChecker();

0 commit comments

Comments
 (0)