Commit graph

191 commits

Author SHA1 Message Date
Paul Chavard
16bba911ba Revert "Merge pull request #7637 from tchak/chore-add-missing-foreign-keys"
This reverts commit b21ee46dc2, reversing
changes made to dd85b5c35c.
2022-09-21 15:20:42 +02:00
Damien Le Thiec
d8afe81034 Setup RNA champ 2022-09-21 15:18:08 +02:00
Paul Chavard
84b9644bcd fix(db): add missing foreign keys 2022-09-20 15:16:52 +02:00
Paul Chavard
d35ceb7214 fix(champs): finish EditableChampComponent refactor 2022-09-08 11:26:29 +02:00
simon lehericey
ac0ac171ad perf(dossier): remove unused row validation
Gain, one request per champ not child
2022-09-07 15:00:40 +02:00
Colin Darie
4ece7c2494 fix(champ): remove null byte before save
Les null bytes peuvent être injectés lors de c/c depuis certains documents,
et ne sont pas sauvegardables en base, rendant la sauvegarde d'un dossier impossible.

Closes #7656

https://sentry.io/organizations/demarches-simplifiees/issues/3194932607/activity/?project=1429550&query=is%3Aunresolved
2022-08-31 11:39:34 +02:00
simon lehericey
898badb579 a champ is mandatory when visible with a mandatory tdc 2022-08-09 10:25:47 +02:00
Paul Chavard
a24885c2ee feat(champ): can condition on other option 2022-08-04 15:28:54 +02:00
Paul Chavard
782af3322a fix(patron): when rendering “patron” champs should have dossier 2022-07-28 12:10:32 +02:00
Paul Chavard
d9eea35ae8 fix(dossier): decoralate dropdown behaviour from autosave 2022-07-21 18:40:16 +02:00
Paul Chavard
3e40b6d7bc fix(graphql): handle annotations inside blocks 2022-07-21 14:54:14 +02:00
Paul Chavard
0f9d8b6a39 feat(dossier): exclude conditionally invisible fields from mandatory check 2022-07-12 17:33:42 +02:00
Paul Chavard
120b593015 feat(dossier): toggle conditional champs visibility 2022-07-12 17:33:42 +02:00
Paul Chavard
6801b04b7b feat(type_de_champ): type_de_champ editor in stimulus/turbo 2022-06-17 11:04:09 +02:00
Paul Chavard
564daeffe8 perf(dossier): improuve dossier preloading perf 2022-06-14 09:04:26 +01:00
Paul Chavard
6f98def288 refactor(revision): remove old code 2022-05-31 08:58:53 +02:00
simon lehericey
abc3681053 delegate stable_id to tdc 2022-05-24 15:38:50 +02:00
Paul Chavard
6c2a3bafa4 refactor(dossier): champs order by coordinate 2022-05-18 11:20:50 +02:00
Paul Chavard
4523c0590c fix(dossier): champs repetable in champs private 2022-05-04 15:57:25 +02:00
Paul Chavard
b94bc8fd8a refactor(dossier): use champ id as champ attributes key 2022-05-03 16:14:54 +02:00
simon lehericey
ea361643be types_de_champ -> types_de_champs_public 2022-05-03 11:05:24 +02:00
simon lehericey
44f2d93277 quick fix of sections in preview 2022-03-15 10:54:39 +01:00
Paul Chavard
c60a8970f1 perf(dossier): memoize champ.sections on dossier 2022-03-11 00:15:53 +01:00
Paul Chavard
54b559364a feat(dossier): replace discarded with visible_by_administration 2022-03-10 14:29:40 +01:00
Paul Chavard
fc058f721d a11y(champs): expose ids for UI on champ 2022-01-05 12:33:40 +01:00
kara Diaby
dc35d9521f add other option to liste deroulante champ 2021-10-26 16:11:15 +02:00
Paul Chavard
d308448f02 feat(type_de_champ): add secondary label and description do linked drop downs 2021-10-26 12:18:01 +02:00
Paul Chavard
09a09d3fcf feat(revisions): add rebased_at to champs 2021-10-20 17:26:09 +02:00
simon lehericey
354735ace4 add champ value_json jsonb column 2021-10-12 14:27:20 +02:00
Paul Chavard
ac0f50b488 Improuve champ blank check 2021-07-22 10:45:25 +02:00
Paul Chavard
dfc46a8736 Enable add descriptions to cadastres 2021-05-26 11:27:09 +02:00
Paul Chavard
c20ad5ca17 Remove the link between commentaire and user 2021-04-22 15:10:47 +01:00
Paul Chavard
5e5122a436 Prevent crash in preview where there is no siblings 2021-04-06 18:15:29 +01:00
Paul Chavard
2702660d72 Update app/models/champs/header_section_champ.rb
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
2021-04-06 10:45:16 +01:00
Pierre de La Morinerie
3499f5af9a models: remove invalid Dossier ↔︎ Champ inverse relationship
`Dossier.champs` is not really an inverse of `Champs.dossier`: when a
Champ record is created, it should not always be added to dossier.champs
(for instance if the champ is private).

