Commit graph

405 commits

Author SHA1 Message Date
Pierre de La Morinerie
b7d17b0989 models: validate that no drop-downs are empty on publishing
Disallow publishing a procedure containing drop-downs with no selectable
values.
2021-12-02 09:00:37 +01:00
Pierre de La Morinerie
e219ec33d8 validators: rename no_empty_repetitions to no_empty_repetition 2021-12-02 09:00:37 +01:00
Pierre de La Morinerie
52b0fbf9b7 models: validate repetitions on publishing 2021-11-30 13:34:41 +01:00
Pierre de La Morinerie
48133c2595 models: don't save the procedure before the state transition
Otherwise a validation error occurs here instead of on save.
2021-11-30 13:34:41 +01:00
Pierre de La Morinerie
e5f5440663 models: explicitely save procedure's new revision
Deep-cloned objects have all their relationships stale. Thus, for a
newly deep-cloned revision, `revision.types_de_champs` returns `[]`,
even when it actually has associated types de champ.

This causes consecutive champs creations and re-ordering to fail in
subtle ways, like:

```
procedure.draft_revision.add_type_de_champ(…)
procedure.publish_revision!
procedure.draft_revision.add_type_de_champ(…)
procedure.draft_revision.move_type_de_champ(…) # this will fail
```

As `publish_revision!` created a new stale revision, moving the type
de champ fails because not all existing champs are found until the
object is refreshed.

We don't hit this path in production, because usually only a single
operation is made in a request.

To fix this, save the new revision before associating it as the draft
procedure.

(Another option would be to `reload` the revision after creation, but
this seems better contained and matches the name of the method.)
2021-11-25 08:49:17 +01:00
Pierre de La Morinerie
60c2718f29 models: remove custom code for file size validation message
With active_storage_validations 0.9.6, we can use the %{max_size}
variable directly in the error message.
2021-11-24 10:06:45 +01:00
Pierre de La Morinerie
2227dcc1e7 app: remove leftovers of procedure path autocomplete
We used to pre-validate the procedure, to display in advance if the path
could be used.

Now that the path autocomplete is long gone, we can remove this kludgy
code.
2021-11-23 14:30:21 +01:00
Paul Chavard
e74d599042 feat(procedure): remove duree_conservation_dossiers_hors_ds 2021-11-16 19:55:56 +03:00
Paul Chavard
f6b8689a97 fix(revisions): fix repetitions export with revisions 2021-11-03 18:20:48 +01:00
Paul Chavard
0e2f09dd6f fix(dossiers): wrap dossier discard in a transaction
By doing this we ensure that deleted_dossier are not created when dossier is not discarded
2021-11-02 18:17:35 +01:00
Paul Chavard
2a3a9dd822 feat(revisions): rebase dossiers brouillons 2021-10-20 17:26:09 +02:00
simon lehericey
7aee944daa show cnaf tdc when procedure is compatible 2021-10-12 14:27:20 +02:00
Paul Chavard
357c684688 feat(routage): self managing instructeurs 2021-09-27 15:06:17 +02:00
Paul Chavard
d4e8158887 feat(routing): add instructeurs_self_management_enabled to procedures 2021-09-27 15:06:17 +02:00
Ismael MOUSSA S
36dc9c2ca2 Add File Validation concern after refactoring 2021-09-21 12:11:20 -05:00
Ismael MOUSSA S
7c7c9c9ea4 Fix file size validation message 2021-09-21 12:11:20 -05:00
Ismael MOUSSA S
bdbb4deb87 ADD FILE_MAX_SIZE constant to set allow file size limit 2021-09-21 12:04:56 -05:00
Paul Chavard
0ff62c5a5e feat(routage): add routing_enabled to procedures 2021-09-18 11:22:35 +02:00
simon lehericey
b000590d81 add api particulier sources to procedure 2021-09-17 13:50:23 +02:00
simon lehericey
6c6205e188 a cloned procedure to a different admin does not keep api_particulier token and scopes 2021-09-16 09:30:11 +02:00
simon lehericey
2d2ae3a878 add api particulier scopes to procedure 2021-09-16 09:30:11 +02:00
Pierre de La Morinerie
745e19bb8e localize 2021-09-16 09:07:47 +02:00
simon lehericey
b29bae4707 a procedure has an encrypted api_particulier_token
Co-authored-by: François VANTOMME <akarzim@gmail.com>
2021-07-30 11:18:44 +02:00
Christophe Robillard
bc07a875eb integrate a mininum weight for the average dossier weight
before this commit, the average dossier weight took account only pieces
justificatives. With this commit, we add a minimum weight for other
files included in an archive like pdf_export, log operations,
attachments added to traitements. This minimum weight is set arbitrary,
from the observation of some random procedures in production
2021-07-06 15:58:45 +02:00
Paul Chavard
ce27999bc3 Refactor clone_attachments 2021-07-01 16:21:46 +02:00
Paul Chavard
280e54b59d Enable test revisions 2021-07-01 15:59:07 +02:00
Paul Chavard
15ff046428 Improuve revision changes messages 2021-06-24 11:39:49 +02:00
Paul Chavard
241eff76a3 Enable publish new revision only if some changes are found 2021-06-24 11:39:49 +02:00
Paul Chavard
0ca5e1abe2 Preview should reflect revision changes 2021-06-24 11:39:49 +02:00
Paul Chavard
35eccb5630 Show separate blocks for types de champ and annotation changes 2021-06-23 09:40:07 +02:00
Paul Chavard
19195008e8 Expose removed types_de_champ in exports 2021-06-23 09:40:07 +02:00
simon lehericey
eadae7af6b show all available tdc for procedure presentation 2021-06-23 09:40:07 +02:00
Paul Chavard
0d25f52309 Add changed? and compare on ProcedureRevision 2021-06-23 09:40:07 +02:00
Paul Chavard
15e9013264 Set published_at on revision when publishing a procedure 2021-06-23 09:40:07 +02:00
Christophe Robillard
a8840faadb move stats methods to appropriate concern class 2021-06-17 16:31:53 +02:00
Christophe Robillard
45ffae9eb3 affiche evolution temps de traitement 2021-06-17 16:31:53 +02:00
Christophe Robillard
701b72494d compute usual traitement time for specific month 2021-06-17 16:31:53 +02:00
Christophe Robillard
169f254c79 infer champ type from class 2021-06-09 10:52:38 +02:00
Christophe Robillard
5e180268cd remove one sql query 2021-06-09 10:52:38 +02:00
simon lehericey
9e43823f9a add average_dossier_weight
Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
2021-06-09 10:52:38 +02:00
Paul Chavard
1888f74b10 Prevent double processing of declarative dossiers 2021-06-04 17:55:40 +02:00
Paul Chavard
f526e303e8 Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-06-03 13:11:16 +02:00
Paul Chavard
3fb10fb4b8 Set published_at on revision when publishing a procedure 2021-06-03 13:11:16 +02:00
Paul Chavard
acb277e650 Use stable_id when replacing tags 2021-05-25 11:43:38 +02:00
Paul Chavard
f6508899de Refactor NotificationMailer 2021-05-04 12:05:06 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
Christophe Robillard
8b2849408c instructeurs can create and download archives 2021-04-28 11:40:58 +02:00
Pierre de La Morinerie
0cb2162a65 db: fix out-to-date Procedure comments 2021-04-27 15:36:22 +02:00
kara Diaby
541a36abbf Add boolean to procedures table 2021-04-19 10:23:45 +02:00