From e32dad56174b29addc50688227a00ba2b93dc097 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Thu, 1 Oct 2015 16:44:30 +0200 Subject: [PATCH] Setting an inactive category unactivate the reason - refs #622 --- Entity/ActivityReason.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Entity/ActivityReason.php b/Entity/ActivityReason.php index 8ad072039..fb196b8d9 100644 --- a/Entity/ActivityReason.php +++ b/Entity/ActivityReason.php @@ -96,7 +96,8 @@ class ActivityReason } /** - * Set category + * Set category of the reason. If you set to the reason an inactive + * category, the reason will become inactive * * @param ActivityReasonCategory $category * @@ -104,6 +105,10 @@ class ActivityReason */ public function setCategory(ActivityReasonCategory $category) { + if($this->category !== $category && ! $category->getActive()) { + $this->setActive(False); + } + $this->category = $category; return $this;