1
0
mirror of https://github.com/pcvolkmer/onkostar-plugin-dnpm.git synced 2025-07-02 01:02:55 +00:00

feat: add propcat and formfield for Studienkategorie

This commit is contained in:
2025-04-20 14:25:07 +02:00
parent 19236d6faf
commit f7936ad6cd
3 changed files with 305 additions and 40 deletions

26
scripts/studien-edit.js Normal file
View File

@ -0,0 +1,26 @@
let text = getFieldValue('studienalle');
let json = [];
let newJson = [];
try {
json = JSON.parse(getFieldValue('studienallejson'));
if (!Array.isArray(json)) {
json = [];
}
} catch (e) {
json = [];
}
if (typeof text === 'string' || text instanceof String) {
text.split('\n').forEach(line => {
let id = line.split(';')[0];
json.forEach(entry => {
if (id === entry.nct) {
newJson.push(entry);
}
});
});
setFieldValue('studienallejson', JSON.stringify(newJson));
} else {
setFieldValue('studienallejson', JSON.stringify([]));
}