lib/taskjuggler/Query.rb in taskjuggler-3.5.0 vs lib/taskjuggler/Query.rb in taskjuggler-3.6.0
- old
+ new
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = Query.rb -- The TaskJuggler III Project Management Software
#
-# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
-# by Chris Schlaeger <chris@linux.com>
+# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
+# by Chris Schlaeger <cs@taskjuggler.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
@@ -124,11 +124,11 @@
begin
# Resolve property reference from property ID.
if @propertyId && (@property.nil? || @propertyId[0] == '!')
@property = resolvePropertyId(@propertyType, @propertyId)
unless @property
- @errorMessage = "Unknown property #{@propertyId} queried"
+ @errorMessage = "Unknown property '#{@propertyId}' queried"
return @ok = false
end
end
unless @property
@@ -195,11 +195,16 @@
# scenario-specific attributs.
aType = @property.attributeDefinition(@attributeId)
raise ArgumentError unless aType
scIdx = aType.scenarioSpecific ? @scenarioIdx : nil
@attr = @property.getAttribute(@attributeId, scIdx)
+ if @attr.nil? && @attr.is_a?(DateAttribute)
+ @errorMessage = "Attribute '#{@attributeId}' of property " +
+ "'#{@property.fullId}' has undefined value."
+ return @ok = false
+ end
rescue ArgumentError
- @errorMessage = "Unknown attribute #{@attributeId} queried"
+ @errorMessage = "Unknown attribute '#{@attributeId}' queried"
return @ok = false
end
end
rescue TjException
@errorMessage = $!.message