NB: this breaks the workaround we added in #3907 to fix the parent
dossier not being touched in some cases (the workaround was to add an
inverse relationship, but we now have to remove it).

The new workaround is to watch for `changed_for_autosave?` on champs.
Unlike `changed?`, `changed_for_autosave?` also detects changes to
attachments. This allows us to touch both `last_champ_updated_at` and
`updated_at` in a single pass.
2021-04-06 10:26:17 +02:00
Paul Chavard
1449fbbe67 Fix multiple_drop_down_list mandatory check 2021-03-18 15:22:28 +01:00
Paul Chavard
d24ee27cac Try to reduce the number of external data fetches
Only fetch external data if the external_id is the current one and data is not yet fetched
2021-03-11 14:56:37 +01:00
Paul Chavard
7eee14feef Add ChampFetchExternalDataJob 2021-02-17 19:10:16 +01:00
Paul Chavard
a591d5528e Add job exception log methods to champ and dossier 2021-02-05 18:56:27 +01:00
Paul Chavard
78a07ef021 Add job exception logs to dossier and champ 2021-02-04 19:27:27 +01:00
Paul Chavard
09a3cacd88 Add external_id to champs 2021-01-15 11:50:02 +01:00
Paul Chavard
a1643dad84 Add data column to champ 2021-01-14 17:31:37 +01:00
Paul Chavard
48e7822e34 Remove titres identite after a dossier is processed 2020-12-10 15:21:25 +01:00
clemkeirua
9019a8b380 ensure a dossier_id is set if possible 2020-09-30 16:50:28 +02:00
clemkeirua
61cf33e3ca remove duplicate private champ 2020-09-04 15:40:23 +02:00
Paul Chavard
6d4425885d Fix champ order joins sql error 2020-09-03 18:32:43 +02:00
Paul Chavard
ec72fdd164 Remove migration service 2020-09-02 11:26:26 +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
11456109c0 models: explicitly mark optional belongs_to relationship as so
This prepares making the `belongs_to` relationship required by default.
2020-08-18 15:57:36 +02:00
Pierre de La Morinerie
6d28069539 models: generate annotations 2020-08-12 11:45:53 +02:00
Paul Chavard
b628169053 Remove unsused drop_down_list model 2020-07-16 15:29:01 +02:00
Paul Chavard
97f91513c8 Store drop_down_list values as jsonb 2020-06-25 13:14:17 +02:00
Christophe Robillard
fb87a09c02 doesn't update dossier etablissement for siret controller 2020-05-26 18:13:20 +02:00
kara Diaby
db5fd9bd0f fix bug on mandatory carto champ for the new map editor 2020-05-15 13:44:50 +02:00
Paul Chavard
ef2d9e1138 Expose stable_id on champ 2020-04-30 15:49:31 +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
5b6044803b forbid to create champ with same type_de_champ and same row 2020-04-06 17:39:51 +02:00
clemkeirua
6d02e6e9e8 replaced helper has_html_label? with inheritance 2020-03-24 16:54:36 +00:00
Pierre de La Morinerie
d6a9318d05 champ: fix siblings for repetition champs
Fix a crash when requesting the `section_index` of a section header
in a repetition champ.
2020-02-17 17:11:17 +01:00
Pierre de La Morinerie
f8ed7ec051 form: display index of section in header 2020-02-13 11:18:46 +01:00
Paul Chavard
86b271997b Invite experts to linked dossiers
closes #3669
2019-10-23 13:10:09 +02:00
Paul Chavard
eb7aba18e6 Add dossier champs and annotations types 2019-09-24 10:47:21 +02:00
Paul Chavard
b97cbd3402 Serialize champ repetition for tags
closes #4272
2019-09-12 17:23:18 +02:00
Paul Chavard
b266915892 Add repetitions to api 2019-08-01 10:04:35 +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
Paul Chavard
91f2d7d706 Remove deprecated virus_scan model 2019-05-03 11:07:19 +02:00
Paul Chavard
8d093bd9ba Fix missing dossier_id on champs inside repetition 2019-04-18 16:55:35 +02:00
simon lehericey
2f66625f18 Manager: improve dossier view 2019-02-19 14:30:14 +01:00
Paul Chavard
071448e1d9 Champ Repetition dossier editor 2019-02-04 16:19:07 +01:00
gregoirenovel
866c74ce63 Add Champ#for_api 2019-01-08 12:32:27 +01:00
gregoirenovel
66d1b7ba10 Use ternary conditions 2019-01-08 12:32:26 +01:00
gregoirenovel
9e42190148 Remove the proxy value_for_export method
Overload for_export instead
2019-01-08 12:32:26 +01:00
gregoirenovel
7cd50531cf Remove the proxy string_value method
Overload to_s instead
2019-01-08 12:32:26 +01:00
gregoirenovel
186e362701 Enable the Layout/SpaceInsideArrayLiteralBrackets 2019-01-03 10:53:50 +01:00
Paul Chavard
5d1c24f3d8 Add type de champ repetition models (with row) 2018-12-19 15:31:11 +01:00
Paul Chavard
6706b9004f Fix includes on api queries 2018-11-08 14:45:09 +01:00
Paul Chavard
c8c75fc254 Better handle empty user selection layers 2018-10-23 09:35:25 +02:00
Frederic Merizen
0e639030f9 [#2179] Generate denormalized search terms value for Dossier 2018-07-27 11:11:52 +02:00
Frederic Merizen
7fdb523b1a We can use the shorter syntax fort ordered_champs(_private)
now that the old preview is gone
2018-06-28 10:27:07 +02:00
Frederic Merizen
2f206af0d6 [#1421] Make label clickable for drop-down lists 2018-06-27 17:02:46 +02:00
Frederic Merizen
e99931527b [#1421] Move pays to PaysChamp 2018-06-19 15:20:01 +02:00
Frederic Merizen
0239f936d7 [#1421] Move departements to DepartementChamp 2018-06-19 15:20:01 +02:00
Frederic Merizen
5b59bce0b6 [#1421] Move regions to RegionChamp 2018-06-19 15:20:01 +02:00
Frederic Merizen
95666238ea [#1421] Move piece justificative error code to piece justificative champ 2018-06-19 15:20:01 +02:00
Frederic Merizen
6af27a7190 [#1421] Move same_hour / same_minute to typed champ 2018-06-19 15:20:01 +02:00
Frederic Merizen
41734092b2 [#1421] Move type specific for_export code to typed champs 2018-06-19 15:20:01 +02:00
Frederic Merizen
ee8616fb97 [#1421] Move type specific to_s implementations to typed champs 2018-06-19 15:20:01 +02:00
Frederic Merizen
c2f199c5aa [#1421] Move piece justificative specific validation to PieceJustificativeChamp 2018-06-19 15:20:01 +02:00
Frederic Merizen
c690d3819e [#1421] Move type-specific before_save to typed champs 2018-06-19 15:20:01 +02:00
Mathieu Magnin
927cd3c6f4 Create virus scan model to store clamav result 2018-06-12 15:12:38 +02:00
Paul Chavard
e8f3fda1f0 Add STI champ models 2018-03-29 17:45:19 +02:00
Frederic Merizen
2fa88a432b Add missing brackets around parameters in method definitions 2018-03-20 17:54:51 +01:00
Paul Chavard
5faf4cdd84 Remove all references to old STI 2018-03-08 14:17:04 +01:00
gregoirenovel
0a9f442260 Enable some Rails cops 2018-03-06 17:18:44 +01:00
gregoirenovel
b33fd6dd37 Fix rubocop warnings 2018-03-02 15:42:20 +01:00
gregoirenovel
ee145180a3 Add a piece_justificative_file attribute to Champ 2018-02-15 11:15:23 +01:00
Paul Chavard
db42c0c0cf Fix public and private champs scopes 2018-02-14 18:13:23 +01:00
Paul Chavard
f80a9466b9 Delegate mandatory? to type_de_champ 2018-02-13 14:56:55 +01:00
Paul Chavard
2e4ada98e6 Add private columns to Champ and TypeDeChamp 2018-02-13 12:35:03 +01:00
Paul Chavard
52749713ab Remove ChampPublic/ChampPrivate STI 2018-02-13 12:07:13 +01:00