Commit graph

1431 commits

Author SHA1 Message Date
Christophe Robillard
6e0d1eaee3 remove email ignored column for admin and instructeur 2020-02-17 15:01:40 +01:00
Paul Chavard
1ce1c1e6d0 use discard 2020-02-13 12:31:59 +01:00
Pierre de La Morinerie
f8ed7ec051 form: display index of section in header 2020-02-13 11:18:46 +01:00
kara Diaby
0b8a59d5e9 Add the possibility to disable weekly email notifications (instructeur) && rename the column email_notifications_enabled to daily_email_notification_enabled 2020-02-12 13:02:31 +00:00
Pierre de La Morinerie
e3ba2ed96c Revert "form: add number to section headers"
This reverts commit f42977e40a.
2020-02-12 13:54:44 +01:00
Paul Chavard
7afeae1408 remove dossier.linked_dossiers 2020-02-11 17:49:22 +01:00
Paul Chavard
0d55743d9f linked_dossiers_for should include dossiers_from_avis 2020-02-11 17:38:58 +01:00
Paul Chavard
f0ea96772d Only invite experts to dossiers instructeur have access to 2020-02-11 17:38:57 +01:00
Pierre de La Morinerie
f42977e40a form: add number to section headers 2020-02-11 17:36:50 +01:00
Christophe Robillard
91f1722088 admin: always eager load the user relationship
Now that `Administrateur.email` is merely an alias to
`administrateur.user.email`,
and we changed every occurence of `administrateurs.pluck(:email)` to
`administrateurs.map(&:email)`, the new version using `map` may cause N+1
queries if the users have not been preloaded.

  It makes sense to always preload the user when fetching an
  Administrateur:

  - Administrateur and User have a strongly coupled relationship
  - It avoids N+1 queries everywhere in the app

  Of course fetching an administrateur without needing its user will now do
  an unecessary fetch of the associated user. But it seems better than
  leaving a risk of N+1 queries in many places.
2020-02-04 16:21:42 +01:00
Christophe Robillard
4a1980e95a admin: disable the email column 2020-02-04 16:21:42 +01:00
Christophe Robillard
ed970d3f3c admin: create without providing email 2020-02-04 16:21:42 +01:00
Christophe Robillard
2bb161c3cb admin: alias Administrateur.email 2020-02-04 16:21:42 +01:00
Christophe Robillard
055918aabc admin: replace calls to Administrateur.find_by(email: ...) 2020-02-04 16:21:42 +01:00
Christophe Robillard
c137917396 fix typo 2020-02-04 16:07:01 +01:00
Christophe Robillard
deb11f281f remove useless relation between administrateur and dossiers 2020-02-04 16:07:01 +01:00
Christophe Robillard
5a46effcbc remove useless condition to admin that can be deleted
administrateur can be deleted only if he/she has a procedure where
he/she is the only admin
2020-02-04 16:07:01 +01:00
Christophe Robillard
6fc8a27bd7 destroys not all dossiers
but only dossiers for a specific user
2020-02-04 16:07:01 +01:00
Christophe Robillard
cee4c5b8fb Revert "Revert "4127 fix superadmin supprime compte usager""
This reverts commit 751f24f7bb.
2020-02-04 16:07:01 +01:00
clemkeirua
fcea7c4f85 remove invalid excel worksheet characters 2020-01-29 11:45:56 +01:00
Pierre de La Morinerie
96932faa3f models: add a Dossier#with_hidden scope, and remove unscoped usages 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
1448d5b098 models: add a Procedure#with_hidden scope, and remove unscoped usages
This avoids the broad use of `unscoped` to remove the `hidden_at`
clause.
2020-01-28 17:32:38 +01:00
Paul Chavard
eec38bad73 Ajouter les informations de l’instructeur et de l’expert dans l’export des avis
fix #4667
2020-01-28 15:09:41 +01:00
Pierre de La Morinerie
9da4fa9f4d dossier: ensure the dossier groupe_instructeur is always present
Otherwise we loose the link to the dossier's procedure, which is
definitely a bad thing.
2020-01-28 14:58:34 +01:00
clemkeirua
696e39761f deal with secondary_options that can be nil 2020-01-28 14:30:26 +01:00
clemkeirua
65b4bcf3a1 Permet de déposer un dossier lorsqu'un menu déroulant lié obligatoire n'a pas de valeur (car la liste est légitimement vide) dans le second champ. 2020-01-28 14:30:26 +01:00
Paul Chavard
517ab25783 Register canonical procedure when demarche republished under existing path 2020-01-28 12:49:53 +01:00
Pierre de La Morinerie
751f24f7bb
Revert "4127 fix superadmin supprime compte usager" 2020-01-21 18:57:54 +01:00
Christophe Robillard
88e73d4039 raise exception if problem with destroy 2020-01-21 15:05:33 +01:00
Christophe Robillard
675bbdad15 transfere les services lors de suppression admin
Lorsqu'un administrateur est supprimé, ses services sont transférés à un
autre administrateur pour chacune de ses procédures
2020-01-21 15:05:33 +01:00
Christophe Robillard
d9570eedc6 empêche suppression d'un user qui est instructeur 2020-01-21 15:05:33 +01:00
Christophe Robillard
a6d007dbd3 supprime un instructeur 2020-01-21 15:05:33 +01:00
Christophe Robillard
d4de5769ee empêche la suppression d'un user qui est admin 2020-01-21 15:05:33 +01:00
Christophe Robillard
d8a51f986f supprime un utilisateur qui a des dossiers cachés 2020-01-21 15:05:33 +01:00
clemkeirua
12430a8068 ajout d'un écran intermediaire pour gérer la reaffectation des dossiers 2020-01-20 16:15:02 +01:00
clemkeirua
d6e7799370 removed routing condition in weekly summary 2020-01-20 14:23:19 +01:00
clemkeirua
7e15c6a4a4 add filtering by group in procedure_overview
The weekly overview do not work for instructeurs in procedures with multiples groups ;
they see dossiers that they do not have access to. Now the correct filter is added
2020-01-20 14:23:19 +01:00
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +01:00
Paul Chavard
14295db9ad Revert "Revert "Merge pull request #4552 from tchak/champ-communes""
This reverts commit 4373cb22cb.
2020-01-14 18:46:07 +01:00
clemkeirua
4373cb22cb Revert "Merge pull request #4552 from tchak/champ-communes"
This reverts commit 4cec26f73a, reversing
changes made to 0ef25ef36c.
2020-01-13 16:26:27 +01:00
Christophe Robillard
0f881f942b raise if trying to del a user who can't be deleted 2020-01-13 10:06:43 +01:00
Christophe Robillard
696a058280 delete adminis with procs managed by other admins 2020-01-13 10:06:43 +01:00
Christophe Robillard
9a62d3fe0c delete a user 2020-01-13 10:06:43 +01:00
Christophe Robillard
58ef36ff57 tells if a user can be deleted 2020-01-13 10:06:43 +01:00
Paul Chavard
785a09b326 Use service_url instead of blob_url on secure attachments 2020-01-08 14:43:05 +01:00
Paul Chavard
cccb04d725 ActiveStorage url should expire after an hour 2020-01-08 14:43:05 +01:00
Pierre de La Morinerie
b3558c497d dossiers: make build_default_individual explicit
It avoid the use of callbacks, and may avoid situations where an empty
individual is implicitely created.
2020-01-08 10:48:22 +01:00
Pierre de La Morinerie
5e05556ee8 dossiers: add a validation on dossier individual
Validate that a dossier on a `for_individual?` procedure always has
an `individual` associated record.

For this, the individual needs to be built before the record is
validated (i.e. even before the `before_create` callback is run).

This should help with #4596: now if a dossier is created without an
`individual`, or if the `invividual` record is later removed, the
validation will fail.
2020-01-08 10:48:22 +01:00
Paul Chavard
4bbd16576b Add champ communes 2020-01-07 11:52:51 +01:00
Paul Chavard
22aa2d4ee0 Make all location champs autocomplete 2020-01-07 11:52:51 +01:00
Paul Chavard
fa2eea81aa Cleanup demarche archivee state 2020-01-07 11:13:42 +01:00
simon lehericey
d0939ae1a4 Add Export Model 2019-12-18 13:13:15 +01:00
Paul Chavard
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +01:00
Paul Chavard
e429c79eb1 Allow administrators to set themselves démarches as déclaratives 2019-12-04 12:30:26 +01:00
Christophe Robillard
4e7c779116 refuse les numéros de tel invalides
rend facultatif les numéros de téléphone
2019-12-04 05:34:43 +01:00
simon lehericey
006e426a11 Work on deletion mail 2019-12-03 17:18:53 +01:00
simon lehericey
79bfb8b143 Delete expired dossiers 2019-12-03 17:18:53 +01:00
simon lehericey
03b7e81ca4 Send deletion notice for near expired brouillon 2019-12-03 17:18:53 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Paul Chavard
c1c8ab7ac6 Disable transition from publiée to brouillon 2019-11-28 14:17:47 +01:00
Paul Chavard
3e334a3306 Drop test_started_at
# Conflicts:
#	spec/models/procedure_spec.rb
2019-11-28 14:17:47 +01:00
maatinito
9de9a1fd71 Use time.zone functions instead of server time functions
(Time.zone.today vs Date.today)
2019-11-26 14:26:36 +01:00
simon lehericey
f45ede7f44 href should not contain space 2019-11-21 15:34:59 +01:00
Paul Chavard
0c6705f7fd Drop old export service 2019-11-21 10:25:40 +01:00
Paul Chavard
ba03dbf8dd [GraphQL] Add dossierEnvoyerMessage mutation 2019-11-13 19:54:27 +01:00
Pierre de La Morinerie
88373ddf20 individual: raise when the individual object cannot be created
Currently, a number of dossiers in production are for procedures for
individuals, but don't have a `individual` object.

