Commit graph

838 commits

Author SHA1 Message Date
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
simon lehericey
4febf1851f notifications_for_procedure is now based on instructeur.groupe_instructeurs 2019-10-25 09:42:17 +02:00
simon lehericey
8ae592fe25 [fix #4361] administrateur active 2019-10-24 18:32:48 +02:00
Pierre de La Morinerie
5fc88eb6a2 specs: fix a flaky repetitions test
The test would sometime fail when the two fields are created in a
different order than expected.
2019-10-24 16:52:29 +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
43424e4f4e merge with the work of paul, using 3 links 2019-10-22 09:51:14 +02:00
Nicolas Bouilleaud
03c950ea97 Move followed_dossiers_with_notifications to a Dossier scope
Instead of instructeur.followed_dossiers_with_notifications, we can now write instructeur.followed_dossiers.with_notifications.

Yay composition!
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
a4166d3c57 Refactor Instructeur.notifications_* methods
- rename `dossiers_id_with_notifications` to `followed_dossiers_with_notifications`,
- rename `notifications_per_procedure` to `procedures_with_notifications`,
- return an ActiveRecord::Relation instead of the result of the query, so that the call place can compose it,
- `merge` with the wanted Dossier scope in the call places, don’t bother passing it as a parameter,
- use the “state” (now “scope”) parameter as a scope method that can be just applied on `Dossier`.
2019-09-25 14:10:00 +02:00
Nicolas Bouilleaud
f74fde3f80 Avoid sending notification emails about archived dossiers 2019-09-20 11:06:33 +02:00
Nicolas Bouilleaud
769621de46 Explicitly pass the “state” param in notifications_*_procedure methods 2019-09-20 11:06:33 +02:00
simon lehericey
e2acb0a946 ProcedurePresentation: can use groupe instructeur 2019-09-18 15:51:02 +02:00
simon lehericey
9b16bd2037 Dossier: retrieve all dossiers for a procedure 2019-09-18 15:51:02 +02:00
simon lehericey
21577a0f0b Instructeur: dedup procedures with multiple gi 2019-09-18 15:51:02 +02:00
Paul Chavard
8fcf1353f3 Remove duplicated attachments 2019-09-17 18:12:53 +02:00
Nicolas Bouilleaud
c26a701a17 Refactor and redesign publish modal
* remove the autocomplete menu
* use ujs to pre-validate the procedure
* tweak the UI
2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
bd1e0aba38 Add Procedure path suggestion 2019-09-17 16:30:48 +02:00
Nicolas Bouilleaud
8fa630d2bb Remove Gestionnaire.visible_procedures
It is actually the same thing as Gestionnaire.procedures. It already included the procedures with paths as well as the archived procedures, and in production, there were no Gestionnaire for who procedures was returning a different result than visible_procedures (expect for two baddata brouillon procedures with a nil path).

In addition, Procedure.path is now nonnull, which means the Procedure.avec_lien scope is pointless.

Finally, the current spec showed that the only procedure not visible to the gestion was the one he was not assigned to.
2019-09-17 16:30:48 +02:00
Paul Chavard
b97cbd3402 Serialize champ repetition for tags
closes #4272
2019-09-12 17:23:18 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Paul Chavard
65e227c44b Migrate to flipper 2019-09-10 16:10:14 +02:00
Paul Chavard
7ffb98e616 Remove carrierwave uploaders 2019-09-10 10:49:12 +02:00
simon lehericey
74096b6b3a Assign Factory: automatically link to procedure.defaut_groupe_factory 2019-09-03 06:47:02 +02:00
simon lehericey
3cc8f0c792 Link Dossier and GroupeInstructeur 2019-09-03 06:47:02 +02:00
simon lehericey
caf1fbca44 Use assign_to 2019-09-02 11:41:12 +02:00
simon lehericey
b541ef0b41 Procedure has many instructeurs with defaut_groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
ba24958035 Procedure add missing_instructeurs? 2019-09-02 11:41:12 +02:00
simon lehericey
85499365a0 Instructeur has_many procedures through groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
25991c2892 Assign a procedure assign a group as well 2019-09-02 11:41:12 +02:00
simon lehericey
115d91387c A procedure has a default groupe instructeur 2019-09-02 11:41:12 +02:00
Paul Chavard
a19b10b118 Migrate attestation files to active_storage 2019-08-27 17:42:52 +02:00
clemkeirua
188e0fd6b2 removed ask_birthday for new procedures & dossiers 2019-08-27 15:32:17 +02:00
simon lehericey
97d0855d47 add User.create_or_promote_to_instructeur 2019-08-20 12:20:12 +02:00
simon lehericey
d0ac1c3301 Fix manager invite administrateur 2019-08-14 16:34:50 +02:00
simon lehericey
c08e356367 Remove or fix nonsense code 2019-08-14 15:08:14 +02:00
simon lehericey
1b38d4071d temporary remove password complexity check 2019-08-14 15:06:16 +02:00
Paul Chavard
0969b1f85f Enable email_login_token for all gestionnaires 2019-08-14 12:53:51 +01:00
simon lehericey
ad31822a68 Spec: sign_in with instructeur.user 2019-08-13 15:15:16 +02:00
simon lehericey
65a53909e1 Update instructeur factory 2019-08-13 15:15:16 +02:00
simon lehericey
47b7dc368b Remove or fix now nonsense code 2019-08-13 15:15:16 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
simon lehericey
6902f84b85 Brutally rename gestionnaire filename to instructeur 2019-08-12 13:47:01 +02:00
clemkeirua
d7105cb6f8 added spec for dossier#update_with_france_connect 2019-08-01 17:42:32 +02:00
maatinito
44efa5a1b1 #3928 administrator tests handle password constants 2019-08-01 17:12:14 +02:00
maatinito
8d3e3baabc #3928 administrator new & edit pwd pages 2019-08-01 17:12:14 +02:00
Paul Chavard
c75e39884e Save selection utilisateur as geo area 2019-08-01 11:38:09 +02:00
Pierre de La Morinerie
95e24392f9 models: remove old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
0da0a2b446 model: remove support for cloning procedures with old pj 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
ffe081c1f2 specs: remove old pieces_justificative from specs and factories 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
e975fe4ade tasks: remove task to migrate old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
0018f36b44 gestionnaire: remove UI for filtering pieces justificatives 2019-07-30 16:11:16 +02:00
Nicolas Bouilleaud
b066ccbc89 Make sure Procedure.path is not null in our data 2019-07-29 13:53:33 +02:00
clemkeirua
6f47655301 rendu lien_site_web obligatoire au moment de la publication 2019-07-25 15:46:04 +02:00
clemkeirua
6d43465ee5 renammed into monavis_embed 2019-07-17 18:04:32 +02:00
clemkeirua
c8f9e3b5f8 automated test 2019-07-17 18:04:32 +02:00
Pierre de La Morinerie
71dfb38787 emails: improve typography of titles 2019-07-17 15:01:19 +02:00
clemkeirua
7eeddc0b79 using a shared example + scoped to state TERMINE 2019-07-17 11:53:16 +02:00
clemkeirua
b8fa567c81 ajout du tag 'lien document justificatif' 2019-07-17 11:53:16 +02:00
Pierre de La Morinerie
a8354bd103 dossiers: unify deletion of dossiers between manager and user
The code paths for deleting a dossier were different, depending on
whether the dossier was deleted by the user, or from the Manager.

This commit unifies the two code paths into one.

This has the effect of:

- An operation log is now recorded when an user deletes its own dossier;
- Gestionnaires are now notified even when the dossier is deleted from
  the Manager;
- The `support:delete_user_account` task now requires the email address
  of the author.
2019-07-16 16:22:20 +02:00
clemkeirua
25f81f1d3c download a dossier as zip with all attachments 2019-07-16 09:11:25 +02:00
Pierre de La Morinerie
35c3795f56 dossier: make messagerie available on archived procedures
An Admin may archive a procedure to make it unavailable to
the general public, but before all dossiers are handled. In this case,
the messagerie needs to be available.

Fix #4089
2019-07-11 15:37:04 +02:00
Pierre de La Morinerie
10065df8ce champs: put champ label in numeric fields validation messages
Replaces

> La valeur du champ doit être un nombre entier (sans chiffres après
> la virgule)

by

> La valeur du champ « Nombre de parents » doit être un nombre entier
> (sans chiffres après la virgule)
2019-07-11 15:12:48 +02:00
simon lehericey
7b63ddfabb Better champs factories 2019-07-10 16:41:34 +02:00
Pierre de La Morinerie
58a8d017f2 spec: cleanup dossier spec 2019-07-10 11:31:09 +02:00
Pierre de La Morinerie
56bc06cfbf dossier: fix flaky spec for nearing_end_of_retention
If the spec takes longer than 1s to run, the test would fail.
2019-07-10 11:00:49 +02:00
simon lehericey
0f9fdf3f75 Activate device email change confirmation 2019-07-09 11:55:17 +02:00
Nicolas Bouilleaud
930fd345de Validate messagerie_available? when creating a new Commentaire
Commentaires bu Users and Gestionnaire need the messagerie to be available; Automatic system Commentaires can be created anytime.

This reintroduces Commentaire validation that was introduced in #3979 and disabled in #4018
2019-07-08 16:13:43 +02:00
Nicolas Bouilleaud
3f439ac07a Add Commentaire.is_sent_by_system? and .is_sent_by(someone)
And use it in CommentaireHelper and in the _message_icon and _message_issuer partials
2019-07-08 16:06:44 +02:00
Nicolas Bouilleaud
2abd93d360 Display the full User email in Commentaires
* Only redact gestionnaires’ emails
* Also, rename Commentaire.sender to Commentaire.redacted_email
2019-07-08 16:06:44 +02:00
Paul Chavard
e582ff729c Add aasm to dossiers state 2019-07-03 13:37:27 +02:00
Mathieu Magnin
10d3ba10f2 Before save copy body in rich_body 2019-07-03 13:15:49 +02:00
simon lehericey
b2c987ff0d [fix #3683] Dossier: add repasser_en_instruction! 2019-07-02 18:40:20 +02:00
simon lehericey
92bd382c64 [fix #4008] secured login for all gestionnaires 2019-07-01 15:06:39 +02:00
Nicolas Bouilleaud
bd47bf2691 Disable Messagerie in archived Dossiers and procedures
* Use the existing Dossier#messagerie_available? method
* Raise when attempting to build a Commentaire if not messagerie_available?
* Disable the Messagerie form if not messagerie_available?
* Add tests :)
* Tweak the Horaires formatting while we’re here.
2019-07-01 09:39:39 +02:00
Paul Chavard
c5704fa22f Remove unused code from Commentaire 2019-06-25 17:04:29 +02:00
Nicolas Bouilleaud
c606644902 Tweak codestyle in specs, following review 2019-06-17 16:16:28 +02:00
Nicolas Bouilleaud
f355f849a6 Add BillSignature Model 2019-06-17 16:16:28 +02:00
simon lehericey
ee296f2b44 Use default format for date and datetime champ 2019-06-12 17:48:12 +02:00
Nicolas Bouilleaud
6b90bc1ea1 Add “previously followed” dossiers and gestionnaires
Using an “inactive” Follow scope, similar to the “active” scope.

(I was tempted to use a default_scope, but this breaks when trying to `unscope` it in associations.)
2019-06-12 17:33:53 +02:00
Paul Chavard
cc4eba2b36 Less mokey patching 2019-05-21 14:21:42 +02:00
Paul Chavard
42235e81b1 Use active storage load hook to extend blob 2019-05-16 20:43:01 +02:00
Paul Chavard
dba8d65137 Track dossier operations with author and subject 2019-05-14 14:31:03 +02:00
clemkeirua
d0794f42d1 fix tag_substitution_concern links for lien attestation 2019-05-07 08:54:29 +02:00
clemkeirua
c98655be52 ellipsis on file input overflow 2019-05-07 08:54:29 +02:00
clemkeirua
0e26bda186 cleanup the tag substitution concern & uniformization 2019-05-07 08:54:29 +02:00
clemkeirua
e4259466b4 nettoyage du tag_substitution_concern 2019-05-07 08:54:29 +02:00
clemkeirua
f8a2598647 ajout du lien vers le justificatif dans la balise --lien attestation-- 2019-05-07 08:54:29 +02:00
clemkeirua
747dc505cc ajout d'un test 2019-05-07 08:54:29 +02:00
Nicolas Bouilleaud
df865e71dc Make sure that there always is at least one administrator per Procedure 2019-05-06 16:19:08 +02:00
Paul Chavard
f113d108c9 Save virus scan status to blob metadata 2019-05-02 15:58:09 +02:00
Pierre de La Morinerie
d855468cb6 dossiers: display the estimate of the entire processing time
Displaying separate estimations for en_construction and en_instruction
doesn't really make sense for the users: they want to know how
long it is going to take overall, not the petty details of our workflow.
2019-04-30 15:56:27 +02:00
Nicolas Bouilleaud
1c2e93ed41 Fix “nearing_end_of_retention” test
The `nearing_end_of_retention` test creates a `just_expired_dossier` “six months ago”, which is 29 Oct 2018. The autumn DST change was on October 28; this is the first time this test runs under these conditions. We workaround the time offset by creating the dossier one hour earlier.

This is technically a workaround, not a fix: the date arithmetics in `nearing_end_of_retention` are probably wrong. It looks like it’s comparing intervals, which seems error-prone, while it should be comparing dates. For now, I’m just making the tests pass.
2019-04-29 15:41:52 +02:00
Paul Chavard
8d093bd9ba Fix missing dossier_id on champs inside repetition 2019-04-18 16:55:35 +02:00
simon lehericey
e65e21a72f Email notification: use the right method for procedures 2019-04-18 15:07:01 +02:00
Nicolas Bouilleaud
c5122ee7f5 Allow filtering ProcedurePresentation by followers_gestionnaires
fixes #3464
2019-04-10 14:32:51 +02:00
Pierre de La Morinerie
e34c556f29 procedure: fix specs
When the time computations are done accross a Daylight Saving Time
change, they may be off by one hour.

It doesn't matter, as the estimated delay is counted in days, not
hours.
2019-04-08 15:24:44 +02:00
Paul Chavard
639facaf2a Add new types_de_champ#move api 2019-04-03 14:38:07 +02:00
Mathieu Magnin
71e0969bc0 [Fix #3692] Ensure SIRET is correct on server 2019-03-28 18:03:53 +01:00
Mathieu Magnin
27c8e9dcb8 Use the same clone_attachment method for all attributes on procedure.clone 2019-03-28 17:17:29 +01:00
Mathieu Magnin
4e27872a25 [Fix #3650] when cloning a procedure, do not forget pj_templates 2019-03-26 15:31:09 +01:00
Pierre de La Morinerie
b1a7018d30 procedure: ignore bad data when computing usual_instruction_time
Fix #3655
2019-03-20 17:48:54 +01:00
Mathieu Magnin
6570bed09c [Fix #3641] Do not change PJ value in API if PJ is safe 2019-03-20 11:37:31 +01:00
Paul Chavard
69a51e3296 Save SIRET data on search 2019-03-19 16:22:42 +01:00
Pierre de La Morinerie
ed1f6ec38d procedure: fix verification delay
The verification delay was ignoring all dossiers not closed yet.
2019-03-19 15:51:51 +01:00
simon lehericey
6607de4827 Notification: add service to send notifications 2019-03-18 16:37:51 +01:00
Paul Chavard
bb8ba75d22 Explicitly pass current_administrateur on publish 2019-03-12 11:59:01 +01:00
Paul Chavard
c37f649453 Update specs to use multiple administrateurs 2019-03-12 11:59:01 +01:00
Mathieu Magnin
44f28ec565 Remove feature flag for publish draft 2019-03-12 11:26:07 +01:00
Frederic Merizen
efa71284fc [#3477] Test eager_load_displayed_fields 2019-03-11 17:14:17 +01:00
Frederic Merizen
70bf6aecf6 [#3477] Filter by mutliple values 2019-03-11 17:14:17 +01:00
Frederic Merizen
5d01e37d70 [#3477] Make filters stand out a little more in spec 2019-03-11 17:14:17 +01:00
Frederic Merizen
b428406fc7 [Fix #3578] No tags for champs that cannot have user input anyway 2019-03-11 10:26:27 +01:00
Frederic Merizen
1d0156f9c6 [#3572] Add tests 2019-03-08 18:32:35 +01:00
clemkeirua
71bff0812c ajout d'un test pour caractériser le cas service = null 2019-02-21 12:34:53 +01:00
clemkeirua
236f73f838 ajout d'une balise pour le nom du service 2019-02-21 12:18:44 +01:00
Paul Chavard
84383fc3c1 Assigne admins to procedure.administrateurs 2019-02-20 17:10:57 +01:00
Paul Chavard
a7ba01a02a Fix champ spec
fix #3257
2019-02-20 16:26:12 +01:00
Mathieu Magnin
f7650135f4 [Fix #3375] on the API display safe files only 2019-02-19 18:10:35 +01:00
simon lehericey
0b8619be77 Gestionnaire: login_token! -> create_trusted_device_token 2019-02-18 17:21:46 +01:00
simon lehericey
d664f130fd trustedDeviceToken: move token youth 2019-02-18 17:20:49 +01:00
simon lehericey
23db8a160c move token validity to trusted_device_token 2019-02-18 17:20:49 +01:00
simon lehericey
9d92e43d8d [fix #3315] Migrate service organisme 2019-02-18 16:50:44 +01:00
simon lehericey
a7e068003a [fix #3427] Administration can soft delete a dossier 2019-02-14 18:09:08 +01:00
Frederic Merizen
eb7cd28504 Fix undefined method for nil:NilClass 2019-02-13 19:22:38 +01:00
Frederic Merizen
41ab7246cf [#3424] Improve formatting of addresses with missing components 2019-02-13 09:57:33 +01:00
Paul Chavard
6b39128be3 Clone nested types_de_champ 2019-02-06 10:05:27 +01:00
simon lehericey
5715cdaa4c [fix #3363] use organisation_name in dossier summary 2019-02-05 17:41:51 +01:00
Frederic Merizen
a255e61556 [#3356] Improve formatting for menus that only have a primary value 2019-02-05 17:35:30 +01:00
Frederic Merizen
a3d7c8de55 [Fix #3356] Add tags for primary menu only / secondary menu only 2019-02-05 17:35:30 +01:00
Paul Chavard
071448e1d9 Champ Repetition dossier editor 2019-02-04 16:19:07 +01:00
Frederic Merizen
5e37400834 [#2180] Only retain old PJ API when cloning for same admin 2019-01-17 17:40:40 +01:00
Frederic Merizen
530079e464 [#2180] Make sure that old_pj is kept through successive clones 2019-01-17 17:40:40 +01:00
Frederic Merizen
8cb509d192 [#2180] Keep information that this type de champ was cloned from a PJ 2019-01-17 17:40:40 +01:00
Frederic Merizen
651fd6149b [#2180] When cloning a procedure, convert types de PJ to types de champ PJ 2019-01-17 17:40:40 +01:00
simon lehericey
6ab2d124f9 Dossier: #accepter_automatiquement! 2019-01-16 17:20:12 +01:00
simon lehericey
0f3dedb0b6 Dossier: #passer_automatiquement_en_instruction! 2019-01-16 17:12:32 +01:00
simon lehericey
29fff9ee68 [fix #3269] bufferize login token email 2019-01-10 12:06:35 +01:00
simon lehericey
a197285742 [fix #2612] Admin: add missing steps to admin UI 2019-01-09 16:25:00 +01:00
simon lehericey
8ca7eb1c54 Procedure: cloning set the current admin gestionnaire of the procedure 2019-01-09 16:25:00 +01:00
simon lehericey
f0139c5962 Spec Factory: an administrateur always has a gestionnaire 2019-01-09 13:49:47 +01:00
Paul Chavard
1beefe4469 Fix champ repetition belongs_to associations 2019-01-08 11:56:33 +00:00
gregoirenovel
c00aac2f80 We can now replace processing in #formatted_value by #to_s calls 2019-01-08 12:32:26 +01:00
gregoirenovel
9e42190148 Remove the proxy value_for_export method
Overload for_export instead
2019-01-08 12:32:26 +01:00
gregoirenovel
9a2341c56c Remove the useless #for_display proxy method 2019-01-08 12:32:26 +01:00
simon lehericey
7b935a6486 login_token: lets constantize 2019-01-07 08:18:29 +01:00
simon lehericey
5daa565a80 login_token: add missing tests 2019-01-07 08:18:29 +01:00
gregoirenovel
5fa5f2aa37 Bump development gems
- rubocop (0.61.1 → 0.62.0)
2019-01-05 11:47:55 +01:00
Pierre de La Morinerie
d77530c461 Make Procedure state consistent after switching types de champ order
Fixes an issue where, after clicking the "move champ up" button,
the new form is rendered with an incoherent order.
2019-01-03 15:13:14 +01:00
gregoirenovel
b41764ec03 Remove ChampDecorator 2019-01-03 12:08:25 +01:00