diff --git a/app/models/organization.rb b/app/models/organization.rb index 6708b6f66..e227ace37 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -2,4 +2,7 @@ class Organization < ActiveRecord::Base belongs_to :profile has_one :address, as: :placeable, dependent: :destroy accepts_nested_attributes_for :address, allow_destroy: true + + validates :name, presence: true + validates :address, presence: true end diff --git a/app/views/notifications_mailer/notify_admin_when_user_is_created.html.erb b/app/views/notifications_mailer/notify_admin_when_user_is_created.html.erb index cadac8f8c..503ec5aed 100644 --- a/app/views/notifications_mailer/notify_admin_when_user_is_created.html.erb +++ b/app/views/notifications_mailer/notify_admin_when_user_is_created.html.erb @@ -2,6 +2,10 @@

<%= t('.body.new_account_created') %> "<%= @attached_object.profile.full_name %> <<%= @attached_object.email%>>"

+<% if @attached_object.profile.organization %> +

<%= t('.body.account_for_organization') %> <%= @attached_object.profile.organization.name %>

+<% end %> + <% if @attached_object.invoicing_disabled? %>

<%= t('.body.invoicing_disabled_html') %>

<% end %> \ No newline at end of file diff --git a/config/locales/mails.en.yml b/config/locales/mails.en.yml index b0fa13f02..f9cd38755 100644 --- a/config/locales/mails.en.yml +++ b/config/locales/mails.en.yml @@ -116,6 +116,7 @@ en: subject: "A user account has been created" body: new_account_created: "A new user account has been created on the website:" + account_for_organization: "This account manage an organization:" invoicing_disabled_html: "Invoicing generation is disabled for this user." notify_admin_subscribed_plan: diff --git a/config/locales/mails.fr.yml b/config/locales/mails.fr.yml index faeca7d2c..2a0c8b6b6 100644 --- a/config/locales/mails.fr.yml +++ b/config/locales/mails.fr.yml @@ -116,6 +116,7 @@ fr: subject: "Un compte utilisateur a été créé" body: new_account_created: "Un nouveau compte utilisateur vient d'être créé sur la plateforme :" + account_for_organization: "Ce compte gère une structure :" invoicing_disabled_html: "La génération de factures est désactivée pour cet utilisateur." notify_admin_subscribed_plan: