lib/taskjuggler/TimeSheets.rb in taskjuggler-3.1.0 vs lib/taskjuggler/TimeSheets.rb in taskjuggler-3.2.0

- old
+ new

@@ -18,10 +18,12 @@ # it's ID String. For effort based task, it stores the remaining effort, for # other task the expected end date. For all tasks it stores the completed # work during the reporting time frame. class TimeSheetRecord + include MessageHandler + attr_reader :task, :work attr_accessor :sourceFileInfo, :remaining, :expectedEnd, :status, :priority, :name def initialize(timeSheet, task) @@ -231,18 +233,10 @@ @task['end', @timeSheet.scenarioIdx] end private - def error(id, text) - @timeSheet.error(id, text, @sourceFileInfo) - end - - def warning(id, text) - @timeSheet.warning(id, text, @sourceFileInfo) - end - end # The TimeSheet class stores the work related bits of a time sheet. For each # task it holds a TimeSheetRecord object. A time sheet is always bound to an # existing Resource. @@ -262,10 +256,11 @@ # This flag is set to true if at least one record was reported as # percentage. @percentageUsed = false # The TimeSheetRecord list. @records = [] + @messageHandler = MessageHandlerInstance.instance end # Add a new TimeSheetRecord to the list. def<<(record) @records.each do |r| @@ -366,16 +361,15 @@ ((days * 60 * 60 * @resource.project.dailyWorkingHours) / @resource.project['scheduleGranularity']).to_i end def error(id, text, sourceFileInfo = nil) - @resource.project.messageHandler.error( - id, text, sourceFileInfo || @sourceFileInfo, nil, @resource) + @messageHandler.error(id, text, sourceFileInfo || @sourceFileInfo, + nil, @resource) end def warning(id, text, sourceFileInfo = nil) - @resource.project.messageHandler.warning(id, text, sourceFileInfo, nil, - @resource) + @messageHandler.warning(id, text, sourceFileInfo, nil, @resource) end private def workWithUnit(slots)