Commit graph

2843 commits

Author SHA1 Message Date
Christophe Robillard
81fa1d0e89 utilise un ordre plus logique pour identite entreprise
homogenise l'affichage des valeurs monétaires
elargit la colonne libellé
2020-06-09 16:59:57 +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
75a268aed6 show some info from bilans 2020-06-04 12:33:33 +02:00
Christophe Robillard
d06867822b reorder bilans bdf csv 2020-06-03 15:45:11 +02:00
Judith
d930124839 change procedure_auto_archive helper name and added a helper for 23 h 59 2020-05-28 13:22:02 +00:00
Judith
6b65ee8d15 mailers: display auto-archive date in notifications 2020-05-28 13:22:02 +00:00
Judith
38eb60f2ac views: display auto-archive date on procedure description 2020-05-28 13:22:02 +00:00
Judith
59346ee868 mailers: mention the auto_archive in notify_new_draft 2020-05-28 13:22:02 +00:00
Paul Chavard
20705d6e30 Do not send draft norifications to users on inactive démarches 2020-05-27 16:36:46 +02:00
Christophe Robillard
fb87a09c02 doesn't update dossier etablissement for siret controller 2020-05-26 18:13:20 +02:00
Pierre de La Morinerie
2f509c2536 specs: remove unused test case
Actual code was removed in 0ff6c793ae

The spec was never executed, because it lacked the `_spec.rb` suffix.
2020-05-20 17:45:06 +02:00
Christophe Robillard
d92a0ba8f3 raise BadFormatRequest error
L'intention est de distinguer ce type d'erreur avec les erreurs serveur
5xx.
Lorsque l'api est appelé par un Job, les erreurs serveur seront retry, car éphémères.
Alors que les erreurs de type BadFormatRequest ou ResourceNotFound n'ont
pas être retried.
2020-05-20 11:09:54 +02:00
Christophe Robillard
f40123fee1 display only etablissement infos
all the other infos are not yet available because the jobs which
retrieve it are performed later
2020-05-20 11:09:54 +02:00
Christophe Robillard
013e78ce4e fix creating dossier feature sprec 2020-05-20 11:09:54 +02:00
Christophe Robillard
637bde7326 update siret_controller when finding etablissement
now, `ApiEntrepriseService` does'nt return a hash anymore but an
etablissement which is already persisted.
2020-05-20 11:09:54 +02:00
Christophe Robillard
eebfb5ee5b update dossiers_controller when updating siret
now, `ApiEntrepriseService` does'nt return a hash anymore but an
etablissement which is already persisted.
2020-05-20 11:09:54 +02:00
Christophe Robillard
ba5fa9aa4b update ApiEntrepriseService
There is now the `create_etablissement` method which
create etablissement with EtablissementAdapter
and enqueue api_entreprise jobs to retrieve
all informations we can get based on SIRET
2020-05-20 11:09:54 +02:00
Christophe Robillard
f4ebb5d107 create api_entreprise jobs 2020-05-20 11:09:54 +02:00
Christophe Robillard
e3ee423197 call api_entreprise adapters with siret 2020-05-20 11:09:54 +02:00
Pierre de La Morinerie
9f1407b6d7 expiration: fix the mailer arguments
The mailers expect serializable arguments, but were given
ActiveRecord::Relation objects instead. This made the mailers throw an
exception.

But how was that possible ? This code is tested, and the tests were
green.

Well, the specs spy on the mailer implementation, in order to check that
the mailers methods were properly called. Fair enough.

But if the specs mock the mailer code (instead of calling the original
implementation), we may not notice that the original implementation
rejects our method parameters.

Here this is the case: once we actually call the original implementation
the tests start to fail, because some arguments are not converted from
an ActiveRecord::Relation to a serializable array.

This is fixed by ensuring that the mailer code is executed (and doesn't
throw an exception).
2020-05-18 16:24:08 +02:00
Pierre de La Morinerie
b63fa0e6b8 dossier: remove "Birthdate" column from export 2020-05-18 13:14:28 +00:00
Pierre de La Morinerie
00adb006b4 specs: improve ProcedureExportService spec 2020-05-18 13:14:28 +00:00
clemkeirua
77101208a4 Anonymisation de l'instructeur dans la messagerie 2020-05-18 12:56:30 +00:00
Pierre de La Morinerie
93bb5283ff app: remove the feature flag for pieces justificatives auto-upload
The feature works as intended: we can remove the feature flag.
2020-05-14 17:39:07 +02:00
Pierre de La Morinerie
190548844a dossiers: add piece justificative filename to spreadsheet export 2020-05-14 10:18:10 +00:00
Paul Chavard
f0148184ca Remove legacy carto code 2020-05-13 12:17:04 +02:00
Pierre de La Morinerie
51cb3a04a3 app: fix JS redirection with Turbolinks disabled
When Turbolinks is enabled, a `redirect_to` in a `format: :js` request
will emit code that instructs Turbolinks to navigate to the page.
Turbolinks will then load the redirection target as HTML, and display
it.

But with Turbolinks disabled, the same `redirect_to` will instead
respond with a standard `302: redirect`. `Rails.ajax` will interpret
this redirect as "Please perform the same call again to the redirected
URL, in the same format" – and request our redirection target, but
using `format: :js`.


This breaks the "Publish procedure" button. In that case, we really want
the page to be navigated to. Add an explicit JS redirect, so that the
redirection occurs in HTML.
2020-05-13 11:04:16 +02:00
Pierre de La Morinerie
b5f1d97629 app: disable Turbolinks
Fix #5039
2020-05-13 11:04:16 +02:00
Paul Chavard
dfc004d7bb Unarchive dossier when repasser_en_instruction 2020-05-12 19:05:18 +02:00
Christophe Robillard
aab4bb81ee return bilan bdf csv for expert 2020-05-11 13:05:50 +02:00
kara Diaby
1cc04092f4 import GPX file in browser [Carto] 2020-05-11 11:36:36 +02:00
Paul Chavard
4f2e504cc2 Add carto import api
takes a FeatureCollection to import and returns an augmented champ FeatureCollection
2020-05-07 12:06:42 +02:00
clemkeirua
36f381a743 fix flacky test 2020-05-07 10:23:28 +02:00
Paul Chavard
05e408225b Implement atomic operations on MapEditor 2020-05-06 16:46:14 +02:00
Christophe Robillard
dba77ec0b8 fix spec with not expired token
and use of `ApiEntrepriseToken#roles`
2020-05-06 10:57:45 +02:00
Christophe Robillard
dbf04dd0d8 make api entreprise call only if token not expired 2020-05-06 10:57:45 +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
Paul Chavard
4299c9dbea Use a “safe” reference date in expiration tests 2020-05-05 12:41:45 +02:00
Christophe Robillard
9de2c7c85a improve csv generation for bilans bdf 2020-04-30 16:15:16 +02:00
Christophe Robillard
b12226c667 fetch and store bilans bdf 2020-04-30 16:15:16 +02:00
Christophe Robillard
85b2e9ef44 create bilans_bdf_adapter 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
3ddb5a4cb4 store attestation fiscale and display 2020-04-30 11:39:54 +02:00
Christophe Robillard
38c68b16e3 create attestation_fiscale_adapter 2020-04-30 11:39:54 +02:00
Paul Chavard
b516cbc179 Enable republish on démarches dépubliée 2020-04-29 18:04:35 +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
Christophe Robillard
158b4802ab store attestation sociale and display 2020-04-29 16:25:47 +02:00
Christophe Robillard
d74b14c205 fetch attestation sociale url 2020-04-29 14:25:55 +02:00
Christophe Robillard
b147956a92 create attestation_sociale_adapter 2020-04-29 14:01:48 +02:00
Christophe Robillard
4bd4524f67 fix api_entreprise specs 2020-04-28 15:17:11 +02:00
Christophe Robillard
e29af48420 call api_entreprise with specific token if exist 2020-04-28 15:17:11 +02:00
Christophe Robillard
14ff18ca80 store specific api-entreprise token for a procedure 2020-04-28 15:17:11 +02:00
clemkeirua
1ac7ec2dca precision dans mail suppression dossier en construction 2020-04-28 12:42:00 +00:00
Christophe Robillard
339066778d send notif only to the right instructeurs
after a dossier creation, only the instructeurs that belong to the group
instructeur of the dossier, and who want notif will be notified by mail
2020-04-23 13:01:57 +02:00
Paul Chavard
9cb612bb3d Show area and length on champ carto selections utilisateur 2020-04-23 10:21:18 +02:00
Christophe Robillard
792e755af9 expose effectif_annuel dans api graphql 2020-04-23 09:53:27 +02:00
Christophe Robillard
453adf3c74 instructeurs: affiche l'effectif moyen annuel n-1 2020-04-23 09:53:27 +02:00
Pierre de La Morinerie
32ad152347 specs: ensure that discarded procedures are not shown 2020-04-22 19:01:26 +02:00
Pierre de La Morinerie
abe692ecc2 specs: refactor instructeur procedures controller specs 2020-04-22 19:01:16 +02:00
Paul Chavard
31943f7d9c Add handeling of expired processed dossiers to deletion service 2020-04-22 15:39:10 +02:00
Paul Chavard
f1b531911b Handle processed dossiers in deletion mailers 2020-04-22 15:39:10 +02:00
Pierre de La Morinerie
f29ec5c775 instucteurs: don't show discarded procedures in the list 2020-04-22 15:16:21 +02:00
Pierre de La Morinerie
15645e11e3 instructeur: improve InstructeurController#index test 2020-04-22 15:12:34 +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
Christophe Robillard
149b98007f add effectif mensuel to graphql api 2020-04-21 21:13:07 +02:00
Christophe Robillard
1165f8483d rename effectif columns 2020-04-21 21:13:07 +02:00
Christophe Robillard
db3ef195ad fetch and show effectif mensuel
- fetch and store effectif mensuel (at the creation of the dossier or
when updating a siret field

- show effectif mensuel only for instructeurs
2020-04-21 14:22:11 +02:00
Christophe Robillard
599d8e33e8 create ApiEntreprise::EffectifsAdapter 2020-04-21 14:22:11 +02:00
clemkeirua
2d68d7dc59 fix to_tsquery disallowed chars 2020-04-20 15:15:22 +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
Paul Chavard
52d2ace823 Remove quartiers prioritaires 2020-04-14 10:29:59 +02:00
clemkeirua
8c2f589cbf fix admin deletion of empty service with archived procedures 2020-04-10 20:01:40 +02:00
clemkeirua
7335500be4 tests for dossier_helper#demandeur_dossier 2020-04-10 13:14:39 +02:00
Christophe Robillard
f683b850c3 Notifie instructeurs le souhaitant lors depot dossier
Notifie par mail uniquement les instructeurs qui le souhaitent à chaque dépôt de dossier
2020-04-09 15:02:05 +02:00
Christophe Robillard
ae18ff6627 Notifie tous les instructeurs lors dépôt dossier
- envoie un mail à tous les instructeurs d'une procédure après le dépôt
d'un nouveau dossier
2020-04-09 14:33:56 +02:00
Christophe Robillard
969478b706 Envoie une notif aux followers_instructeurs le souhaitant
après chaque message déposé par l'usager
2020-04-09 14:17:07 +02:00
Christophe Robillard
415d5c765e envoie une notification à chaque follower_instructeur après un commentaire déposé 2020-04-09 14:17:07 +02:00
Paul Chavard
61eaca928f remove WarnExpiringDossiersJob 2020-04-09 11:11:51 +02:00
Pierre de La Morinerie
7ff381b6f0 attachments: remove the buggy fallback
The fallback would fail on non-champ attachments.
2020-04-09 10:40:08 +02:00
Pierre de La Morinerie
7e19dd2cda Revert "Revert "Fix middle-click on "Delete attachment" button""
This reverts commit 6e8bd6957f.
2020-04-09 10:40:08 +02:00
clemkeirua
590cee050f add tests for dossier_search_service 2020-04-09 09:42:31 +02:00
clemkeirua
46e14f4033 add test for users/list_dossiers_spec 2020-04-09 09:42:31 +02:00
clemkeirua
8ff3d9ea47 update existing tests 2020-04-09 09:42:31 +02:00
Paul Chavard
32f783142c [GraphQL] allow to query dossiers by groupe instructeur 2020-04-09 09:29:28 +02:00
Pierre de La Morinerie
6e8bd6957f
Revert "Fix middle-click on "Delete attachment" button" 2020-04-08 17:40:58 +02:00
Pierre de La Morinerie
b748e9773f attachments: fix opening the delete link directly
When cliking on the "Delete attachment" link, and opening the URL
in a new tab, the `DELETE /attachements/:id` will become
`GET /attachments/:id` – which will cause the `show` action to be
routed with an html format (instead of JS).

In that case, we don't want to throw an error at the user face.
Instead simply re-render the dossier page (if any).

Fix a long-standing error in Sentry.
2020-04-08 13:40:32 +02:00
Pierre de La Morinerie
0077ff4b75 attachments: refactor the controller specs 2020-04-08 12:05:55 +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
ca6c97bf0f Refactor expired dossiers deletion service 2020-04-02 15:24:02 +02:00
Pierre de La Morinerie
059e11601b policies: fix champ policy for guest users 2020-04-02 11:27:14 +02:00
Pierre de La Morinerie
ac922c456e policies: refactor champ_policy_spec
Creating champs without attaching them to a procedure works only by
chance.
2020-04-02 11:27:13 +02:00
Paul Chavard
c0bbfa42b7 Reassign discarded dossiers on group_instructeur
fix #4851
2020-04-01 18:10:12 +02:00
Paul Chavard
7ba4c513e6 Refactor notify near deletion mailers 2020-04-01 17:40:52 +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
e4ab2574ce Démarches discarded by administrateur can be reactivated in manager 2020-03-31 17:08:28 +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
876e05aed3 Discard demarches from manager 2020-03-31 17:08:28 +02:00
Paul Chavard
60cb9bcf09 Remove brouillons deleted dossiers 2020-03-31 16:54:33 +02:00
Pierre de La Morinerie
6417c0d2c0 dossiers: allow auto upload of attachments 2020-03-31 13:09:44 +02:00
Pierre de La Morinerie
7a27e78452 specs: remove unused wait-for-ajax helper
This helper is:
- no longer used;
- buggy (not all requests increment it);
- discouraged (we should instead match an UI change that signals the end
of an ajax request).

Good riddance.
2020-03-31 12:54:49 +02:00
Pierre de La Morinerie
cae256fd28 rspec: allow Rails to auto-migrate the test schema
rails_helper already has `ActiveRecord::Migration.maintain_test_schema!`
which automatically updates the test database if needed.

However, if we raise **before** `maintain_test_schema` had the chance
to do its job, the test database is never-automigrated.

Thus by removing the check, we ensure the test database will be migrated
as needed (and still an error will be raised if the schema cannot be
applied).
2020-03-31 12:48:32 +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
Paul Chavard
742cc15209 Use base CronJob 2020-03-31 12:25:46 +02:00
Paul Chavard
33bf2fe109 remove deprecated AutoReceiveDossiersForProcedureJob 2020-03-31 12:25:46 +02:00
Paul Chavard
c40d689edf Use bigger deltas to allow for month length variations 2020-03-31 11:50:59 +02:00
Pierre de La Morinerie
ed5f2fa35f attestation: fix preview of logos
Turns out that assigning the params to the procedure calls `read` on the
images files. Calling `read` moves the seek offset to the end of the
file; which means that subsequent calls to `read` return an empty
string.

Fix the issue by calling `rewind` before attempting to `read` the file,
to ensure the seek offset is at the beginning of the file.

Fix #4958
2020-03-30 14:58:50 +02:00
Pierre de La Morinerie
b8c3d7c6bd attestation: ensure the PDF is rendered successfully 2020-03-30 14:58:50 +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
a60b6b6776 Use ’ consistently instead of ' 2020-03-26 17:27:48 +01:00
Paul Chavard
c763679b54 Remove non-existant columns from manager dashboards 2020-03-26 16:17:07 +01: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
Pierre de La Morinerie
f895570b00 dossier: make the upload label a real label 2020-03-25 14:43:09 +01:00
clemkeirua
a34b45e4f4 make the 'male' field selected by default during identity creation 2020-03-25 09:50:41 +00:00
Christophe Robillard
b4b92accf1 instructeur: show deleted dossiers for a procedure 2020-03-25 10:19:07 +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
clemkeirua
d49f6e703e fix tests for datetime 2020-03-24 16:54:35 +00: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
Christophe Robillard
884de51b94 Revert "Revert "go to procedure after cliking link""
This reverts commit 952bae32fe.
2020-03-20 10:41:36 +01:00
Pierre de La Morinerie
1b4a218b0e specs: remove useless chrome argument
The `options.add_argument('--headless')` above is sufficient.
2020-03-19 17:47:33 +01:00
Paul Chavard
cd0acb1344 Cleanup dossier mailers 2020-03-19 16:52:18 +01:00
simon lehericey
3e7cef63c6 add mailer preview 2020-03-18 15:25:02 +01:00
simon lehericey
3dd4ea26c7 add similar tests for send_brouillon_expiration_notices and delete_expired_brouillon_and_notify 2020-03-18 15:25:02 +01:00
simon lehericey
3f6012bff5 Delete complicated test 2020-03-18 15:25:02 +01:00
simon lehericey
74db7ab146 test for #send_en_construction_expiration_notices 2020-03-18 15:25:02 +01:00
simon lehericey
f35c0518b7 test for #delete_expired_en_construction_and_notify 2020-03-18 15:25:02 +01:00
simon lehericey
043847ae6e change notify_automatic_deletion_to_administration signature 2020-03-18 15:25:02 +01:00
Paul Chavard
fe1cd2a47b Delete and notify en_construction dossiers 2020-03-18 15:25:02 +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
Christophe Robillard
952bae32fe Revert "go to procedure after cliking link"
This reverts commit 795eabb1ea.
2020-03-18 14:45:39 +01:00
Christophe Robillard
795eabb1ea go to procedure after cliking link
even for an instructeur which is not signed in and unstrusted
2020-03-18 11:16:19 +01:00
Christophe Robillard
8e7f210216 affiche infos entreprise uniquement si diffusable
le champ de type siret affiche les infos d'une entreprise dont les infos sont diffusables uniquement aux instructeurs
2020-03-17 15:57:02 +00:00
Christophe Robillard
c21dd3b830 affiche infos d'un usager entreprise uniquement si diffusable
pour un usager de type entreprise qui a choisi de ne pas diffuser publiquement ses infos,
elles sont affichées uniquement aux instructeurs
2020-03-17 15:57:02 +00:00