Mercurial > hg > soundsoftware-site
comparison app/models/.svn/text-base/issue.rb.svn-base @ 245:051f544170fe
* Update to SVN trunk revision 4993
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2011 11:42:28 +0000 |
parents | 0579821a129a |
children | cbce1fd3b1b7 |
comparison
equal
deleted
inserted
replaced
244:8972b600f4fb | 245:051f544170fe |
---|---|
1 # redMine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2007 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
420 !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil? | 420 !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil? |
421 end | 421 end |
422 | 422 |
423 # Returns an array of status that user is able to apply | 423 # Returns an array of status that user is able to apply |
424 def new_statuses_allowed_to(user, include_default=false) | 424 def new_statuses_allowed_to(user, include_default=false) |
425 statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker) | 425 statuses = status.find_new_statuses_allowed_to( |
426 user.roles_for_project(project), | |
427 tracker, | |
428 author == user, | |
429 assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id | |
430 ) | |
426 statuses << status unless statuses.empty? | 431 statuses << status unless statuses.empty? |
427 statuses << IssueStatus.default if include_default | 432 statuses << IssueStatus.default if include_default |
428 statuses = statuses.uniq.sort | 433 statuses = statuses.uniq.sort |
429 blocked? ? statuses.reject {|s| s.is_closed?} : statuses | 434 blocked? ? statuses.reject {|s| s.is_closed?} : statuses |
430 end | 435 end |
822 # Saves the changes in a Journal | 827 # Saves the changes in a Journal |
823 # Called after_save | 828 # Called after_save |
824 def create_journal | 829 def create_journal |
825 if @current_journal | 830 if @current_journal |
826 # attributes changes | 831 # attributes changes |
827 (Issue.column_names - %w(id description root_id lft rgt lock_version created_on updated_on)).each {|c| | 832 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on)).each {|c| |
828 @current_journal.details << JournalDetail.new(:property => 'attr', | 833 @current_journal.details << JournalDetail.new(:property => 'attr', |
829 :prop_key => c, | 834 :prop_key => c, |
830 :old_value => @issue_before_change.send(c), | 835 :old_value => @issue_before_change.send(c), |
831 :value => send(c)) unless send(c)==@issue_before_change.send(c) | 836 :value => send(c)) unless send(c)==@issue_before_change.send(c) |
832 } | 837 } |