mirror of https://github.com/MISP/MISP
fix: Fixed an issue where tags couldn't be added anymore since the last commit
parent
0241ddc0fa
commit
9df31f3f5d
|
@ -3154,25 +3154,29 @@ class Attribute extends AppModel {
|
|||
));
|
||||
} else {
|
||||
$tags = array();
|
||||
if (isset($attribute['Tag'])) {
|
||||
$tags = $attribute['Tag'];
|
||||
}
|
||||
|
||||
if (isset($attribute['AttributeTag'])) {
|
||||
foreach ($attribute['AttributeTag'] as $at) {
|
||||
$tags[] = $at['Tag'];
|
||||
}
|
||||
}
|
||||
foreach ($tags as $tag) {
|
||||
$tag_id = $this->AttributeTag->Tag->captureTag($tag, $user);
|
||||
if ($tag_id) {
|
||||
unset($at['id']);
|
||||
$this->AttributeTag->create();
|
||||
$at = array();
|
||||
$at['attribute_id'] = $this->id;
|
||||
$at['event_id'] = $eventId;
|
||||
$at['tag_id'] = $tag_id;
|
||||
$this->AttributeTag->save($at);
|
||||
}
|
||||
}
|
||||
if (isset($attribute['Tag'])) {
|
||||
foreach ($attribute['Tag'] as $tag) {
|
||||
$tag_id = $this->AttributeTag->Tag->captureTag($tag, $user);
|
||||
if ($tag_id) {
|
||||
$this->AttributeTag->create();
|
||||
$at = array();
|
||||
$at['attribute_id'] = $this->id;
|
||||
$at['event_id'] = $eventId;
|
||||
$at['tag_id'] = $tag_id;
|
||||
$this->AttributeTag->save($at);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($attribute['Sighting'])) {
|
||||
foreach ($attribute['Sighting'] as $k => $sighting) {
|
||||
$this->Sighting->captureSighting($sighting, $this->id, $eventId, $user);
|
||||
|
|
Loading…
Reference in New Issue