Setting an inactive category unactivate the reason - refs #622

This commit is contained in:
Marc Ducobu 2015-10-01 16:44:30 +02:00
parent 744a68f195
commit e32dad5617

View File

@ -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;