[BUGFIX] Take all fields of pages into account when hiding a page
authorOliver Eglseder <oliver.eglseder@in2code.de>
Thu, 3 Sep 2015 15:19:11 +0000 (17:19 +0200)
committerOliver Eglseder <oliver.eglseder@in2code.de>
Thu, 3 Sep 2015 15:19:11 +0000 (17:19 +0200)
Classes/Domain/Model/Condition.php

index f42a8da..d7a4d20 100644 (file)
@@ -264,13 +264,10 @@ class Condition extends AbstractEntity {
 
                                        /** @var Field $field */
                                        foreach ($page->getFields() as $field) {
-                                               if ($field->getUid() === (int) $this->targetField) {
-                                                       $arguments['todo_field'][$form->getUid()][$page->getUid()][$field->getMarker()] = array(
-                                                               'action' => self::$actionNumberMap[$this->actions],
-                                                               'matchingCondition' => $this->getUid(),
-                                                       );
-                                                       break;
-                                               }
+                                               $arguments['todo_field'][$form->getUid()][$page->getUid()][$field->getMarker()] = array(
+                                                       'action' => self::$actionNumberMap[$this->actions],
+                                                       'matchingCondition' => $this->getUid(),
+                                               );
                                        }
 
                                        $arguments['todo_page'][$form->getUid()][$page->getUid()] = array(
@@ -313,13 +310,10 @@ class Condition extends AbstractEntity {
 
                                        /** @var Field $field */
                                        foreach ($page->getFields() as $field) {
-                                               if ($field->getUid() === (int) $this->targetField) {
-                                                       $arguments['todo_field'][$form->getUid()][$page->getUid()][$field->getMarker()] = array(
-                                                               'action' => $this->getNegatedActionString(),
-                                                               'matchingCondition' => $this->getUid(),
-                                                       );
-                                                       break;
-                                               }
+                                               $arguments['todo_field'][$form->getUid()][$page->getUid()][$field->getMarker()] = array(
+                                                       'action' => $this->getNegatedActionString(),
+                                                       'matchingCondition' => $this->getUid(),
+                                               );
                                        }
 
                                        $arguments['todo_page'][$form->getUid()][$page->getUid()] = array(
@@ -353,7 +347,7 @@ class Condition extends AbstractEntity {
        protected function getNegatedActionString() {
                if ($this->actions === self::ACTION_HIDE) {
                        return self::getActionNumberMap(self::ACTION_UN_HIDE);
-               } elseif($this->actions === self::ACTION_UN_HIDE) {
+               } elseif ($this->actions === self::ACTION_UN_HIDE) {
                        return self::getActionNumberMap(self::ACTION_HIDE);
                }
        }