private function move_into_another($new_id) { switch ($this->parameter) { case 'type': //Update the type for the bugs of this type BugtrackerService::update_parameter(array('type' => $new_id), 'WHERE type=:id', array('id' => $this->id)); if (empty($new_id)) { //Delete history lines containing this type BugtrackerService::delete_history("WHERE updated_field='type' AND (old_value=:id OR new_value=:id)", array('id' => $this->id)); } else { //Update history lines containing this type BugtrackerService::update_history(array('old_value' => $new_id), "WHERE updated_field='type' AND old_value=:id", array('id' => $this->id)); BugtrackerService::update_history(array('new_value' => $new_id), "WHERE updated_field='type' AND new_value=:id", array('id' => $this->id)); } break; case 'category': //Update the category for the bugs of this category BugtrackerService::update_parameter(array('category' => $new_id), 'WHERE category=:id', array('id' => $this->id)); if (empty($new_id)) { //Delete history lines containing this type BugtrackerService::delete_history("WHERE updated_field='category' AND (old_value=:id OR new_value=:id)", array('id' => $this->id)); } else { //Update history lines containing this category BugtrackerService::update_history(array('old_value' => $new_id), "WHERE updated_field='category' AND old_value=:id", array('id' => $this->id)); BugtrackerService::update_history(array('new_value' => $new_id), "WHERE updated_field='category' AND new_value=:id", array('id' => $this->id)); } break; case 'version': //Update the version for the bugs of this version BugtrackerService::update_parameter(array('detected_in' => $new_id), 'WHERE detected_in=:id', array('id' => $this->id)); BugtrackerService::update_parameter(array('fixed_in' => $new_id), 'WHERE fixed_in=:id', array('id' => $this->id)); if (empty($new_id)) { //Delete history lines containing this type BugtrackerService::delete_history("WHERE updated_field='detected_in' OR updated_field='fixed_in' AND (old_value=:id OR new_value=:id)", array('id' => $this->id)); } else { //Update history lines containing this version BugtrackerService::update_history(array('old_value' => $new_id), "WHERE updated_field='detected_in' AND old_value=:id", array('id' => $this->id)); BugtrackerService::update_history(array('new_value' => $new_id), "WHERE updated_field='detected_in' AND new_value=:id", array('id' => $this->id)); BugtrackerService::update_history(array('old_value' => $new_id), "WHERE updated_field='fixed_in' AND old_value=:id", array('id' => $this->id)); BugtrackerService::update_history(array('new_value' => $new_id), "WHERE updated_field='fixed_in' AND new_value=:id", array('id' => $this->id)); } BugtrackerStatsCache::invalidate(); break; } }