Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some trackers visibility #39

Open
wants to merge 1 commit into
base: redmine2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Portuguese Brazilian strings go here for Rails i18n
pt-BR:
trackcontrol_create_tracker: "Criar tipo %{value}"
trackcontrol_show_tracker: "Exibir tipo %{value}"
notice_no_valid_trackers_available: "Nenhum tipo válido está disponível. Por favor procure o Administrador do Redmine para assistência."
trackcontrol_tracker_not_allowed: "não permitido"
error_no_tracker_in_project: "Não há um tipo de tarefa associado a este projeto. Favor verificar as configurações do projeto."
24 changes: 20 additions & 4 deletions lib/redmine_track_control/tracker_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ def self.permission(tracker, permtype='create')
# Gets the list of valid trackers for the project for the current user
def self.valid_trackers_list(project, permtype='create')
if project
ltrackers = project.trackers
if permtype == 'show' and Setting.display_subprojects_issues?
if ltrackers.empty?
ltrackers = project.rolled_up_trackers
end
end
if project.enabled_modules.where(:name => "tracker_permissions").count == 1
project.trackers.select{|t| User.current.allowed_to?(permission(t,permtype), project, :global => true)}.collect {|t| [t.name, t.id]}
ltrackers.select{|t| User.current.allowed_to?(permission(t,permtype), project, :global => true)}.collect {|t| [t.name, t.id]}
else
project.trackers.collect {|t| [t.name, t.id]}
ltrackers.collect {|t| [t.name, t.id]}
end
else
Tracker.all.collect {|t| t.id}
end
end

Expand All @@ -37,11 +45,19 @@ def self.trackers_ids_by_role(role, permtype='create')
# Gets the list of valid trackers for the project for the current user
def self.valid_trackers_ids(project, permtype='create', usr=nil)
if project
ltrackers = project.trackers
if permtype == 'show' and Setting.display_subprojects_issues?
if ltrackers.empty?
ltrackers = project.rolled_up_trackers
end
end
if project.enabled_modules.where(:name => "tracker_permissions").count == 1
project.trackers.select{|t| (usr || User.current).allowed_to?(permission(t,permtype), project, :global => true)}.map {|t| t.id}
ltrackers.select{|t| (usr || User.current).allowed_to?(permission(t,permtype), project, :global => true)}.map {|t| t.id}
else
project.trackers.collect {|t| t.id}
ltrackers.collect {|t| t.id}
end
else
Tracker.all.collect {|t| t.id}
end
end

Expand Down