#1179 sub-projects

This commit is contained in:
karel.picman@lbcfree.net 2020-10-16 08:23:02 +02:00
parent 442e054156
commit 90dbcd1765
2 changed files with 9 additions and 10 deletions

View File

@ -185,16 +185,16 @@ module RedmineDmsf
end end
end end
def self.get_project(name, parent_project) def self.get_project(scope, name, parent_project)
prj = nil prj = nil
if Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] if Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
#if name =~ /^\[?.+ (\d+)\]?$/ #if name =~ /^\[?.+ (\d+)\]?$/
if name =~ / (\d+)$/ if name =~ / (\d+)$/
#prj = Project.visible.find_by(id: $1, parent_id: parent_project&.id) #prj = scope.find_by(id: $1, parent_id: parent_project&.id)
if parent_project if parent_project
prj = Project.visible.find_by(id: $1, parent_id: parent_project.id) prj = scope.find_by(id: $1, parent_id: parent_project.id)
else else
prj = Project.visible.find_by(id: $1) prj = scope.find_by(id: $1)
end end
if prj if prj
# Check again whether it's really the project and not a folder with a number as a suffix # Check again whether it's really the project and not a folder with a number as a suffix
@ -204,13 +204,12 @@ module RedmineDmsf
end end
else else
# if name =~ /^\[?([^\]]+)\]?$/ # if name =~ /^\[?([^\]]+)\]?$/
# prj = Project.visible.find_by(identifier: $1, parent_id: parent_project&.id) # prj = scope.find_by(identifier: $1, parent_id: parent_project&.id)
# end # end
#prj = Project.visible.find_by(identifier: name, parent_id: parent_project&.id)
if parent_project if parent_project
prj = Project.visible.find_by(identifier: name, parent_id: parent_project.id) prj = scope.find_by(identifier: name, parent_id: parent_project.id)
else else
prj = Project.visible.find_by(identifier: name) prj = scope.find_by(identifier: name)
end end
end end
prj prj
@ -223,7 +222,7 @@ module RedmineDmsf
pinfo = @path.split('/').drop(1) pinfo = @path.split('/').drop(1)
i = 1 i = 1
while pinfo.length > 0 while pinfo.length > 0
prj = BaseResource::get_project(pinfo.first, @project) prj = BaseResource::get_project(Project.visible, pinfo.first, @project)
if prj if prj
@project = prj @project = prj
if pinfo.length == 1 if pinfo.length == 1

View File

@ -180,7 +180,7 @@ module RedmineDmsf
project = nil project = nil
prj = nil prj = nil
while pinfo.length > 0 while pinfo.length > 0
prj = BaseResource::get_project(pinfo.first, project) prj = BaseResource::get_project(Project, pinfo.first, project)
if prj if prj
project = prj project = prj
else else