Commit graph

344 commits

Author SHA1 Message Date
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
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
4efea77280 specs: regroup dossier scope specs together 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
0efb62f03a factories: ensure that dossiers with_individual are consistent 2020-01-21 17:24:56 +01:00
Pierre de La Morinerie
724ff50363 factories: rename dossier for_individual to with_individual
This clarifies the distinction between

```
create :procedure, :for_individual
```

and

```
create :dossier, :with_individual
```
2020-01-21 17:24:56 +01:00
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +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
maatinito
a02a5edce3 Bug with time zone when testing sending of brouillon expiration notices 2019-12-11 17:34:10 +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
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
simon lehericey
9b16bd2037 Dossier: retrieve all dossiers for a procedure 2019-09-18 15:51:02 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +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
85499365a0 Instructeur has_many procedures through groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code 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
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
71dfb38787 emails: improve typography of titles 2019-07-17 15:01:19 +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
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
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
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
dba8d65137 Track dossier operations with author and subject 2019-05-14 14:31:03 +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
Mathieu Magnin
71e0969bc0 [Fix #3692] Ensure SIRET is correct on server 2019-03-28 18:03:53 +01:00
Paul Chavard
c37f649453 Update specs to use multiple administrateurs 2019-03-12 11:59:01 +01:00
simon lehericey
a7e068003a [fix #3427] Administration can soft delete a dossier 2019-02-14 18:09:08 +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
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
36f6f54337 Remove unused carto models 2018-11-27 16:11:25 +01:00
Paul Chavard
0b017580c5 Expose migrated legacy carto champs on api 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
Pierre de La Morinerie
d4b2b04875 spec: clear deliveries before every example 2018-11-06 17:26:20 +01:00
simon lehericey
f620e4aee2 DateTime.parse => Time.zone.parse 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
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
gregoirenovel
12f0c99b5a Remove FC fields from instructeur table customisation 2018-10-04 13:54:07 +02:00
gregoirenovel
5107b33af8 Remove FC fields from search 2018-10-04 13:54:07 +02:00
gregoirenovel
6eeba14885 Enable Style/WordArray 2018-10-03 12:03:21 +02:00
Frederic Merizen
112fdb71fb [#2613] Remove dead code 2018-09-24 20:19:26 +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
gregoirenovel
00ecae5f93 Procédure → Démarche 2018-09-05 15:46:24 +02:00
Frederic Merizen
37c45f0d29 [#2486] Always order champs
to help activerecord cache the champs collection
2018-08-30 14:13:32 +02:00
gregoirenovel
4b071ecf06 Use enum to the fullest with Dossier.states 2018-08-29 17:31:08 +02:00
Frederic Merizen
3b2919a326 [#2179] Use new updated value for search terms
Rather than old in-database value
2018-08-23 10:34:25 +02:00
Pierre de La Morinerie
242f9d0af7 specs: fix order-dependant tests in spec/models/gestionnaire_spec.rb
Test run that would fail randomly before:

```
bin/rspec --seed 10002 spec/models/dossier_spec.rb spec/models/gestionnaire_spec.rb
```
2018-08-14 11:48:54 +02:00
Pierre de La Morinerie
5e01be0f15 mailer: add direct link to dossier in creation email
Fix #2341
2018-08-08 15:24:17 +02:00
Paul Chavard
46e75ac8ef Only notify on dossier supression if dossier is en_construction 2018-08-02 17:07:24 +02:00
Pierre de La Morinerie
dee4acd802 dossier_facade: remplace followers by an equivalent implementation 2018-08-01 17:41:11 +02:00
Frederic Merizen
0e639030f9 [#2179] Generate denormalized search terms value for Dossier 2018-07-27 11:11:52 +02:00
Pierre de La Morinerie
13182ad291 dossier: send deletion email also to the following gestionnaires 2018-07-25 13:49:55 +02:00
Pierre de La Morinerie
6daa31d410 spec: add tests for Dossier#delete_and_keep_track 2018-07-25 13:49:55 +02:00
Mathieu Magnin
9afbd16bbf [Fix #2145] When procedure is archived, usager should not be able to submit a dossier 2018-07-02 11:10:33 +02:00
Paul Chavard
d0a6957862 Remove old cerfa code 2018-06-28 15:16:20 +02:00
gregoirenovel
b364b8bfb3 Improve many subjects 2018-06-01 11:35:40 +02:00
gregoirenovel
0329b1db68 Use User#owns_or_invite? instead of Dossier#owner_or_invite? 2018-05-31 14:39:43 +02:00
gregoirenovel
a57e2388f6 Unify NotificationMailer methods’ signatures 2018-05-31 12:10:06 +02:00
Frederic Merizen
07b1c147d9 [Fix #1972] Always send mails asynchronously 2018-05-28 12:02:13 +02:00
Paul Chavard
ad24fd5991 Remove entreprise and rna_information models 2018-05-24 17:54:51 +02:00
gregoirenovel
8848abc536 #to_sorted_values -> #sorted_values 2018-05-03 23:35:51 +02:00
gregoirenovel
886431b120 Make some methods private 2018-05-03 23:35:51 +02:00
Paul Chavard
0b7cf3ae75 #full_data_strings_array -> #export_values 2018-05-03 23:35:51 +02:00
gregoirenovel
12cda1739b #export_entreprise_data -> #export_etablissement_data 2018-05-03 23:35:51 +02:00
Paul Chavard
27592ae072 Add simple web hooks to procedures 2018-04-09 11:02:24 +02:00
Frederic Merizen
6ed7ae4b53 [Fix #1809] Handle non-champ tags in attestation 2018-04-06 19:22:42 +02:00
kemar
b42e410da0 [Fix #1494] Display a warning when accepting a dossier if needed
Show the accompagnateur the unspecified demande
champs and attestations privées needed for the
attestation
2018-04-06 16:15:09 +02:00
Frederic Merizen
884c430619 [#1677] No need to use emails when we have users 2018-03-29 16:59:16 +02:00
simon lehericey
66a113c7db Dossier: remove uncessary query on order_champ_v2 2018-03-27 16:48:38 +02:00
gregoirenovel
d0a59058e8 Remove the mandataire_social guess
Rationale:
- is true for only 0.06% of Dossiers
- is not displayed anymore anyways
- will be a rare case for now
  * FC adoption is not insane
  * FC used more for personal than professional
    matters
  * not always the mandataires sociaux that fill
    dossiers for their companies, so not that
    relevant
- we can add it back later
2018-03-20 16:09:00 +01:00
Frederic Merizen
13d251d970 describe '#method' rather than describe '.method' for instance methods 2018-03-20 16:00:30 +01:00
gregoirenovel
e26f4148ff Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 16:17:22 +01:00
gregoirenovel
fe7f8da636 Revert "Bump development gems"
This reverts commit d6ad3fc3fd.
2018-03-06 15:11:26 +01:00
gregoirenovel
d6ad3fc3fd Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 10:36:35 +01:00
Paul Chavard
0c1d529b61 Unify :type_de_champ public/private factories 2018-02-14 11:49:06 +01:00
gregoirenovel
b138dcd876 Enable the Layout/SpaceInsideHashLiteralBraces cop 2018-01-18 10:53:35 +01:00
gregoirenovel
897a30da0c Enable the Layout/SpaceInsideBlockBraces cop 2018-01-18 10:53:34 +01:00
gregoirenovel
9d75526460 Enable the Layout/MultilineAssignmentLayout cop 2018-01-15 22:33:13 +01:00
Simon Lehericey
9c354e18eb [fix 363] Dossier: remove next_step! 2017-12-15 15:43:30 +01:00
Simon Lehericey
201862d450 [fix 363] Dossier: remove next_step! action = initiate, role = user 2017-12-15 15:43:30 +01:00
Simon Lehericey
907db89371 [fix 363] Dossier: remove next_step! action = follow 2017-12-15 15:43:30 +01:00
Simon Lehericey
11c010859c [fix 363] Dossier: remove next_step! action = update 2017-12-15 15:43:30 +01:00
Simon Lehericey
629cccbf27 [fix 363] Dossier: remove next_step! action = comment 2017-12-15 15:43:30 +01:00
Simon Lehericey
c83552f423 [fix #504] Dossier: without_continuation -> sans_suite 2017-12-15 12:10:54 +01:00
Simon Lehericey
2be9b8d2ba [fix #504] Dossier: refused -> refuse 2017-12-15 12:10:54 +01:00
Simon Lehericey
a13256f73d [fix #504] Dossier: closed -> accepte 2017-12-15 12:10:54 +01:00
LeSim
3dda27b281 [fix #504] Dossier: received -> en_instruction 2017-12-15 12:10:54 +01:00
Simon Lehericey
72bae2c374 [fix #504] Dossier: draft -> brouillon 2017-12-15 11:52:09 +01:00
LeSim
56545933a9 [fix #504] Dossier: initiated -> en_construction
The change must not impact the api
2017-12-15 11:52:09 +01:00
Simon Lehericey
e2bbd2a37a [fix #992] export: dossiers are order by initiated_at 2017-12-01 13:45:53 +01:00
Simon Lehericey
d90e22e332 Tests: add (or group) Timecop.return to resume time in specs 2017-11-29 16:07:39 +01:00
Simon Lehericey
28a047a64b [Fix #508]Api GeoJson: export dossier.json_latlngs to geojson 2017-11-28 14:41:08 +01:00
Simon Lehericey
a71574b8dd [fix #445]: add title to pages 2017-11-21 17:47:27 +01:00
Simon Lehericey
3f2419a2a3 Dossier: rename data_with_champs to to_sorted_values 2017-10-30 17:14:31 +01:00
Simon Lehericey
5f348df570 Dossier spec: remove forgotten focus 2017-10-27 10:48:29 +02:00
Simon Lehericey
8dedf6fdca [fix #575] dossier updated_at is ... updated when children are updated 2017-10-24 18:12:25 +02:00
Mathieu Magnin
a8ec374252 [Fix #813] When a brouillon is created, send an email to user 2017-10-20 12:13:55 +02:00
gregoirenovel
9ea396cc8b Avoid loading the association for the without_followers scope
As seen in https://stackoverflow.com/questions/5319400/want-to-find-records-with-no-associated-records-in-rails-3
2017-10-17 14:10:34 +02:00
Mathieu Magnin
0f945e2fea Simplify mailer parameters to be serializable (even if mail_template.id is nil) 2017-10-13 21:27:17 +02:00
gregoirenovel
e1bdbec815 Allow the customization of the dossiers table 2017-10-02 17:45:22 +02:00
Simon Lehericey
1cfeb10ce9 [Fix #503] Dossier: remove updated 2017-09-26 14:42:54 +02:00
Simon Lehericey
633b55aca0 [Fix #503] Dossier: remove replied 2017-09-26 14:42:54 +02:00
Simon Lehericey
fdbf34f04b Avis instruction: only authorized avis 2017-09-20 15:42:26 +02:00
Mathieu Magnin
931e547afa [Fix #395] Export user email in csv 2017-08-25 12:01:52 +02:00
Simon Lehericey
d40eef284d Dossier: fixup n+1 champ query 2017-08-03 13:02:13 +02:00
Simon Lehericey
1363999621 Dossier: fixup n+1 private champ query 2017-08-03 13:01:55 +02:00
Mathieu Magnin
b0c0477622 [Fix #315] Order champs by procedure order in export 2017-07-19 16:31:30 +02:00
gregoirenovel
9666ed7d5d Remove useless tests 2017-07-19 13:32:59 +02:00
Simon Lehericey
3a17c86a74 Follow: follow must be uniq 2017-07-18 15:12:10 +02:00
Mathieu Magnin
be3304f71e Add a scope to Dossier to check if procedure is not hidden 2017-07-04 14:34:16 +02:00
gregoirenovel
556359cd05 [Fix #318] Add annotations privées to exported files 2017-06-27 14:27:02 +02:00
gregoirenovel
14823560a1 Expose the motivation on exported files 2017-06-19 15:01:14 +02:00
Simon Lehericey
602527a09d [Fix #196] Attestation: building logic from template 2017-06-16 12:11:09 +02:00
gregoirenovel
f1907f4d0e Enable the Layout/EmptyLinesAroundBlockBody cop 2017-06-13 10:35:23 +02:00
gregoirenovel
107c322062 [Fix #323] Refactor received dossier notification: use a callback 2017-06-08 15:06:01 +02:00
gregoirenovel
5e5a01cdc8 Do not test scopes 2017-06-01 11:07:32 +02:00
gregoirenovel
ab1c19c09b Rename some Dossier scopes 2017-06-01 10:58:08 +02:00
gregoirenovel
4655707eb5 [Fix #319] Include archived dossiers in the export 2017-05-30 15:41:35 +02:00
gregoirenovel
4303dcef2c Organisation -> Organisme 2017-05-04 11:35:22 +02:00
gregoirenovel
d3a84eb20a Démarche -> Procédure 2017-05-04 11:33:26 +02:00
gregoirenovel
988947696e [Fix #161] Remove incorrect commas from Dossier#text_summary 2017-05-04 11:25:33 +02:00
gregoirenovel
f5c5ad532d Add Dossier#text_summary 2017-04-26 15:59:17 +02:00
Mathieu Magnin
40d897f538 Add accompagnateurs emails in API 2017-04-21 14:51:35 +02:00
Mathieu Magnin
762a11fc6f Define .termine as a scope and remove archived=false filter 2017-04-21 14:36:50 +02:00
Mathieu Magnin
320ff4839f Define .en_instruction as a scope and remove archived=false filter 2017-04-21 14:36:50 +02:00
Mathieu Magnin
1612b60126 Remove useless code 2017-04-13 16:54:00 +02:00
Mathieu Magnin
320d5da40f Add individual infos to flat table export serializer 2017-04-13 16:54:00 +02:00
gregoirenovel
df878b9ef4 Change Dossier#convert_specific_array_values_to_string’s signature and name
- It is always called with the data_with_champs
  argument

- Changing the signature requires a change of name
  in this case
2017-04-11 10:29:07 +02:00
gregoirenovel
64fdc7a2af Remove a Dossier#convert_specific_array_values_to_string useless test 2017-04-11 10:29:07 +02:00
Mathieu Magnin
bf0d466f4b Move export_full_generation method from Dossier to Procedure 2017-04-05 12:26:38 +02:00
Mathieu Magnin
b18c09e9fd Download dossiers button exports all dossiers except draft 2017-04-05 11:04:53 +02:00