Skip to content
Snippets Groups Projects
Commit 37eb218e authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Dateibereich: Literaturangaben haben ungeklärte Lizenz"

Closes #4361

Merge request studip/studip!3162
parent 5830ca9d
No related branches found
No related tags found
No related merge requests found
...@@ -101,11 +101,11 @@ class LibraryFileController extends AuthenticatedController ...@@ -101,11 +101,11 @@ class LibraryFileController extends AuthenticatedController
$this->required_properties = []; $this->required_properties = [];
$this->enriched_properties = []; $this->enriched_properties = [];
foreach ($this->defined_variables as $key => $variable) { foreach ($this->defined_variables as $key => $variable) {
if ($variable['required']) { if (!empty($variable['required'])) {
$this->required_properties[] = $variable['name']; $this->required_properties[] = $variable['name'];
$key += 100; $key += 100;
} }
if (in_array($variable['name'], $this->document_type['properties'])) { if (isset($variable['name']) && in_array($variable['name'], $this->document_type['properties'])) {
$this->enriched_properties[$key] = $variable; $this->enriched_properties[$key] = $variable;
$property_types[$variable['name']] = $variable['type']; $property_types[$variable['name']] = $variable['type'];
} }
...@@ -241,11 +241,11 @@ class LibraryFileController extends AuthenticatedController ...@@ -241,11 +241,11 @@ class LibraryFileController extends AuthenticatedController
$this->required_properties = []; $this->required_properties = [];
$this->enriched_properties = []; $this->enriched_properties = [];
foreach ($this->defined_variables as $key => $variable) { foreach ($this->defined_variables as $key => $variable) {
if ($variable['required']) { if (!empty($variable['required'])) {
$this->required_properties[] = $variable['name']; $this->required_properties[] = $variable['name'];
$key += 100; $key += 100;
} }
if (in_array($variable['name'], $this->document_type['properties'])) { if (isset($variable['name']) && in_array($variable['name'], $this->document_type['properties'])) {
$this->enriched_properties[$key] = $variable; $this->enriched_properties[$key] = $variable;
$property_types[$variable['name']] = $variable['type']; $property_types[$variable['name']] = $variable['type'];
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<? $content_terms_of_use = $file->getTermsOfUse() ?> <? $content_terms_of_use = $file->getTermsOfUse() ?>
<? if ($content_terms_of_use) : ?> <? if ($content_terms_of_use && !is_a($file, LibraryFile::class)) : ?>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<h3><?=_('Hinweis zur Nutzung und Weitergabe:')?></h3> <h3><?=_('Hinweis zur Nutzung und Weitergabe:')?></h3>
......
...@@ -13,33 +13,33 @@ ...@@ -13,33 +13,33 @@
</span> </span>
<? if ($property['type'] == 'number') : ?> <? if ($property['type'] == 'number') : ?>
<input type="number" <input type="number"
value="<?= htmlReady($document_properties[$property['name']]) ?>" value="<?= htmlReady($document_properties[$property['name']] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>]"> name="document_properties[<?= htmlReady($property['name']) ?>]">
<? else : ?> <? else : ?>
<? if ($property['type'] == 'name') : ?> <? if ($property['type'] == 'name') : ?>
<input type="text" placeholder="<?= _('Nachname') ?>" <input type="text" placeholder="<?= _('Nachname') ?>"
value="<?= htmlReady($document_properties[$property['name']][0]['family']) ?>" value="<?= htmlReady($document_properties[$property['name']][0]['family'] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][0][family]"> name="document_properties[<?= htmlReady($property['name']) ?>][0][family]">
<input type="text" placeholder="<?= _('Vorname') ?>" <input type="text" placeholder="<?= _('Vorname') ?>"
value="<?= htmlReady($document_properties[$property['name']][0]['given']) ?>" value="<?= htmlReady($document_properties[$property['name']][0]['given'] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][0][given]"> name="document_properties[<?= htmlReady($property['name']) ?>][0][given]">
<input type="text" placeholder="<?= _('Namenszusatz') ?>" <input type="text" placeholder="<?= _('Namenszusatz') ?>"
value="<?= htmlReady($document_properties[$property['name']][0]['suffix']) ?>" value="<?= htmlReady($document_properties[$property['name']][0]['suffix'] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][0][suffix]"> name="document_properties[<?= htmlReady($property['name']) ?>][0][suffix]">
<? elseif ($property['type'] == 'date') : ?> <? elseif ($property['type'] == 'date') : ?>
<input type="text" placeholder="<?= _('Jahr') ?>" <input type="text" placeholder="<?= _('Jahr') ?>"
value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][0]) ?>" value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][0] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][0]"> name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][0]">
<input type="text" placeholder="<?= _('Monat') ?>" <input type="text" placeholder="<?= _('Monat') ?>"
value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][1]) ?>" value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][1] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][1]"> name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][1]">
<input type="text" placeholder="<?= _('Tag') ?>" <input type="text" placeholder="<?= _('Tag') ?>"
value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][2]) ?>" value="<?= htmlReady($document_properties[$property['name']]['date-parts'][0][2] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][2]"> name="document_properties[<?= htmlReady($property['name']) ?>][date-parts][0][2]">
<? else : ?> <? else : ?>
<input type="text" <input type="text"
value="<?= htmlReady($document_properties[$property['name']]) ?>" value="<?= htmlReady($document_properties[$property['name']] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>]"> name="document_properties[<?= htmlReady($property['name']) ?>]">
<? endif ?> <? endif ?>
<? endif ?> <? endif ?>
......
...@@ -197,10 +197,10 @@ class LibraryDocument ...@@ -197,10 +197,10 @@ class LibraryDocument
public function getIdentifiers(): string public function getIdentifiers(): string
{ {
$identifiers = []; $identifiers = [];
if ($this->csl_data['ISBN']) { if (!empty($this->csl_data['ISBN'])) {
$identifiers[] = sprintf(_('ISBN: %s'), $this->csl_data['ISBN']); $identifiers[] = sprintf(_('ISBN: %s'), $this->csl_data['ISBN']);
} }
if ($this->csl_data['ISSN']) { if (!empty($this->csl_data['ISSN'])) {
$identifiers[] = sprintf(_('ISSN: %s'), $this->csl_data['ISSN']); $identifiers[] = sprintf(_('ISSN: %s'), $this->csl_data['ISSN']);
} }
return implode('; ', $identifiers); return implode('; ', $identifiers);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
$authors = $document->getAuthorNames(); $authors = $document->getAuthorNames();
$issue_date = $document->getIssueDate(true); $issue_date = $document->getIssueDate(true);
$identifiers = $document->getIdentifiers(); $identifiers = $document->getIdentifiers();
$url = ($document->download_url ?: $document->document_url); $url = $document->download_url ?? $document->document_url ?? '';
$is_search = !$document->csl_data; $is_search = !$document->csl_data;
?> ?>
<? if ($is_search) : ?> <? if ($is_search) : ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment