Commit graph

1053 commits

Author SHA1 Message Date
kara Diaby
da067597ab Add create expert method 2021-01-20 18:03:05 +01:00
kara Diaby
e0cb0eebab Tests : add an expert to a procedure and put give him the access to see the dossier final decision 2021-01-20 18:03:05 +01:00
simon lehericey
d409a9a6c5 Procedure and expert link 2021-01-20 18:03:05 +01:00
simon lehericey
d72f0c6dd2 Add authorized content type for pj 2021-01-18 17:23:08 +01:00
Paul Chavard
f33544f067 Fix type_de_champ repetition revision after clone
fix #5769
2021-01-12 10:57:34 +01:00
kara Diaby
2b06ee95e1 Add a method to retrieve all invited experts for all procedure dossiers 2020-12-21 14:55:51 +01:00
simon lehericey
4960eda5cb use stable id 2020-12-17 10:51:09 +01:00
simon lehericey
cbccdea8e0 move displayed_fields for select to procedure_controller 2020-12-17 10:51:08 +01:00
kara Diaby
f3c4040d2d add grace period to deleted dossiers 2020-12-16 15:00:26 +01:00
Christophe Robillard
15a395fbc7 superadmin: check complexity password server side 2020-12-15 16:26:09 +01:00
simon lehericey
bc4dc22aea spec: use real signature to avoid mocking 2020-12-14 14:09:15 +01:00
simon lehericey
5a9cd71783 fix bill signature 2020-12-11 15:49:05 +01:00
Paul Chavard
48e7822e34 Remove titres identite after a dossier is processed 2020-12-10 15:21:25 +01:00
clemkeirua
513d4f6ff1 move all the cron jobs in a dedicated directory 2020-12-08 13:22:43 +00:00
Christophe Robillard
5562e65bf3 refacto: rename administration to super_admin 2020-11-05 16:03:55 +01:00
Christophe Robillard
2a0ebd062a enable 2FA for manager
when trying to access manager, if superadmin did'nt enable otp, he/she is redirected to a page to enable 2FA. When superadmin is enabling 2FA, he has to to scan a qrcode with the 2FA application client. And afterwards, the superadmin has to log in with email, password and OTP code.
2020-11-05 16:03:55 +01:00
clemkeirua
89316c0689 fix counter for dossiers suivis/à suivre when unfollow 2020-10-28 13:51:35 +00:00
clemkeirua
b4910c557d ajout de procedure.dossiers_count_for_instructeur 2020-10-28 13:51:35 +00:00
Paul Chavard
7c58f06c60 always validate geometries returned from api 2020-10-08 16:03:28 +02:00
Paul Chavard
59086cc728 Fix geo length computations 2020-10-01 15:09:38 +02:00
Paul Chavard
4dfc1c719f Fix geo areas computations 2020-10-01 15:09:38 +02:00
Paul Chavard
1bd59c72e5 Include in exports types_de_champ from all revisions 2020-09-30 13:42:38 +02:00
clemkeirua
f3e487bd9e replace filter+first with find 2020-09-25 12:53:11 +00:00
clemkeirua
eb46cc6425 piecejusticative file validation focus on size 2020-09-25 09:35:16 +00:00
clemkeirua
c155de1d7e ajout de la liste des extensions 2020-09-25 09:35:16 +00:00
clemkeirua
31d48c2879 validation is enableed only for 'new' procedures 2020-09-25 09:35:16 +00:00
clemkeirua
8711e8f911 reenable validator on piece_justificative 2020-09-25 09:35:16 +00:00
Paul Chavard
26a6e18cb9 Do not crash when rgeo can’t calculate polygon area
example are “hourglass” shaped polygons
2020-09-23 16:52:08 +02:00
Paul Chavard
61c315b276 Fix geo area point coordinates display 2020-09-23 16:52:08 +02:00
kara Diaby
cb4e91c405 Add iban type de champ 2020-09-23 15:56:26 +02:00
Paul Chavard
973973ab6a Do not enqueue web hooks for empty urls 2020-09-22 17:03:19 +02:00
Paul Chavard
a3f3b8a8e0 procedure.dossiers through revisions 2020-09-22 10:55:17 +02:00
clemkeirua
f96377d878 refactor Dossier#with_notifications 2020-09-21 08:28:42 +00:00
clemkeirua
d01a53eb72 remove :cached_notifications gate 2020-09-21 08:28:42 +00:00
clemkeirua
d8b4cc67be add a test scenario for users 2020-09-18 11:16:34 +02:00
clemkeirua
1e32a3c11f add complexity check to admin account creation 2020-09-18 11:16:34 +02:00
clemkeirua
5a8fbde0e7 remove dead code in admin model 2020-09-18 11:16:34 +02:00
clemkeirua
de3118bc7b force password reset on admin promotion or creation 2020-09-17 16:39:13 +02:00
clemkeirua
0307beecd6 Revert "Merge pull request #5576 from tchak/soft-delete-users"
This reverts commit bf0d3914ce, reversing
changes made to 503527459e.
2020-09-17 15:39:16 +02:00
Paul Chavard
a0dd3604a4 User discard_and_anonymize! 2020-09-17 11:16:56 +02:00
simon lehericey
e4de522b48 only retrieve id of procedures with notifications 2020-09-11 09:43:04 +00:00
clemkeirua
a62907f33b add more tests for phone numbers 2020-09-09 09:00:03 +02:00
clemkeirua
c7b96d3d43 add feature-flip for instructeurs on cached notifications 2020-09-08 15:40:42 +00:00
clemkeirua
52ea5ef89a make Dossier#with_notifications great again
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2020-09-08 15:40:42 +00:00
clemkeirua
61cf33e3ca remove duplicate private champ 2020-09-04 15:40:23 +02:00
kara Diaby
ae61c279af migrate emails text editor to new interface 2020-09-03 14:42:22 +02:00
Paul Chavard
1488e0964b update models specs to use revisions 2020-09-02 11:26:26 +02:00
Judith
25a24ba7c8 removal of translation keys already present in the gem rails-i18n 2020-09-01 16:33:58 +02:00
Christophe Robillard
090a247ba9 validates phone champ server side 2020-08-20 15:33:03 +02:00
Christophe Robillard
f77cc06a91 prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
Pierre de La Morinerie
a7361fdbd3 models: require belong_to associations on mail templates 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
5a7bd24fba models: require belong_to associations on type_de_champ
- Make `type_de_champ.procedure` a requirement;
- Move the procedure_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
6328011f60 models: require belong_to associations on champ
- Make `champ.dossier` a requirement;
- Move the dossier_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Allow specs to only build the champ (instead of saving it to the
database), which bypasses the requirement to have a dossier.
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
71d9774d58 models: require belong_to associations on trusted_device_token 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
ce53e219e0 models: require belong_to associations on procedure_presentation
Some tests are still failing
2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
fe8804f208 models: require belong_to associations on individual 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
afb1c33154 models: require belong_to associations on geo_area 2020-08-18 15:57:37 +02:00
Pierre de La Morinerie
32e55a6d37 models: require belong_to associations on avis 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
aefdd5d2a1 models: require belong_to associations on attestation_template 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
c1e2928ce7 models: require belong_to associations on assign_to 2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
8962db38cc models: render attestations in a simpler way
The older method of instanciating an entire new rendering stack can be
made simpler using Rails >= 5.0 methods.

