Changing text in email object field ?
Added by Gui MOC over 14 years ago
Dear All,
Is it possible to change the way to write the email object field ?
I want to get : "[Project Name] [tracker] [Issue]" instead of the default text.
I thank you in advance.
Guillaume
Replies (8)
RE: Changing text in email object field ? - Added by Eraldo Girardi over 14 years ago
+1
I would to change the mail subject to include value from a custom field.
Is there any way to do it?
RE: Changing text in email object field ? - Added by Felix Schäfer over 14 years ago
This would require patching core or writing a custom plugin.
RE: Changing text in email object field ? - Added by Eraldo Girardi over 14 years ago
I noticed that the email subject is hardcoded into the app/models/mailer.rb file, line 46.
So I think you have to edit this file in order to get different texts.
But I really don't know so well how to edit...
RE: Changing text in email object field ? - Added by Gui MOC over 14 years ago
in mailer.rb i get :
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject
subject s
My issues are stored with the following structure :
Project
Sub Project
Issue
So i want to get
[Project - Sub Project] [Issue]
Anyone can help me to get the Parent project from "issue.project" ?
Thanks
Guillaume
RE: Changing text in email object field ? - Added by Felix Schäfer over 14 years ago
Try issue.project.parent.name
.
RE: Changing text in email object field ? - Added by Gui MOC over 14 years ago
OK ... shame on me !
Thanks ;-)
RE: Changing text in email object field ? - Added by Joseph Rossi over 12 years ago
I would like to use the @issue.project.parent.name to display the parent project name in emails.
So I changed the templates and it works well when I am in a sub project. But if I try to edit an issue in a root project, I have an error 500 as there is no parent project:
ActionView::TemplateError (undefined method `name' for nil:NilClass)
I would like to insert an 'if' to ask for the parent.name only when it exists. Can somebody tell me how to do this? Or have another workaround.
Thanks
RE: Changing text in email object field ? - Added by JayD - over 10 years ago
Gui MOC wrote:
Dear All,
Is it possible to change the way to write the email object field ?
I want to get : "[Project Name] [tracker] [Issue]" instead of the default text.
I'm attaching a patch modifying app/models/mailer.rb
implementing the following scheme for the mail subject:
[Parent Project Name] [Subproject Name] [tracker] [Issue]
If creating or updating an issue within a top-level project it will take the default scheme:
[Project Name] [tracker] [Issue]
I've tested it on redmine 2.5.1.
Joseph Rossi wrote:
I would like to use the @issue.project.parent.name to display the parent project name in emails.
So I changed the templates and it works well when I am in a sub project. But if I try to edit an issue in a root project, I have an error 500 as there is no parent project:
Have a look at it, it should answer your question.