[#4327] Show the deliverable's title in the Journal notes.
This commit is contained in:
@@ -2,12 +2,18 @@ module RedmineContracts
|
||||
module Hooks
|
||||
class ControllerIssuesEditBeforeSaveHook < Redmine::Hook::ViewListener
|
||||
def controller_issues_edit_before_save(context={})
|
||||
if context[:params] && context[:params][:issue] && context[:params][:issue][:deliverable_id].present?
|
||||
deliverable = Deliverable.find_by_id(context[:params][:issue][:deliverable_id])
|
||||
|
||||
if deliverable.contract.project == context[:issue].project
|
||||
context[:issue].deliverable = deliverable
|
||||
if context[:params] && context[:params][:issue]
|
||||
if context[:params][:issue][:deliverable_id].present?
|
||||
deliverable = Deliverable.find_by_id(context[:params][:issue][:deliverable_id])
|
||||
if deliverable.contract.project == context[:issue].project
|
||||
context[:issue].deliverable = deliverable
|
||||
end
|
||||
|
||||
else
|
||||
context[:issue].deliverable = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return ''
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
module RedmineContracts
|
||||
module Hooks
|
||||
class HelperIssuesShowDetailAfterSettingHook < Redmine::Hook::ViewListener
|
||||
# Deliverable changes for the journal use the Deliverable subject
|
||||
# instead of the id
|
||||
#
|
||||
# Context:
|
||||
# * :detail => Detail about the journal change
|
||||
#
|
||||
def helper_issues_show_detail_after_setting(context = { })
|
||||
# TODO Later: Overwritting the caller is bad juju
|
||||
if context[:detail].prop_key == 'deliverable_id'
|
||||
d = Deliverable.find_by_id(context[:detail].value)
|
||||
context[:detail].value = d.title if d.present? && d.title.present?
|
||||
|
||||
d = Deliverable.find_by_id(context[:detail].old_value)
|
||||
context[:detail].old_value = d.title if d.present? && d.title.present?
|
||||
end
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user