From 5a0684c4a3ffac494b919a936e13372325e72837 Mon Sep 17 00:00:00 2001
From: "p.tessenow"
Date: Mon, 4 Oct 2010 09:34:18 +0000
Subject: [PATCH] =,! including child projects operators now use validations
git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1846 7926756e-e54e-46e6-9721-ed318f58905e
---
app/models/cost_query/operator.rb | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/app/models/cost_query/operator.rb b/app/models/cost_query/operator.rb
index 46f6e14194..667b2291ba 100644
--- a/app/models/cost_query/operator.rb
+++ b/app/models/cost_query/operator.rb
@@ -190,20 +190,16 @@ class CostQuery::Operator
end
end
- new "=_child_projects", :label => :label_is_project_with_subprojects do
+ new "=_child_projects", :validate => :integers, :label => :label_is_project_with_subprojects do
def modify(query, field, value)
- # ensure value is an integer
- return query unless value.to_i.to_s == value.to_s
"=".to_operator.modify query, field, [value, *Project.find(value).children.map{ |p| p.id }]
rescue ActiveRecord::RecordNotFound
query
end
end
- new "!_child_projects", :label => :label_is_not_project_with_subprojects do
+ new "!_child_projects", :validate => :integers, :label => :label_is_not_project_with_subprojects do
def modify(query, field, value)
- # ensure value is an integer
- return query unless value.to_i.to_s == value.to_s
"!".to_operator.modify query, field, [value, *Project.find(value).children.map{ |p| p.id }]
rescue ActiveRecord::RecordNotFound
query