See https://api.rubyonrails.org/classes/ActionController/Renderer.html#method-i-render
2020-08-04 16:53:46 +02:00
Paul Chavard
1fca481c6e Cleanup after clone 2020-07-28 17:04:06 +02:00
clemkeirua
c91e231347 spec: replace reference to ds in password 2020-07-23 16:20:16 +02:00
Paul Chavard
a08e318617 Add implicit_order_column on revisions 2020-07-22 12:25:06 +02:00
Paul Chavard
69ab2e44fb Insert type_de_champ with correct initial position 2020-07-22 11:09:51 +02:00
Paul Chavard
58535c6a35 Add procedure revisions spec 2020-07-21 19:35:30 +02:00
Paul Chavard
0338080430 Remove unused procedure move type_de_champ code 2020-07-21 19:35:30 +02:00
Paul Chavard
d18a9c8162 Migrate procedures “on demand” 2020-07-21 19:35:30 +02:00
Paul Chavard
0a0912503b Add type_de_champ mutation methods to revision 2020-07-21 19:35:30 +02:00
Christophe Robillard
52e8f32e19 expert can only revoke avis claimed by him/her 2020-07-16 21:07:20 +02:00
Christophe Robillard
3ea34834a7 revoke expert avis 2020-07-16 21:05:11 +02:00
Paul Chavard
b628169053 Remove unsused drop_down_list model 2020-07-16 15:29:01 +02:00
clemkeirua
8a2aa13b74 remove pending tests 2020-07-15 09:27:23 +00:00
clemkeirua
299c86141c added before_save to PieceJustificativeChamp in order to set skip_pj_validation 2020-07-15 09:00:12 +00:00
kara Diaby
ba6b89743c put pending testsz 2020-07-13 12:24:48 +02:00
Paul Chavard
cb8cac395b fix spec name 2020-07-08 19:28:17 +02:00
Paul Chavard
3b9e6dba25 Update spec/models/type_de_champ_shared_example.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2020-07-08 19:28:17 +02:00
Paul Chavard
84ff75ed6b Update spec/models/type_de_champ_shared_example.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2020-07-08 19:28:17 +02:00
Paul Chavard
a92320e246 Update spec/models/type_de_champ_shared_example.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2020-07-08 19:28:17 +02:00
Paul Chavard
d8e864a7d9 Update spec/models/type_de_champ_shared_example.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2020-07-08 19:28:17 +02:00
Paul Chavard
660c95356b Update spec/models/type_de_champ_shared_example.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2020-07-08 19:28:17 +02:00
Paul Chavard
a74e52c828 Call remove_drop_down_list on before_save 2020-07-08 19:25:05 +02:00
Paul Chavard
3c9cc6c070 Remove repetition types_de_champ on type_champ change 2020-07-08 19:25:05 +02:00
Christophe Robillard
2c56511204 validate api_entreprise_token 2020-07-08 18:59:22 +02:00
Christophe Robillard
7fd4d46e8e remove empty spec file 2020-07-08 18:15:15 +02:00
Christophe Robillard
1253bb5994 store instructeur_email in traitement 2020-07-08 18:15:15 +02:00
Christophe Robillard
0be4b50ade update usual_traitement_time with traitement model 2020-07-08 18:15:15 +02:00
Christophe Robillard
a072d35211 use traitement model
when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
2020-07-08 18:15:15 +02:00
Christophe Robillard
f631acd118 update state date in aasm after callbacks
call aasm event methods, not state methods directly
2020-07-08 18:15:15 +02:00
Paul Chavard
c9ab80c880 WIP 2020-07-07 18:03:56 +02:00
Paul Chavard
13c21d89af Fix attestation_template spec 2020-07-07 18:03:56 +02:00
Paul Chavard
6a24c3f812 Rails app:update 2020-07-07 18:03:56 +02:00
Pierre de La Morinerie
060bf1f9ca factories: flesh out the default etablissement for a dossier 2020-07-06 11:41:25 +02:00
Pierre de La Morinerie
43569f687e specs: use fixture_file_upload rather than Rack::Test::UploadedFile
This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
2020-07-01 11:13:45 +02:00
Paul Chavard
97f91513c8 Store drop_down_list values as jsonb 2020-06-25 13:14:17 +02:00
Judith
9be58aa012 only downcasing search values for yes_no type_de_champs 2020-06-10 15:55:25 +02:00
Judith
ad53dfa84d Instructeurs: Changed the filters from 'true/false' to 'oui/non' for yes_no type_de_champ 2020-06-10 15:50:41 +02:00
Paul Chavard
901b6e23a8 Remove legacy carto 2020-06-04 16:03:23 +02:00
Christophe Robillard
cf9d6ccf34 export bilans in ods and xlsx 2020-06-04 15:31:16 +02:00
Christophe Robillard
d06867822b reorder bilans bdf csv 2020-06-03 15:45:11 +02:00
Paul Chavard
20705d6e30 Do not send draft norifications to users on inactive démarches 2020-05-27 16:36:46 +02:00
clemkeirua
77101208a4 Anonymisation de l'instructeur dans la messagerie 2020-05-18 12:56:30 +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
Christophe Robillard
f587e6600a extract class ApiEntrepriseToken
and check if token is expired
2020-05-06 10:57:45 +02:00
Paul Chavard
6556df2a85 Fix a crash in case of invalid geometry 2020-05-05 15:56:05 +02:00
Christophe Robillard
9de2c7c85a improve csv generation for bilans bdf 2020-04-30 16:15:16 +02:00
Paul Chavard
843e033c38 Allow instructeurs to download a GeoJSON document for a given dossier 2020-04-30 15:49:43 +02:00
Christophe Robillard
ddd3e6bb02 don't copy api_entreprise_token when cloning
except for an admin who owns the parent procedure
2020-04-29 17:17:20 +02:00
Paul Chavard
9cb612bb3d Show area and length on champ carto selections utilisateur 2020-04-23 10:21:18 +02:00
Pierre de La Morinerie
1cb18e51ac champ: return the parent dossier even when discarded
Dossier has a `default_scope { kept }`.

