Permalink
Browse files

Better error checking for 'isvalid' function.

  • Loading branch information...
1 parent 9fad319 commit 022e4e37e72ed8f0da41ede86090f97c7e11a061 @scrapper scrapper committed Sep 25, 2013
Showing with 13 additions and 1 deletion.
  1. +13 −1 lib/taskjuggler/LogicalFunction.rb
View
14 lib/taskjuggler/LogicalFunction.rb
@@ -250,7 +250,19 @@ def isvalid(expr, args)
expr.error("Unknown attribute '#{attr}' used for function " +
"isvalid()")
end
- !property[attr, scenarioIdx].nil?
+ if scenario
+ unless property.attributeDefinition(attr).scenarioSpecific
+ expr.error("Attribute '#{attr}' of property '#{property.fullId}' " +
+ "is not scenario specific. Don't provide a scenario ID!")
+ end
+ !property[attr, scenarioIdx].nil?
+ else
+ if property.attributeDefinition(attr).scenarioSpecific
+ expr.error("Attribute '#{attr}' of property '#{property.fullId}' " +
+ "is scenario specific. Please provide a scenario ID!")
+ end
+ !property.get(attr).nil?
+ end
end
def treelevel(expr, args)

0 comments on commit 022e4e3

Please sign in to comment.