Commit graph

1625 commits

Author SHA1 Message Date
Christophe Robillard
9a62d3fe0c delete a user 2020-01-13 10:06:43 +01:00
Paul Chavard
785a09b326 Use service_url instead of blob_url on secure attachments 2020-01-08 14:43:05 +01:00
Pierre de La Morinerie
b3558c497d dossiers: make build_default_individual explicit
It avoid the use of callbacks, and may avoid situations where an empty
individual is implicitely created.
2020-01-08 10:48:22 +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
Pierre de La Morinerie
e32a42cfe6 dossiers: split the dossier creation on several lines 2020-01-08 10:48:22 +01:00
Pierre de La Morinerie
5b2311c851 dossiers: rescue RecordNotFound only for procedures
This ensures that we won't rescue an `ActiveRecord::RecordNotFound`
exception related to another object.
2020-01-08 10:48:21 +01:00
Paul Chavard
e61e39d345 Remove unused code and tests 2020-01-07 11:52:51 +01:00
Paul Chavard
ff46ee366e Fix user brouillon spec 2020-01-07 11:52:51 +01:00
Paul Chavard
22aa2d4ee0 Make all location champs autocomplete 2020-01-07 11:52:51 +01:00
Paul Chavard
fa2eea81aa Cleanup demarche archivee state 2020-01-07 11:13:42 +01:00
Pierre de La Morinerie
8eb295d67e dossiers: avoid exceptions on invalid AASM transitions
When attempting an invalid transition on a dossier, provide a meaningful
error message (instead of letting an `AASM::InvalidTransition` exception
propagate).

This handles not only the case where the same state is applied twice
(which was already handled manually), but all cases where the transition
is invalid.
2019-12-19 13:25:32 +01:00
simon lehericey
60538c9c28 Controller use new export model 2019-12-18 13:13:15 +01:00
simon lehericey
745086cbb5 Simplify view 2019-12-18 13:13:15 +01:00
simon lehericey
d0f0533a32 Remove unused code 2019-12-18 13:13:15 +01:00
simon lehericey
f069f6f779 Make the new instructeur receive the affectation mail 2019-12-16 18:20:00 +01:00
simon lehericey
058442c84e [link to #4557] An instructeur cannot change its email on its own 2019-12-11 17:18:21 +01:00
simon lehericey
21910c959e @current_user -> current_user 2019-12-11 17:18:21 +01:00
Paul Chavard
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +01:00
Paul Chavard
e429c79eb1 Allow administrators to set themselves démarches as déclaratives 2019-12-04 12:30:26 +01:00
Pierre de La Morinerie
3212dfddca app: allow hiding the browser banner for one week 2019-12-03 16:09:18 +01:00
simon lehericey
4175aa0b28 GroupeInstructeur: do not use outdated email column 2019-12-02 14:52:01 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Paul Chavard
c1c8ab7ac6 Disable transition from publiée to brouillon 2019-11-28 14:17:47 +01:00
simon lehericey
6657459f9c Fix add instructeur with empty mail
As select2 does not handle required attribute, we can only add server side logic
2019-11-27 14:39:16 +01:00
Pierre de La Morinerie
f58f9f9950 dossiers: render a valid response after an autosave
This helps Firefox DevTools to mark the request as valid and completed
successfuly.
2019-11-27 10:37:33 +00:00
maatinito
9de9a1fd71 Use time.zone functions instead of server time functions
(Time.zone.today vs Date.today)
2019-11-26 14:26:36 +01:00
Pierre de La Morinerie
68f5aae99d autosave: add feature test 2019-11-21 14:00:06 +01:00
Paul Chavard
0c6705f7fd Drop old export service 2019-11-21 10:25:40 +01:00
clemkeirua
be7fde1103 fix UnknownFormat raised in Instructeurs::ProceduresController#download_export 2019-11-21 09:52:38 +01:00
Christophe Robillard
b42f21264e permet le suivi auto après envoi instructeur
Close #4163
2019-11-20 16:41:30 +01:00
Pierre de La Morinerie
5f9a9d059e dossiers: render JSON if needed
When receiving a request that expects JSON, return a simple '200'.

This avoids the unecessary work of rendering all the HTML page (which
ultimately will not be used).
2019-11-20 11:30:27 +01:00
Pierre de La Morinerie
8b8a96abda dossiers: save draft by default (instead of submitting)
Make the default behavior of `update_brouillon` be to update the draft,
instead of submitting the dossier.

This makes all requests made to `update_brouillon` without specifying
an extra `submit_draft` parameter to just save the draft. It will make
autosaving the draft easier and safer.
2019-11-20 11:24:31 +01:00
simon lehericey
dae7a3bfd0 [fix #4529] Log user email in manager space 2019-11-19 12:15:03 +01:00
simon lehericey
9ca026a630 Use a select2 box for looking to instructeurs 2019-11-18 17:08:51 +01:00
Paul Chavard
556ec351f3 Drop email on instructeurs 2019-11-13 15:38:44 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
f5c80f211d Guard for missing attestation on dossier 2019-11-06 12:54:07 +01:00
Paul Chavard
95f98fe605 API v1 correctly handle resultats_par_page 2019-11-06 12:54:07 +01:00
Pierre de La Morinerie
8df91df9fa assigns: strip and lowercase the search filter 2019-11-06 12:16:30 +01:00
Pierre de La Morinerie
0eeac59ecd assigns: fix search among the unassigned instructeurs
This was broken since moving the email out of the Instructeur column.
2019-11-06 12:16:30 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
Pierre de La Morinerie
c37bfc7349 instructeurs: fix email casing in invitation
When inviting an instructeur, the code first looked up an existing
instructeur using the normalized (downcased) email address–but then
tried to promote it using the non-normalized version, which failed.

This fixes the issue by always using the normalized email.
2019-11-05 10:54:58 +01:00
Pierre de La Morinerie
f63cd86811 webhook: fix a crash when the Helpscout customer is unknown 2019-11-04 18:36:52 +01:00
Pierre de La Morinerie
f131dbb80d instructeurs: make the create form not using email directly
Before the form attempted to read an email value from the Instructeur
model, and failed (because the empty Instructeur had no user yet).

We could let `Instructeur#email` return `nil` if there is no User –
but as a created Instructeur is always supposed to have a User, this
seems like a nice safeguard to keep.

So instead this commit rewrites the create form, which now doesn’t
depend on an Instructeur model. Seems easy enough for now.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
d78d206544 instructeurs: fix expert creation not to use Instructeur.email
It kind of worked until now, because the email field is disabled, and
thus never accessed.

But better make it clean, by accessing an object (User) where the email
field actually exists.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
a462edb9bc instructeurs: alias instructeur.email
This also means we need to replace instances of `pluck` on the email
column.
2019-11-04 10:44:24 +01:00
Pierre de La Morinerie
cd478b489e instructeurs: replace calls to Instructeur.find_by(email: …) 2019-11-04 10:44:23 +01:00
Pierre de La Morinerie
627d30191f manager: allow hidden procedures to be searched
The Manager::DossiersController already allow hidden dossiers to be
searched and displayed. Give the same behavior to Procedures.
2019-10-31 17:03:02 +01:00
Nicolas Bouilleaud
72b7ff221c move procedure to new design 2019-10-31 10:27:19 +01:00
simon lehericey
477f7c9837 Remove instructeur 2019-10-30 14:27:51 +01:00