OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/models/timelines/reporting.rb

42 lines
1.3 KiB

#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2012-2013 the OpenProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
class Timelines::Reporting < ActiveRecord::Base
unloadable
self.table_name = 'timelines_reportings'
include Timelines::TimestampsCompatibility
belongs_to :project
belongs_to :reporting_to_project, :class_name => 'Project',
:foreign_key => 'reporting_to_project_id'
belongs_to :reported_project_status, :class_name => 'Timelines::ReportedProjectStatus',
:foreign_key => 'reported_project_status_id'
attr_accessible :reported_project_status_comment,
:reported_project_status_id
validates_presence_of :project, :reporting_to_project
validates_uniqueness_of :reporting_to_project_id, :scope => :project_id
def visible?(user = User.current)
reporting_to_project.timelines_visible?(user) && project.timelines_visible?(user)
end
def possible_reported_project_statuses
reporting_to_project.timelines_project_type.present? ?
reporting_to_project.timelines_project_type.reported_project_statuses :
[]
end
end