This is probably because creating the Individual from France Connect
infos fails – but fails quietly, and nullify the relationship.

As a first step, we now raise an exception when the creation from FC
infos fails. We will then identify the issue, and see if we can fix it –
or if we should be resilient to this kind of issues.
2019-11-12 18:29:37 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
f22b39b7c5 Handle non unique champ repetable labels
fix #4466
2019-11-07 14:27:52 +01:00
Paul Chavard
2a61ed5b1c Export etablissement information in csv
fix #4440
2019-11-07 14:27:52 +01:00
clemkeirua
04c13190c3 introduce smtp_key in order to use 2 different sendinblue keys
client_key is exposed to the client via gon, so if we use it for sending email too we are exposing a key so anybody could send an email.
The current client_key has a different level of right and can't send emails so it's ok to expose it.
2019-11-06 13:34:36 +01:00
clemkeirua
959aacdea5 Sendinblue email balancing using proper credentials
This reverts commit c61981e795.
2019-11-06 13:34:36 +01:00
Paul Chavard
0562e2728f Fix type_de_champ validation error 2019-11-06 12:54:07 +01:00
Paul Chavard
ee62d6fca4 Fix move type de champs 2019-11-06 12:54:07 +01:00
simon lehericey
9f5169eb7d Remove unused Administrateur.reset_password method 2019-11-05 14:10:39 +01:00
simon lehericey
395aba8bbc Remove administrateur active notion 2019-11-05 14:10:39 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
simon lehericey
b193dd1465 User get the active notion 2019-11-05 14:10:39 +01:00
simon lehericey
e3d7688e66 [fix #4473] Invite_administrateur!: do not reset password if the user is active 2019-11-05 10:29:39 +01:00
simon lehericey
243bc2887f Invite_administrateur!: remove unused return 2019-11-05 10:29:39 +01:00
clemkeirua
c61981e795 Revert "Sendinblue email balancing using interceptor"
This reverts commit b2135b6576.
2019-11-04 15:55:08 +01:00
Chaïb Martinez
b2135b6576 Sendinblue email balancing using interceptor
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
2019-11-04 15:30:44 +01:00
Pierre de La Morinerie
2e8d365b93 instructeurs: disable the email column 2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
f8358b3ae9 instructeurs: create without providing the email 2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
8e6930d257 instructeurs: fix ProcedurePresentation to use instructeur.user.email
The `joins` are declared explicitely in order to associate a predictable
name to the joined table.

Otherwise, when the query is joined with `:users`, ActiveRecord will
alias the join automatically  to solve the conflict. Unfortunately, the
automatic resolution means that the table name becomes unpredictable,
and thus unsuitable to perform queries on.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
8b8213c301 instructeurs: always eager load the user relationship
Now that `Instructeur.email` is merely an alias to `instructeur.user.email`,
and we changed every occurence of `instructeurs.pluck(:email)` to
`instructeurs.map(&:email)`, the new version using `map` may cause N+1 queries
if the users have not been preloaded.

It makes sense to always preload the user when fetching an Instructeur:

- Instructeur and User have a strongly coupled relationship
- It avoids N+1 queries everywhere in the app

Of course fetching an instructeur without needing its user will now do an
unecessary fetch of the associated user. But it seems better than leaving
a risk of N+1 queries in many places.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
a462edb9bc instructeurs: alias instructeur.email
This also means we need to replace instances of `pluck` on the email
column.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
cd478b489e instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
Paul Chavard
839b0d7e6d Add Entreprise raison sociale to dossier export
fix #4422
2019-10-31 17:11:46 +01:00
simon lehericey
4febf1851f notifications_for_procedure is now based on instructeur.groupe_instructeurs 2019-10-25 09:42:17 +02:00
simon lehericey
e290fc3674 No need to update column as the sign_up process activates the user 2019-10-24 18:32:48 +02:00
simon lehericey
8ae592fe25 [fix #4361] administrateur active 2019-10-24 18:32:48 +02:00
clemkeirua
d9e993571c add a warning during export generation 2019-10-24 16:27:10 +02:00
clemkeirua
da590cc73a sequence async file generation so that the queue flag is cleared 2019-10-24 16:27:10 +02:00
simon lehericey
1fa149575c Add constraints to GroupeInstructeur 2019-10-23 21:47:20 +02:00
Paul Chavard
86b271997b Invite experts to linked dossiers
closes #3669
2019-10-23 13:10:09 +02:00
clemkeirua
87741f4b49 introduce constant for exports 2019-10-22 09:51:14 +02:00
clemkeirua
cdab08b198 UI work 2019-10-22 09:51:14 +02:00
clemkeirua
43424e4f4e merge with the work of paul, using 3 links 2019-10-22 09:51:14 +02:00
clemkeirua
70ea5e167e procedure download is performed through a controller in order not to leak the URL 2019-10-22 09:50:58 +02:00
simon lehericey
6b8cefa551 Procedure: defaut_groupe_instructeur is the first group
Especially useful when the defaut groupe is renamed ...
2019-10-17 15:48:14 +02:00