Merge branch '8-creator-affiliation-and-license-are-not-set-correctly-during-import' into 'master'

Resolve "Creator affiliation and license are not set correctly during import"

See merge request oersi/metadata-form!12
This commit is contained in:
Mirjan Hoffmann 2024-02-12 09:46:09 +00:00
commit 88f71e5d96

View file

@ -528,6 +528,14 @@
institutionOptions += '<option value="' + item["ror"] + '"' + (item["ror"] === institution ? ' selected' : '') + '>' + item["label"] + '</option>';
organizationOptions += '<option value="' + item["ror"] + '"' + (item["ror"] === institution ? ' selected' : '') + '>' + item["label"] + '</option>';
});
if (institution?.length > 0 && !vocabInstitutions.find((e) => e["ror"] === institution)) {
if (affiliationName?.length > 0) {
institutionOptions += '<option value="' + institution + '"' + ' selected>' + affiliationName + '</option>';
}
if (organizationName?.length > 0) {
organizationOptions += '<option value="' + institution + '"' + ' selected>' + organizationName + '</option>';
}
}
let customInstitutionSelected = institution === "" && affiliationName !== "";
let customOrganizationSelected = institution === "" && organizationName !== "";
let radioGroupName = creatorList.childElementCount > 1 ? $(creatorList.lastElementChild.previousElementSibling).find('.inputType').find('input').attr('name') : ''
@ -772,6 +780,7 @@
const aboutIds = data.about ? data.about.map(idMap) : [];
const learningResourceTypeIds = data.learningResourceType ? data.learningResourceType.map(idMap) : [];
const educationalLevelIds = data.educationalLevel ? data.educationalLevel.map(idMap) : [];
const licenseUrl = data.license ? idMap(data.license) : ""
document.getElementById("inputStatus").value = data.creativeWorkStatus ? data.creativeWorkStatus : "Draft";
$("#datepicker1").datepicker("update", new Date(data.datePublished));
@ -782,7 +791,7 @@
document.getElementById("inputDescription").value = data.description ? data.description : "";
$('#inputLanguage').val(data.inLanguage ? data.inLanguage : []).selectpicker('refresh');
$('#inputSubjectOf').val(aboutIds).selectpicker('refresh');
setLicense((data.license && data.license.id) ? idMap(data.license) : "")
setLicense(licenseUrl)
document.getElementById("inputImage").value = data.image ? data.image : "";
$('#inputResourceType').val(learningResourceTypeIds).selectpicker('refresh');
if (educationalLevelIds.length > 0) {