fix: Filtering on attributes in the event view gives a no attributes warning if a tab doesn't contain attributes

- Warning now only triggers if the event doesn't have any attributes in any tabs
pull/1317/head
Iglocska 2016-06-30 11:44:26 +02:00
parent 7ef3f4615c
commit ab3b85b1cc
2 changed files with 5 additions and 1 deletions

View File

@ -694,6 +694,8 @@ class EventsController extends AppController {
$results = $this->Event->fetchEvent($this->Auth->user(), $conditions);
if (empty($results)) throw new NotFoundException('Invalid event');
$event = &$results[0];
$emptyEvent = (!isset($event['Attribute']) || empty($event['Attribute']));
$this->set('emptyEvent', $emptyEvent);
$params = $this->Event->rearrangeEventForView($event, $this->passedArgs, $all);
$this->params->params['paging'] = array($this->modelClass => $params);
// workaround to get the event dates in to the attribute relations
@ -740,6 +742,8 @@ class EventsController extends AppController {
}
private function __viewUI($event, $continue, $fromEvent) {
$emptyEvent = (!isset($event['Attribute']) || empty($event['Attribute']));
$this->set('emptyEvent', $emptyEvent);
// set the data for the contributors / history field
$org_ids = $this->Event->ShadowAttribute->getEventContributors($event['Event']['id']);
$contributors = $this->Event->Org->find('list', array('fields' => array('Org.name'), 'conditions' => array('Org.id' => $org_ids)));

View File

@ -460,7 +460,7 @@
?>
</table>
</div>
<?php if (!isset($event['objects']) || empty($event['objects'])): ?>
<?php if ($emptyEvent): ?>
<div class="background-red bold">
<span>
<?php