diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-29 16:10:52 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-29 16:10:52 +0000 |
commit | 184ffeccb7f4579b481db9b7744aa9baed70562f (patch) | |
tree | 67c023b029a699a1e727ef6becdc0832e82ea1c5 /app/models/outgoing_message.rb | |
parent | e44c8b875fd4ad46b954ef9c31bdb6f0366dcb9e (diff) | |
parent | 79b2f672aeae394a2c195d89b70bda27bb3201a4 (diff) |
Merge branch 'feature/batch-requests' into rails-3-develop
Conflicts:
config/general.yml-example
spec/factories.rb
Diffstat (limited to 'app/models/outgoing_message.rb')
-rw-r--r-- | app/models/outgoing_message.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 6efc1d2ba..a435511d3 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -1,4 +1,5 @@ # == Schema Information +# Schema version: 20131024114346 # # Table name: outgoing_messages # @@ -67,15 +68,30 @@ class OutgoingMessage < ActiveRecord::Base # How the default letter starts and ends def get_salutation + if self.info_request.is_batch_request_template? + return OutgoingMessage.placeholder_salutation + end ret = "" if self.message_type == 'followup' && !self.incoming_message_followup.nil? && !self.incoming_message_followup.safe_mail_from.nil? && self.incoming_message_followup.valid_to_reply_to? ret = ret + OutgoingMailer.name_for_followup(self.info_request, self.incoming_message_followup) else - ret = ret + self.info_request.public_body.name + return OutgoingMessage.default_salutation(self.info_request.public_body) end salutation = _("Dear {{public_body_name}},", :public_body_name => ret) end + def OutgoingMessage.default_salutation(public_body) + _("Dear {{public_body_name}},", :public_body_name => public_body.name) + end + + def OutgoingMessage.placeholder_salutation + _("Dear [Authority name],") + end + + def OutgoingMessage.fill_in_salutation(body, public_body) + body.gsub(placeholder_salutation, default_salutation(public_body)) + end + def get_signoff if self.message_type == 'followup' && !self.incoming_message_followup.nil? && !self.incoming_message_followup.safe_mail_from.nil? && self.incoming_message_followup.valid_to_reply_to? return _("Yours sincerely,") |