Because of that, when the parent dossier is discarded, `champ.dossier`
will return nil.

We should kill the default scope. But meanwhile, ensure that
`champ.dossier` returns even a discarded dossier.
2020-04-22 11:46:42 +02:00
Paul Chavard
e512870fd2 Cleanup procedure duree_conservation_dossiers_dans_ds validations 2020-04-16 19:40:19 +02:00
Paul Chavard
bc8217e030 Carte Editor sends FeatureCollection to the server 2020-04-16 18:29:19 +02:00
Paul Chavard
22604013d0 Expose multiple user selections on champ carte 2020-04-15 18:07:09 +02:00
clemkeirua
8c2f589cbf fix admin deletion of empty service with archived procedures 2020-04-10 20:01:40 +02:00
Paul Chavard
61eaca928f remove WarnExpiringDossiersJob 2020-04-09 11:11:51 +02:00
clemkeirua
ed45c88bdf do not clone groups instructeurs for admin outside the procedure 2020-04-07 09:25:40 +02:00
pedong
7806a26e2c copy groupe_instructeurs when clone 2020-04-07 09:22:33 +02:00
Christophe Robillard
dc31f41c26 fix tests for procedure_presentation 2020-04-06 17:39:51 +02:00
Christophe Robillard
5b6044803b forbid to create champ with same type_de_champ and same row 2020-04-06 17:39:51 +02:00
Paul Chavard
288ace2f34 Dossier on discarded procedure should have access to discarded procedure 2020-03-31 17:08:29 +02:00
Paul Chavard
bd81970f67 DeletedDossier should have access to discarded demarche 2020-03-31 17:08:29 +02:00
Paul Chavard
58c126308c Add DiscardedProceduresDeletionJob job 2020-03-31 17:08:28 +02:00
Paul Chavard
876e05aed3 Discard demarches from manager 2020-03-31 17:08:28 +02:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
Pierre de La Morinerie
fe13043efd dossier: prepare validations to piece_justificative champs
We can't yet enable the validations, because of an issue that will
(hopefully) be solved with Rails 6.

See https://github.com/betagouv/demarches-simplifiees.fr/issues/4926
2020-03-30 11:12:25 +02:00
Pierre de La Morinerie
245ef2befd specs: fix an Rspec warning 2020-03-30 11:12:25 +02:00
Paul Chavard
c707a21f97 Rename delete_and_keep_track -> discard_and_keep_track 2020-03-26 14:23:23 +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
e76870844e update test for dossier#en_construction_close_to_expiration
It now takes into account en_construction_conservation_extension
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
kara Diaby
1f27652cd3 add files validations to models 2020-03-23 11:28:13 +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
kara Diaby
395af2fbb0 instructors : receive daily emails for declarative folders 2020-03-17 15:54:50 +01:00
Christophe Robillard
d8d9b0922d remove orphan services when destroying admin 2020-03-16 21:40:05 +01:00
Christophe Robillard
50007b2aac highlight demande tab when groupe instructeur updated 2020-03-04 14:56:59 +01:00
Christophe Robillard
e8bef76772 fix test for procedure presentation 2020-03-03 18:07:50 +01:00
Paul Chavard
c46e012c10 Use dossier.assign_to_groupe_instructeur 2020-03-03 10:30:49 +01:00
kara Diaby
4a70a7fcc8 remove email_notifications_enabled column because of the new daily_email_notifications_enabled 2020-02-27 11:09:19 +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
kara Diaby
6102ba6039 Do not permit to upload a GIF file via javascript 2020-02-25 23:33:15 +01:00
Paul Chavard
24d237de9e A cloned procedure should not have canonical relationship 2020-02-25 15:26:43 +01:00