kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
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.
43 lines
1.2 KiB
43 lines
1.2 KiB
12 years ago
|
#-- 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.
|
||
|
#++
|
||
|
|
||
12 years ago
|
class Reporting < ActiveRecord::Base
|
||
12 years ago
|
unloadable
|
||
|
|
||
12 years ago
|
self.table_name = 'reportings'
|
||
12 years ago
|
|
||
12 years ago
|
include TimestampsCompatibility
|
||
12 years ago
|
|
||
|
belongs_to :project
|
||
|
belongs_to :reporting_to_project, :class_name => 'Project',
|
||
|
:foreign_key => 'reporting_to_project_id'
|
||
|
|
||
12 years ago
|
belongs_to :reported_project_status, :class_name => 'ReportedProjectStatus',
|
||
12 years ago
|
: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)
|
||
12 years ago
|
reporting_to_project.visible?(user) && project.visible?(user)
|
||
12 years ago
|
end
|
||
|
|
||
|
def possible_reported_project_statuses
|
||
12 years ago
|
reporting_to_project.project_type.present? ?
|
||
|
reporting_to_project.project_type.reported_project_statuses :
|
||
12 years ago
|
[]
|
||
|
end
|
||
|
end
|