Project

General

Profile

Internal Error when using Computed Custom Field with other plugins

Added by Thomas L almost 3 years ago

Sorry if this doesn't belong here but I can't find any way to contact the current maintainer directly.

The Computed Custom Field plugin can cause internal server errors when creating/editing model objects from other plugins that do not include the `acts_as_customizable` extension. (eg. RedmineUP CRM)

I have tested the following fix to the file https://github.com/annikoff/redmine_plugin_computed_custom_field/blob/master/lib/computed_custom_field/model_patch.rb, although I'm not certain this is the best solution.

diff --git a/lib/computed_custom_field/model_patch.rb b/lib/computed_custom_field/model_patch.rb
index b708707..ba6eb96 100644
--- a/lib/computed_custom_field/model_patch.rb
+++ b/lib/computed_custom_field/model_patch.rb
@@ -9,6 +9,7 @@ module ComputedCustomField
     private

     def eval_computed_fields
+      return unless self.class.method_defined? :custom_field_values
       custom_field_values.each do |value|
         next unless value.custom_field.is_computed?
         eval_computed_field value.custom_field