Author: assaf
Date: Fri Jun 6 20:26:34 2008
New Revision: 664258
URL: http://svn.apache.org/viewvc?rev=664258&view=rev
Log:
Fixed: no validation complains if modified_by is nil.
Modified:
ode/sandbox/singleshot/app/models/task.rb
Modified: ode/sandbox/singleshot/app/models/task.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=664258&r1=664257&r2=664258&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Fri Jun 6 20:26:34 2008
@@ -84,7 +84,7 @@
from, to = task.status_change
case from # States you cannot transition from.
when 'suspended'
- task.errors.add :status, 'You are not allowed to resume this task.'
unless task.admin?(task.modified_by)
+ task.errors.add :status, 'You are not allowed to resume this task.'
unless task.modified_by && task.admin?(task.modified_by)
when 'completed'
task.errors.add :status, 'Cannot change status of completed task.'
when 'cancelled'
@@ -102,7 +102,7 @@
task.errors.add :status, 'Cannot change to completed from any status but
active.' unless from =='active'
task.errors.add :status, 'Only owner can complete task.' unless
task.owner && task.modified_by == task.owner && !task.owner_changed?
when 'cancelled'
- task.errors.add :status, 'You are not allowed to cancel this task.'
unless task.admin?(task.modified_by)
+ task.errors.add :status, 'You are not allowed to cancel this task.'
unless task.modified_by && task.admin?(task.modified_by)
end
task.readonly! if !task.status_changed? && (task.completed? ||
task.cancelled?)
end