Skip to content
Snippets Groups Projects
Commit 2f1f86e6 authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

allow selecting matriculation_number on Stud.IP 5.5, fixes #266

parent 4cbbbf74
No related branches found
No related tags found
No related merge requests found
......@@ -188,13 +188,17 @@ function normalizeFloat($string, &$unit)
function get_student_id($user)
{
$datafield_id = Config::get()->VIPS_STUDENT_ID_DATAFIELD;
$entries = [];
if ($datafield_id) {
$entries = DatafieldEntryModel::findByModel($user, $datafield_id);
return $entries ? $entries[0]->content : null;
}
return $entries ? $entries[0]->content : null;
if (isset($user->matriculation_number)) {
return $user->matriculation_number;
}
return null;
}
/**
......
......@@ -11,7 +11,11 @@
<?= _vips('Datenfeld für die Matrikelnummer') ?>
<select name="datafield">
<option value=""></option>
<option value="">
<? if (version_compare($GLOBALS['SOFTWARE_VERSION'], '5.5', '>=')): ?>
<?= _vips('Matrikelnummer') ?> (Stud.IP)
<? endif ?>
</option>
<? foreach ($fields as $field): ?>
<option value="<?= $field->id ?>" <?= $config->VIPS_STUDENT_ID_DATAFIELD == $field->id ? 'selected' : '' ?>>
<?= htmlReady($field->name) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment