Commit graph

519 commits

Author SHA1 Message Date
Paul Chavard
20705d6e30 Do not send draft norifications to users on inactive démarches 2020-05-27 16:36:46 +02:00
Pierre de La Morinerie
b63fa0e6b8 dossier: remove "Birthdate" column from export 2020-05-18 13:14:28 +00:00
clemkeirua
236fd0291b bump zip sizes from 50 to 100 mb 2020-05-14 10:37:01 +00:00
Pierre de La Morinerie
190548844a dossiers: add piece justificative filename to spreadsheet export 2020-05-14 10:18:10 +00:00
Paul Chavard
dfc004d7bb Unarchive dossier when repasser_en_instruction 2020-05-12 19:05:18 +02:00
Paul Chavard
6556df2a85 Fix a crash in case of invalid geometry 2020-05-05 15:56:05 +02:00
Paul Chavard
843e033c38 Allow instructeurs to download a GeoJSON document for a given dossier 2020-04-30 15:49:43 +02:00
Paul Chavard
bdbee38ff1 Add expired termine scopes to dossier 2020-04-22 15:39:10 +02:00
Paul Chavard
ee3ff78b12 Create constants for default map location 2020-04-16 10:22:07 +02:00
Paul Chavard
61eaca928f remove WarnExpiringDossiersJob 2020-04-09 11:11:51 +02:00
Paul Chavard
725cfa45d3 Do not set processed_at if already defined 2020-04-02 15:23:53 +02:00
Paul Chavard
413abccd3c Add default order to dossier.dossier_operation_logs 2020-04-02 14:05:40 +02:00
Paul Chavard
c0bbfa42b7 Reassign discarded dossiers on group_instructeur
fix #4851
2020-04-01 18:10:12 +02:00
Paul Chavard
58c126308c Add DiscardedProceduresDeletionJob job 2020-03-31 17:08:28 +02:00
Paul Chavard
da52ec30bd Undo discard dossiers and demarches from manager 2020-03-31 17:08:28 +02:00
Paul Chavard
c707a21f97 Rename delete_and_keep_track -> discard_and_keep_track 2020-03-26 14:23:23 +01:00
Paul Chavard
51224fad49 Refactor scopes with intervals and use Time.zone.now 2020-03-25 17:42:03 +01:00
Paul Chavard
c086f6d580 Add a job to remove discarded dossiers 2020-03-25 17:28:25 +01:00
Paul Chavard
5b5ae5a7a5 Do not send notifications or create operation logs on brouillon demarches 2020-03-25 15:04:52 +01:00
maatinito
1af32b29fd #4807 Use now() instead of Date.time.today (better code homogeneity) 2020-03-24 17:09:14 -10:00
maatinito
f5c2dc03c5 #4807 better method/variable naming 2020-03-24 16:46:23 -10:00
Christian Lautier
e61c53f267 Fix #4807 48h before closing a procedure, notify users their draft is not submitted 2020-03-24 16:46:23 -10:00
clemkeirua
5896aedeeb added extension bouton to en_construction dossiers bound to expire 2020-03-24 18:10:51 +01:00
Paul Chavard
5c2eba1dd1 Always add a reason to dossier deletion 2020-03-24 09:30:11 +01:00
Paul Chavard
903cf0cef5 Keep operation logs after dossier removal 2020-03-24 09:18:45 +01:00
Paul Chavard
77018b9e2b Add expiration scopes to dossier 2020-03-18 15:25:02 +01:00
Paul Chavard
f35ccc9d92 Move process_expired_dossiers_brouillon to a service 2020-03-18 15:25:02 +01:00
Paul Chavard
3cd4597006 Update rubocop roules 2020-03-17 11:25:21 +01:00
Christophe Robillard
b5030b8972 highlight demandes when groupe instructeur updated on procedure list 2020-03-04 14:56:59 +01:00
Christophe Robillard
924702699f highlight routing criteria label when updated 2020-03-04 14:56:59 +01:00
Paul Chavard
c46e012c10 Use dossier.assign_to_groupe_instructeur 2020-03-03 10:30:49 +01:00
Christophe Robillard
2bd6f01009 log changer_groupe_instructeur 2020-02-26 11:25:07 +01:00
Christophe Robillard
e0f4957dfd notify instructeur after groupe_instructeur changed 2020-02-26 11:25:07 +01:00
Christophe Robillard
fb3d7e45ba unfollow stale instructeurs
when the group instructeur of a dossier is changed, unfollow the
instructeurs who don't belong to the new groupe instructeur
2020-02-26 11:25:07 +01:00
Paul Chavard
1ce1c1e6d0 use discard 2020-02-13 12:31:59 +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
Christophe Robillard
2bb161c3cb admin: alias Administrateur.email 2020-02-04 16:21:42 +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
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
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +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
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +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
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
2a61ed5b1c Export etablissement information in csv
fix #4440
2019-11-07 14:27:52 +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
Paul Chavard
839b0d7e6d Add Entreprise raison sociale to dossier export
fix #4422
2019-10-31 17:11:46 +01:00
Paul Chavard
86b271997b Invite experts to linked dossiers
closes #3669
2019-10-23 13:10:09 +02:00
simon lehericey
5897464224 Build Dossier champ only once 2019-10-17 15:48:14 +02:00
simon lehericey
451387d32d Dossier: add conditions on joins for with_notifications scope 2019-09-26 15:46:20 +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
Paul Chavard
eb7aba18e6 Add dossier champs and annotations types 2019-09-24 10:47:21 +02:00
Paul Chavard
2e854f2ac3 Add graph loading scopes to Dossier and Procedure 2019-09-24 10:47:21 +02:00
simon lehericey
faddbc23ef Eager load procedure: :groupe_instructeurs for export 2019-09-19 12:30:12 +02:00
simon lehericey
a2f82ab8be Add groupe_instructeur_label to export v2 2019-09-19 12:30:12 +02:00
simon lehericey
9b16bd2037 Dossier: retrieve all dossiers for a procedure 2019-09-18 15:51:02 +02:00
Paul Chavard
88842918f9 Prepare to drop columns 2019-09-17 12:37:37 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Paul Chavard
3eb3ae001e Rename “Passé en construction le” to 'Déposé le' for clarity 2019-09-10 14:59:10 +02:00
simon lehericey
3cc8f0c792 Link Dossier and GroupeInstructeur 2019-09-03 06:47:02 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
clemkeirua
1e6847bc6f introduce constants for M./Mme 2019-08-01 17:42:32 +02:00
clemkeirua
d7105cb6f8 added spec for dossier#update_with_france_connect 2019-08-01 17:42:32 +02:00
clemkeirua
707e8a0004 dossier_controller#new uses info from FC if any 2019-08-01 17:42:32 +02:00
clemkeirua
f5d3818e3c remove unnecessary retransition methods 2019-08-01 10:40:08 +02:00
clemkeirua
38b48f4217 transition from accepte to instruction as superadmin 2019-08-01 10:29:51 +02:00
Paul Chavard
b266915892 Add repetitions to api 2019-08-01 10:04:35 +02:00
Paul Chavard
fba195c0b5 Add attestation url to dossier on api 2019-07-31 18:30:40 +02:00
Paul Chavard
ab1170bcfc Fix export dossier n+1 query 2019-07-30 17:17:36 +02:00
Pierre de La Morinerie
ea1c8ea7e3 models: remove associations to old pieces justificatives 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
f69f325236 api: remove export of old pieces justificatives 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
clemkeirua
d62740c198 extraction de la taille max des fichiers dans une constante 2019-07-18 17:19:39 +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
d5f360c85f manager: fix the deletion email not being sent
When deleting a dossier from the manager, the deletion notification
email was not being sent. This is because the returned object from
`Dossier#hide!` was invalid.
2019-07-15 10:01:16 +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
fdca7c025a procedure: ignore :expects_multiple_submissions on the correct model 2019-07-11 12:14:25 +02:00
Paul Chavard
3cb39c2840 Refactor message attachements to use active_storage 2019-07-10 15:35:29 +02:00
Pierre de La Morinerie
ecfccae6f0 dossiers: remove support for Dossier#expects_multiple_submissions 2019-07-09 14:50:11 +02:00
Paul Chavard
ad0a74ea7c Fix dates in dossiers export 2019-07-09 10:02:08 +02:00
Paul Chavard
e582ff729c Add aasm to dossiers state 2019-07-03 13:37:27 +02:00
simon lehericey
b2c987ff0d [fix #3683] Dossier: add repasser_en_instruction! 2019-07-02 18:40:20 +02:00
Paul Chavard
fb0ef15e3c Export dossiers v2 2019-07-02 14:20:29 +02:00
Paul Chavard
46c1bbbc6f Official support for declarative demarches 2019-07-02 14:12:26 +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
0d80c48b7e Add avis to api 2019-06-27 14:40:17 +02:00
Nicolas Bouilleaud
7e80b8a4dc Enable the Rails/InverseOf cop and add missing inverse_of 2019-06-17 13:44:07 +02:00
Pierre de La Morinerie
51aacabf13 models: fix touch not propagating when using nested attributes
Sometimes, when using nested attributes, touch doesn’t propagate to
parent relationships. (see https://github.com/rails/rails/issues/26726)

Specifically, this happens in our app when updating a dossier with
only new attachements (but without changing the value of any fields).

To work around this, we need to define the parent relationship
explicitely. This is good practice anyway.

Fix #3906
2019-06-17 13:44:07 +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
Nicolas Bouilleaud
be4c575622 Add Follow.unfollowed_at
The active scopes is used indirectly in the dossier<->gestionnaire associations: the existing tests in dossier and gestionnaire just work™.
2019-06-12 17:33:53 +02:00
Paul Chavard
d5911071f8 Return dossiers on api with stable order 2019-06-04 15:34:49 +02:00
Paul Chavard
b8bf662c6d Track dossier demander un avis 2019-05-14 14:31:03 +02:00
Paul Chavard
9c472e6524 Track dossier private annotations modifications 2019-05-14 14:31:03 +02:00
Paul Chavard
dba8d65137 Track dossier operations with author and subject 2019-05-14 14:31:03 +02:00
clemkeirua
afa6711564 refacto suite à simplification virusscan 2019-05-07 08:54:29 +02:00
clemkeirua
b3956bc072 introduce virus scans 2019-05-07 08:54:29 +02:00
clemkeirua
4aab72be68 implementation du systeme de PJ de motivation 2019-05-07 08:54:29 +02:00
Pierre de La Morinerie
ce9c5da6e1 dossier: add a messagerie_available? method 2019-03-20 10:42:57 +01:00
Paul Chavard
01b966ff66 Check demarche ownership on multiple administrateurs 2019-03-12 11:59:01 +01:00
Frederic Merizen
a87e3ac697 [#3477] Make filtering by datetimes a proper scope 2019-03-11 17:14:17 +01:00
simon lehericey
a7e068003a [fix #3427] Administration can soft delete a dossier 2019-02-14 18:09:08 +01:00
Paul Chavard
a0a1ce11c8 Add repetition to apercu 2019-02-07 12:29:27 +01:00
Pierre de La Morinerie
a6704c4cd6 dossiers: allow users to delete "en construction" dossiers 2019-02-07 11:07:07 +01:00
Pierre de La Morinerie
d251ebc2f4 dossiers: shorten method name 2019-02-06 18:20:35 +01:00
simon lehericey
5715cdaa4c [fix #3363] use organisation_name in dossier summary 2019-02-05 17:41:51 +01:00
Paul Chavard
071448e1d9 Champ Repetition dossier editor 2019-02-04 16:19:07 +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
Paul Chavard
5d1c24f3d8 Add type de champ repetition models (with row) 2018-12-19 15:31:11 +01:00
gregoirenovel
df7e0a9881 Remove dead code 2018-12-19 14:59:15 +01:00
Paul Chavard
35494df78e Procedure export dossiers with champs siret 2018-12-05 17:09:39 +01:00
Paul Chavard
9b39934e8b Destroy dossier_operation_logs when dossier is destroyed 2018-11-28 17:06:54 +01:00
Mathieu Magnin
b51bf759b1 [Fix #3081] If a dossier is destroyed, then destroy the attestation 2018-11-28 16:33:12 +01:00
Paul Chavard
36f6f54337 Remove unused carto models 2018-11-27 16:11:25 +01:00
Paul Chavard
0f0ca2ec65 Lod dossier operations 2018-11-27 12:49:40 +01:00
Paul Chavard
85e3eb04f4 Add DossierOperationLog model 2018-11-27 12:49:40 +01:00
Paul Chavard
9843666bdc Implement state change methods on dossier 2018-11-27 12:49:40 +01:00
Pierre de La Morinerie
e5303fd986 mailers: streamline the NotificationMailer
Notifications are now only for demarche-templated emails.
2018-11-20 14:46:31 +01:00
Paul Chavard
971a08c92a Add expose legacy carto api flag 2018-11-20 10:53:14 +01:00
Paul Chavard
2462e42b53 Stop using legacy api carto after migration 2018-11-20 10:53:14 +01:00
Paul Chavard
33c6ddc452 Remove dead code related to dossier state 2018-11-08 14:56:45 +01:00
Paul Chavard
80189def98 Remove n+1 calls from API queries 2018-11-08 14:45:09 +01:00
simon lehericey
3dad743d56 remove localtime as it uses server timezone 2018-10-26 10:10:20 +00:00
simon lehericey
2238e5bd9f Time.now => Time.zone.now 2018-10-26 10:10:20 +00:00
simon lehericey
13ffa61435 DateTime.now => Time.zone.now 2018-10-26 10:10:20 +00:00
gregoirenovel
22088b167d Remove ApiAdresse::Geocodeur 2018-10-16 09:33:16 +02:00
gregoirenovel
5e9e913dce Carto::Geocodeur → ApiAdresse::Geocodeur 2018-10-15 20:55:46 +02:00
Paul Chavard
c63675461a Add new carto init code 2018-10-14 12:34:43 +02:00
gregoirenovel
c8f872c566 InviteUser → Invite 2018-10-10 12:07:10 +02:00
gregoirenovel
ed11852300 Delete the InviteGestionnaire model 2018-10-10 12:07:10 +02:00
Frederic Merizen
c1f18a164d Remove dead, buggy code 2018-10-10 05:51:17 +02:00
simon lehericey
87e731bc75 Dossier: move state translation to model dossier 2018-10-08 17:55:20 +02:00
Frederic Merizen
33f29f35ab Avoid recreating service too often 2018-10-04 18:09:39 +02:00
Frederic Merizen
eafd0e8348 Evite de cacher la whitelist trop longtemps 2018-10-04 18:09:39 +02:00
gregoirenovel
5107b33af8 Remove FC fields from search 2018-10-04 13:54:07 +02:00
Frederic Merizen
3bb6fd2d47 [#2579] Remove no-op
(sanitize_sql_for_order does not do anything when its argument is a string)
2018-10-03 10:17:46 +02:00
Paul Chavard
941c529b2c Remove CGU checkbox
fix #2725
2018-10-03 08:59:02 +02:00
Frederic Merizen
43d8db88d9 [#1946] Check if a dossier’s retention period has expired 2018-09-20 17:44:31 +02:00
Frederic Merizen
b672377f5b [#1946] Query dossiers by remaining retention time 2018-09-20 17:44:31 +02:00
Frederic Merizen
63fc0b3bc3 [Fix #2584] Move Field related code to a service 2018-09-18 13:49:34 +02:00
gregoirenovel
00ecae5f93 Procédure → Démarche 2018-09-05 15:46:24 +02:00
Frederic Merizen
7326065590 [fix #2486] Include all needed attributes on downloadable_sorted
to avoid N+1 select
2018-08-30 14:13:32 +02:00