diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 8ab4f41c..87cb9945 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -117,7 +117,12 @@ class DmsfFolder < ApplicationRecord # System folder? if folder&.system return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project) - return false if folder.title != '.Issues' && !folder.issue&.visible?(User.current) + + if %(.Issues .CRM cases).exclude?(folder.title) && + !folder.issue&.visible?(User.current) && + !folder.easy_crm_case&.visible?(User.current) + return false + end end # Permissions to the folder? if folder.dmsf_folder_permissions.any? @@ -481,6 +486,19 @@ class DmsfFolder < ApplicationRecord @issue end + def easy_crm_case + if easy_crm_case.nil? && system + case_id = title.to_i + begin + ecc = 'EasyCrmCase'.constantize + rescue NameError => _e + ecc = nil + end + easy_crm_case = EasyCrmCase.find_by(id: case_id) if ecc && case_id.positive? + end + easy_crm_case + end + def update_from_params(params) # Attributes self.title = params[:dmsf_folder][:title].scrub.strip