Skip to content

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

Fix zeitwerk check

Oliver Günther5e61db5f8411
diff --git a/modules/budgets/lib/budgets/hooks/work_package_hook.rb b/modules/budgets/lib/budgets/hooks/work_package_hook.rb
index 862b5b84a5b..fed52606065 100644
--- a/modules/budgets/lib/budgets/hooks/work_package_hook.rb
+++ b/modules/budgets/lib/budgets/hooks/work_package_hook.rb
@@ -26,48 +26,52 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Budgets::Hooks::WorkPackageHook < OpenProject::Hook::ViewListener
- # Updates the cost object after a move
- #
- # Context:
- # * params => Request parameters
- # * work_package => WorkPackage to move
- # * target_project => Target of the move
- # * copy => true, if the work_packages are copied rather than moved
- def controller_work_packages_move_before_save(context = {})
- # FIXME: In case of copy==true, this will break stuff if the original work_package is saved
+module Budgets
+ module Hooks
+ class WorkPackageHook < ::OpenProject::Hook::ViewListener
+ # Updates the cost object after a move
+ #
+ # Context:
+ # * params => Request parameters
+ # * work_package => WorkPackage to move
+ # * target_project => Target of the move
+ # * copy => true, if the work_packages are copied rather than moved
+ def controller_work_packages_move_before_save(context = {})
+ # FIXME: In case of copy==true, this will break stuff if the original work_package is saved
- budget_id = context[:params] && context[:params][:budget_id]
- case budget_id
- when '' # a.k.a "(No change)"
- # cost objects HAVE to be changed if move is performed across project boundaries
- # as the are project specific
- context[:work_package].budget_id = nil unless context[:work_package].project == context[:target_project]
- when 'none'
- context[:work_package].budget_id = nil
- else
- context[:work_package].budget_id = budget_id
- end
- end
+ budget_id = context[:params] && context[:params][:budget_id]
+ case budget_id
+ when '' # a.k.a "(No change)"
+ # cost objects HAVE to be changed if move is performed across project boundaries
+ # as the are project specific
+ context[:work_package].budget_id = nil unless context[:work_package].project == context[:target_project]
+ when 'none'
+ context[:work_package].budget_id = nil
+ else
+ context[:work_package].budget_id = budget_id
+ end
+ end
- # Saves the Cost Object assignment to the work_package
- #
- # Context:
- # * :work_package => WorkPackage being saved
- # * :params => HTML parameters
- #
- def controller_work_packages_bulk_edit_before_save(context = {})
- case true
+ # Saves the Cost Object assignment to the work_package
+ #
+ # Context:
+ # * :work_package => WorkPackage being saved
+ # * :params => HTML parameters
+ #
+ def controller_work_packages_bulk_edit_before_save(context = {})
+ case true
- when context[:params][:budget_id].blank?
- # Do nothing
- when context[:params][:budget_id] == 'none'
- # Unassign budget
- context[:work_package].budget = nil
- else
- context[:work_package].budget = Budget.find(context[:params][:budget_id])
- end
+ when context[:params][:budget_id].blank?
+ # Do nothing
+ when context[:params][:budget_id] == 'none'
+ # Unassign budget
+ context[:work_package].budget = nil
+ else
+ context[:work_package].budget = Budget.find(context[:params][:budget_id])
+ end
- ''
+ ''
+ end
+ end
end
end
diff --git a/modules/reporting/lib/open_project/reporting/patches/big_decimal_patch.rb b/modules/reporting/lib/open_project/reporting/patches/big_decimal_patch.rb
index ccbb4d472f9..15edc73208e 100644
--- a/modules/reporting/lib/open_project/reporting/patches/big_decimal_patch.rb
+++ b/modules/reporting/lib/open_project/reporting/patches/big_decimal_patch.rb
@@ -26,22 +26,34 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-module OpenProject::Reporting::Patches::BigDecimalPatch
- class BigDecimal
- def to_d; self end
- end
+module OpenProject
+ module Reporting
+ module Patches
+ module BigDecimalPatch
+ class BigDecimal
+ def to_d
+ self
+ end
+ end
- class Integer
- def to_d; to_f.to_d end
- end
+ class Integer
+ def to_d
+ to_f.to_d
+ end
+ end
- class String
- def to_d
- BigDecimal self
- end
- end
+ class String
+ def to_d
+ BigDecimal self
+ end
+ end
- class NilClass
- def to_d; 0 end
+ class NilClass
+ def to_d
+ 0
+ end
+ end
+ end
+ end
end
end