InitiatedEmail: add initiated email

This commit is contained in:
Simon Lehericey 2017-03-07 10:25:28 +01:00
parent 6be76095c6
commit 47fc6e6957
5 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,15 @@
class InitiatedMail < MailTemplate
def name
"E-mail d'accusé de réception"
end
def self.default
obj = "[TPS] Accusé de réception pour votre dossier n°--numero_dossier--"
body = ActionController::Base.new.render_to_string(template: 'notification_mailer/initiated_mail')
InitiatedMail.new(object: obj, body: body)
end
def self.slug
self.name.parameterize
end
end

View file

@ -6,6 +6,8 @@ class Procedure < ActiveRecord::Base
has_many :mail_templates
has_one :mail_received
has_one :initiated_mail
has_one :procedure_path, dependent: :destroy
has_one :module_api_carto, dependent: :destroy

View file

@ -0,0 +1,11 @@
Bonjour,
<br>
<br>
Votre administration vous confirme la bonne réception de votre dossier n°--numero_dossier-- complet. Celui-ci sera instruit dans le délai légal déclaré par votre interlocuteur.<br>
<br>
En vous souhaitant une bonne journée,
<br>
<br>
---
<br>
L'équipe TPS

View file

@ -0,0 +1,12 @@
class CreateInitiatedMails < ActiveRecord::Migration[5.0]
def change
create_table :initiated_mails do |t|
t.text :object
t.text :body
t.belongs_to :procedure, index: true, unique: true, foreign_key: true
t.column :created_at, :timestamp, null: true
t.column :updated_at, :timestamp, null: true
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170228150522) do
ActiveRecord::Schema.define(version: 20170302105557) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -225,6 +225,15 @@ ActiveRecord::Schema.define(version: 20170228150522) do
t.index ["dossier_id"], name: "index_individuals_on_dossier_id", using: :btree
end
create_table "initiated_mails", force: :cascade do |t|
t.text "object"
t.text "body"
t.integer "procedure_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["procedure_id"], name: "index_initiated_mails_on_procedure_id", using: :btree
end
create_table "invites", force: :cascade do |t|
t.string "email"
t.string "email_sender"
@ -388,6 +397,7 @@ ActiveRecord::Schema.define(version: 20170228150522) do
add_foreign_key "cerfas", "dossiers"
add_foreign_key "commentaires", "dossiers"
add_foreign_key "dossiers", "users"
add_foreign_key "initiated_mails", "procedures"
add_foreign_key "procedure_paths", "administrateurs"
add_foreign_key "procedure_paths", "procedures"