OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Provide an url with wps that still use a type when trying to delete the according type. Further archived projects that use this type are listed, too.
Henriette Darge79bd1dc99ca4
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rbindex f5566f6eff0..64076cae933 100644--- a/app/controllers/types_controller.rb+++ b/app/controllers/types_controller.rb@@ -121,7 +121,18 @@ class TypesController < ApplicationControllerflash[:error] = if @type.is_standard?t(:error_can_not_delete_standard_type)else- t(:error_can_not_delete_type)+ error_message = [+ t(:'error_can_not_delete_type.explanation',+ { url: belonging_wps_url(@type.id)}).html_safe+ ]++ archived_projects = @type.projects.filter(&:archived?)+ error_message.push(+ t(:'error_can_not_delete_type.archived_projects',+ { archived_projects: archived_projects.map(&:name).join(', ')}).html_safe+ ) if archived_projects.length > 0++ error_messageendendredirect_to action: 'index'@@ -165,4 +176,8 @@ class TypesController < ApplicationControllerdef show_local_breadcrumbtrueend++ def belonging_wps_url(type_id)+ work_packages_path query_props: '{"f":[{"n":"type","o":"=","v":[' + type_id.to_s + ']}]}'+ endenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex f4843f2a142..8c3a0e56780 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -934,7 +934,7 @@ en:user: "User"version: "Version"work_package: "Work package"-+backup:label_backup_token: "Backup token"label_create_token: "Create backup token"@@ -1237,7 +1237,9 @@ en:error_can_not_archive_project: "This project cannot be archived: %{errors}"error_can_not_delete_entry: "Unable to delete entry"error_can_not_delete_custom_field: "Unable to delete custom field"- error_can_not_delete_type: "This type contains work packages and cannot be deleted."+ error_can_not_delete_type:+ explanation: 'This type contains work packages and cannot be deleted. You can see all affected work packages in <a target="_blank" href="%{url}">this view</a>.'+ archived_projects: 'There are also work packages in archived projects. You need to reactivate the following projects first, before you can change the type of the respective work packages: %{archived_projects}'error_can_not_delete_standard_type: "Standard types cannot be deleted."error_can_not_invite_user: "Failed to send invitation to user."error_can_not_remove_role: "This role is in use and cannot be deleted."@@ -3125,5 +3127,5 @@ en:authorization_error: "An authorization error has occurred."revoke_my_application_confirmation: "Do you really want to remove this application? This will revoke %{token_count} active for it."my_registered_applications: "Registered OAuth applications"-+you: you