Skip to content
Snippets Groups Projects
Commit 9f9d4e7f 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 83358ee8
No related branches found
No related tags found
No related merge requests found
Pipeline #24930 passed
......@@ -101,11 +101,11 @@ class LibraryFileController extends AuthenticatedController
$this->required_properties = [];
$this->enriched_properties = [];
foreach ($this->defined_variables as $key => $variable) {
if ($variable['required']) {
if (!empty($variable['required'])) {
$this->required_properties[] = $variable['name'];
$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;
$property_types[$variable['name']] = $variable['type'];
}
......@@ -241,11 +241,11 @@ class LibraryFileController extends AuthenticatedController
$this->required_properties = [];
$this->enriched_properties = [];
foreach ($this->defined_variables as $key => $variable) {
if ($variable['required']) {
if (!empty($variable['required'])) {
$this->required_properties[] = $variable['name'];
$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;
$property_types[$variable['name']] = $variable['type'];
}
......
......@@ -45,7 +45,7 @@
<? $content_terms_of_use = $file->getTermsOfUse() ?>
<? if ($content_terms_of_use) : ?>
<? if ($content_terms_of_use && !is_a($file, LibraryFile::class)) : ?>
<tr>
<td colspan="2">
<h3><?=_('Hinweis zur Nutzung und Weitergabe:')?></h3>
......
......@@ -13,33 +13,33 @@
</span>
<? if ($property['type'] == 'number') : ?>
<input type="number"
value="<?= htmlReady($document_properties[$property['name']]) ?>"
value="<?= htmlReady($document_properties[$property['name']] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>]">
<? else : ?>
<? if ($property['type'] == 'name') : ?>
<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]">
<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]">
<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]">
<? elseif ($property['type'] == 'date') : ?>
<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]">
<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]">
<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]">
<? else : ?>
<input type="text"
value="<?= htmlReady($document_properties[$property['name']]) ?>"
value="<?= htmlReady($document_properties[$property['name']] ?? '') ?>"
name="document_properties[<?= htmlReady($property['name']) ?>]">
<? endif ?>
<? endif ?>
......
......@@ -196,10 +196,10 @@ class LibraryDocument
public function getIdentifiers(): string
{
$identifiers = [];
if ($this->csl_data['ISBN']) {
if (!empty($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']);
}
return implode('; ', $identifiers);
......
......@@ -2,7 +2,7 @@
$authors = $document->getAuthorNames();
$issue_date = $document->getIssueDate(true);
$identifiers = $document->getIdentifiers();
$url = ($document->download_url ?: $document->document_url);
$url = $document->download_url ?? $document->document_url ?? '';
$is_search = !$document->csl_data;
?>
<? if ($is_search) : ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment