fix: Mass edit and AttackMatrix work again on objectAttributes

pull/4041/head
mokaddem 2019-01-23 09:39:49 +01:00
parent b4c6b31b8a
commit a291669c2e
2 changed files with 10 additions and 7 deletions

View File

@ -4639,7 +4639,8 @@ class EventsController extends AppController
} elseif ($scope == 'attribute') {
$attribute = $this->Event->Attribute->fetchAttributes($this->Auth->user(), array(
'conditions' => array('Attribute.id' => $scope_id),
'fields' => array('event_id')
'fields' => array('event_id'),
'flatten' => 1,
));
if (empty($attribute)) {
throw new Exception("Invalid Attribute.");

View File

@ -132,7 +132,10 @@ class AttributeTag extends AppModel
}
$allTags = array();
$attributes = $this->Attribute->fetchAttributes($user, array('conditions' => array('Attribute.id' => $attributeIds, 'Attribute.event_id' => $requestedEventId)));
$attributes = $this->Attribute->fetchAttributes($user, array(
'conditions' => array('Attribute.id' => $attributeIds, 'Attribute.event_id' => $requestedEventId),
'flatten' => 1,
));
foreach ($attributes as $attribute) {
$attributeTags = $this->find('all', array(
'conditions' => array(
@ -162,14 +165,13 @@ class AttributeTag extends AppModel
$allClusters = array();
foreach ($attributeIds as $id) {
$attribute = $this->Attribute->fetchAttributes($user, array('conditions' => array('Attribute.id' => $id)));
$attribute = $this->Attribute->fetchAttributes($user, array(
'conditions' => array('Attribute.id' => $id, 'Attribute.event_id' => $requestedEventId),
'flatten' => 1,
));
if (empty($attribute)) {
throw new MethodNotAllowedException('Invalid attribute.');
}
$eventId = $attribute[0]['Attribute']['event_id'];
if ($eventId != $requestedEventId) { // only takes tags of attributes belonging to the same event
continue;
}
$attributeTags = $this->find('all', array(
'conditions' => array(
'attribute_id' => $id