From 9011acc7a6092638b1d703a265f379dbe21d5bca Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 13 Mar 2018 10:34:02 +0100 Subject: [PATCH] Check whether expected plugins have been installed --- lib/redmine_dmsf/hooks/views/issue_view_hooks.rb | 4 +++- lib/redmine_dmsf/patches/easy_crm_case_patch.rb | 11 ++++++----- .../patches/easy_crm_cases_controller_patch.rb | 8 +++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb index b28cf1ad..9e8e2630 100644 --- a/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb +++ b/lib/redmine_dmsf/hooks/views/issue_view_hooks.rb @@ -71,7 +71,9 @@ module RedmineDmsf end def view_issues_show_thumbnails(context={}) - show_thumbnails(context[:container], context[:controller]) + unless context[:options][:only_mails].present? + show_thumbnails(context[:container], context[:controller]) + end end def view_issues_dms_thumbnails(context={}) diff --git a/lib/redmine_dmsf/patches/easy_crm_case_patch.rb b/lib/redmine_dmsf/patches/easy_crm_case_patch.rb index 1b979328..819793b8 100644 --- a/lib/redmine_dmsf/patches/easy_crm_case_patch.rb +++ b/lib/redmine_dmsf/patches/easy_crm_case_patch.rb @@ -178,9 +178,10 @@ module RedmineDmsf end end -# Apply patch -Rails.configuration.to_prepare do - unless EasyCrmCase.included_modules.include?(RedmineDmsf::Patches::EasyCrmCasePatch) - EasyCrmCase.send(:include, RedmineDmsf::Patches::EasyCrmCasePatch) +if Redmine::Plugin.installed?(:easy_crm) + Rails.configuration.to_prepare do + unless EasyCrmCase.included_modules.include?(RedmineDmsf::Patches::EasyCrmCasePatch) + EasyCrmCase.send(:include, RedmineDmsf::Patches::EasyCrmCasePatch) + end end -end +end \ No newline at end of file diff --git a/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb b/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb index 5222bd38..25ed21e2 100644 --- a/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb +++ b/lib/redmine_dmsf/patches/easy_crm_cases_controller_patch.rb @@ -95,8 +95,10 @@ module RedmineDmsf end end -Rails.configuration.to_prepare do - unless EasyCrmCasesController.included_modules.include?(RedmineDmsf::EasyCrmCasesControllerPatch) - EasyCrmCasesController.send(:include, RedmineDmsf::EasyCrmCasesControllerPatch) +if Redmine::Plugin.installed?(:easy_crm) + Rails.configuration.to_prepare do + unless EasyCrmCasesController.included_modules.include?(RedmineDmsf::EasyCrmCasesControllerPatch) + EasyCrmCasesController.send(:include, RedmineDmsf::EasyCrmCasesControllerPatch) + end end end