N°6071 - Prefill Tagset in transition displayed but not saved

This commit is contained in:
Anne-Cath
2025-09-15 16:11:54 +02:00
parent 53047d35fe
commit 0ec598adf7

View File

@@ -4263,9 +4263,30 @@ HTML;
case 'Set':
case 'TagSet':
$sTagSetJson = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data');
if ($sTagSetJson !== null) { // bulk modify, direct linked set not handled
$value = json_decode($sTagSetJson, true);
}
if ($sTagSetJson !== null) { // bulk modify, direct linked set not handled
$value = json_decode($sTagSetJson, true);
if ($this->IsNew()) {
if ($value['orig_value'] != '' ) {
foreach ($value['orig_value'] as $val) {
if (!in_array($val, $value['removed'])) {
$value['added'][] = $val;
}
}
}
} else {
$acurrentValues = $this->Get($sAttCode)->GetValues();
foreach ($value['orig_value'] as $val) {
if ( !in_array($val, $acurrentValues) && !in_array($val, $value['removed']) && !in_array($val, $value['added']) ) {
$value['added'][] = $val;
}
}
foreach ($acurrentValues as $val) {
if ( !in_array($val, $value['orig_value']) && !in_array($val, $value['removed']) && !in_array($val, $value['added']) ) {
$value['removed'][] = $val;
}
}
}
}
break;
default: