Skip to content

Commit

Permalink
Merge branch 'preventUserInterestsDuplicates' into 'main'
Browse files Browse the repository at this point in the history
Prevents user interests duplicates

See merge request softwares-pkp/plugins_ojs/fullJournalTransfer!45
  • Loading branch information
thiagolepidus committed Mar 1, 2024
2 parents a4b08ed + 2744323 commit c40c927
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ php tools/importExport.php FullJournalImportExportPlugin import [targzFileName]
- Navigation Menus
- Plugins Configs
- Sections
- Review Forms
- Review Assignments
- Review Rounds
- Stage Assignments
- Editor Decisions

**To Do**:

- Review Forms
- Review Files
- Discussions
- Metrics
Expand Down
13 changes: 12 additions & 1 deletion filter/export/JournalNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,25 @@ private function removeDuplicatedInterests($usersDoc)
$interests = preg_split('/,\s*/', $node->textContent);
$uniqueInterests = array_intersect_key(
$interests,
array_unique(array_map("strtolower", $interests))
array_unique(array_map([$this, 'removeAccents'], $interests))
);
$node->nodeValue = htmlspecialchars(implode(', ', $uniqueInterests), ENT_COMPAT, 'UTF-8');
}
}
}
}

public function removeAccents($string)
{
$transliterator = Transliterator::createFromRules(
':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;',
Transliterator::FORWARD
);
$normalized = $transliterator->transliterate(strtolower($string));

return $normalized;
}

private function camelCaseToSnakeCase($string)
{
return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $string));
Expand Down
2 changes: 1 addition & 1 deletion fullJournal.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<element name="submission_checklist" minOccurs="1" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="submission_checklist_item" minOccurs="1" maxOccurs="unbounded" />
<element name="submission_checklist_item" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="locale" type="string" />
</complexType>
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>
<application>fullJournalTransfer</application>
<type>plugins.importexport</type>
<release>2.0.7.0</release>
<date>2024-02-28</date>
<release>2.0.7.1</release>
<date>2024-03-01</date>
<class>FullJournalImportExportPlugin</class>
</version>

0 comments on commit c40c927

Please sign in to comment.