Skip to content

Commit

Permalink
minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
GaziYucel committed Feb 29, 2024
1 parent fcc6e8a commit c6480c7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
15 changes: 9 additions & 6 deletions classes/External/Wikidata/Deposit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use APP\plugins\generic\citationManager\CitationManagerPlugin;
use APP\plugins\generic\citationManager\classes\DataModels\Citation\CitationModel;
use APP\plugins\generic\citationManager\classes\DataModels\Metadata\MetadataAuthor;
use APP\plugins\generic\citationManager\classes\DataModels\Metadata\MetadataJournal;
use APP\plugins\generic\citationManager\classes\DataModels\Metadata\MetadataPublication;
use APP\plugins\generic\citationManager\classes\Db\PluginDAO;
Expand Down Expand Up @@ -74,9 +75,10 @@ public function execute(): bool
// author(s)
$countAuthors = count($this->authors);
for ($i = 0; $i < $countAuthors; $i++) {
/* @var Author $author */
/** @var Author $author */
$author = $this->authors[$i];
$metadata = $author->getData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR);
$metadata = json_decode($author->getData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR), true);
$metadata = ClassHelper::getClassWithValuesAssigned(new MetadataAuthor(), $metadata);

$orcidId = Orcid::removePrefix($author->getData('orcid'));
$displayName = trim($author->getGivenName($locale) . ' ' . $author->getFamilyName($locale));
Expand Down Expand Up @@ -115,16 +117,17 @@ public function execute(): bool
$this->property->publishedIn['id']);

// authors in main article
foreach ($this->authors as $index => $entity) {
foreach ($this->authors as $index => $author) {
/** @var Author $author */
$this->addReferenceClaim($item,
(array)$entity['_data'][CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR],
(array)$author->getData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR),
$this->property->author['id']);
}

// cites work in main article
foreach ($this->citations as $index => $entity) {
foreach ($this->citations as $index => $citation) {
$this->addReferenceClaim($item,
(array)$entity,
(array)$citation,
$this->property->citesWork['id']);
}

Expand Down
7 changes: 3 additions & 4 deletions classes/Workflow/WorkflowTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ public function execute(string $hookName, array $args): void
$authors = [];
foreach ($publication->getData('authors') as $id => $author) {
/* @var Author $author */
$metadataAuthor = $author->getData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR);
if (empty($metadataAuthor)) {
$author->setData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR, new MetadataAuthor());
}
$metadataAuthor = json_decode($author->getData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR));
if (empty($metadataAuthor)) $metadataAuthor = new MetadataAuthor();
$author->setData(CitationManagerPlugin::CITATION_MANAGER_METADATA_AUTHOR, $metadataAuthor);
$authors[] = $author;
}

Expand Down
26 changes: 12 additions & 14 deletions templates/workflowTab.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@
label="{translate key="plugins.generic.citationManager.publication.label"}">

<div class="header">
<div>
<label class="pkpFormFieldLabel">
{translate key="plugins.generic.citationManager.process.label"}
</label>
<br/>
<div class="pkpFormField__description">
{translate key="plugins.generic.citationManager.process.description"}
</div>
</div>
<table>
<tr>
<td style="width: 80px;"><strong>{translate key="context.context"}</strong></td>
<td colspan="2">
<label class="pkpFormFieldLabel">
{translate key="plugins.generic.citationManager.process.label"}
</label>
<br/>
<div class="pkpFormField__description">
{translate key="plugins.generic.citationManager.process.description"}
</div>
</td>
</tr>
<tr>
<td colspan="2">
<strong>Journal</strong>
<a class="citationManager-Button citationManager-ButtonGreen"
v-if="citationManagerApp.metadataJournal.openalex_id"
:href="'{$url.openAlex}/' + citationManagerApp.metadataJournal.openalex_id"
Expand All @@ -37,8 +35,8 @@
</td>
</tr>
<tr>
<td><strong>{translate key="article.authors"}</strong></td>
<td colspan="2">
<strong>Authors</strong>
<span v-for="(row, i) in citationManagerApp.authors" class="citationManager-Outline" style="margin-right: 5px;">
<span class="citationManager-Tag">
{{ row._data.givenName[citationManagerApp.locale] }} {{ row._data.familyName[citationManagerApp.locale] }}
Expand All @@ -56,8 +54,8 @@
</td>
</tr>
<tr>
<td><strong>{translate key="common.publication"}</strong></td>
<td>
<strong>Publication</strong>
<a class="citationManager-Button citationManager-ButtonGreen"
v-if="citationManagerApp.metadataPublication.wikidata_id"
:href="'{$url.wikidata}/' + citationManagerApp.metadataPublication.wikidata_id"
Expand Down

0 comments on commit c6480c7

Please sign in to comment.