Revert "Merge pull request #6142 from tchak/enable_brouillon_extend_conservation"
This reverts commit48eb4d9778
, reversing changes made to5539d5cb8c
. # Conflicts: # app/models/dossier.rb # db/schema.rb
This commit is contained in:
parent
4cba6e3b11
commit
bcbfcdc537
8 changed files with 15 additions and 64 deletions
|
@ -161,7 +161,7 @@ module Users
|
|||
end
|
||||
|
||||
def extend_conservation
|
||||
dossier.update(conservation_extension: dossier.conservation_extension + 1.month)
|
||||
dossier.update(en_construction_conservation_extension: dossier.en_construction_conservation_extension + 1.month)
|
||||
flash[:notice] = 'Votre dossier sera conservé un mois supplémentaire'
|
||||
redirect_to dossier_path(@dossier)
|
||||
end
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
# archived :boolean default(FALSE)
|
||||
# autorisation_donnees :boolean
|
||||
# brouillon_close_to_expiration_notice_sent_at :datetime
|
||||
# conservation_extension :interval default(0 seconds)
|
||||
# deleted_user_email_never_send :string
|
||||
# en_construction_at :datetime
|
||||
# en_construction_close_to_expiration_notice_sent_at :datetime
|
||||
|
@ -256,22 +255,21 @@ class Dossier < ApplicationRecord
|
|||
scope :brouillon_close_to_expiration, -> do
|
||||
state_brouillon
|
||||
.joins(:procedure)
|
||||
.where("dossiers.created_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
.where("dossiers.created_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :en_construction_close_to_expiration, -> do
|
||||
state_en_construction
|
||||
.joins(:procedure)
|
||||
.where("dossiers.en_construction_at + dossiers.conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
.where("dossiers.en_construction_at + dossiers.en_construction_conservation_extension + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :en_instruction_close_to_expiration, -> do
|
||||
state_en_instruction
|
||||
.joins(:procedure)
|
||||
.where("dossiers.en_instruction_at + (duree_conservation_dossiers_dans_ds * INTERVAL '1 month') - INTERVAL :expires_in < :now", { now: Time.zone.now, expires_in: INTERVAL_BEFORE_EXPIRATION })
|
||||
end
|
||||
scope :termine_close_to_expiration, -> do
|
||||
state_termine
|
||||
.joins(:procedure)
|
||||
.where(id: Traitement.termine_close_to_expiration.pluck(:dossier_id).uniq)
|
||||
def self.termine_close_to_expiration
|
||||
dossier_ids = Traitement.termine_close_to_expiration.pluck(:dossier_id).uniq
|
||||
Dossier.where(id: dossier_ids)
|
||||
end
|
||||
|
||||
scope :brouillon_expired, -> do
|
||||
|
@ -455,15 +453,7 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def en_construction_close_to_expiration?
|
||||
self.class.en_construction_close_to_expiration.exists?(id: self)
|
||||
end
|
||||
|
||||
def brouillon_close_to_expiration?
|
||||
self.class.brouillon_close_to_expiration.exists?(id: self)
|
||||
end
|
||||
|
||||
def close_to_expiration?
|
||||
en_construction_close_to_expiration? || brouillon_close_to_expiration?
|
||||
Dossier.en_construction_close_to_expiration.where(id: self).present?
|
||||
end
|
||||
|
||||
def show_groupe_instructeur_details?
|
||||
|
@ -646,7 +636,6 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def after_passer_en_construction
|
||||
update!(conservation_extension: 0.days)
|
||||
update!(en_construction_at: Time.zone.now) if self.en_construction_at.nil?
|
||||
end
|
||||
|
||||
|
@ -663,7 +652,6 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
|
||||
def after_repasser_en_construction(instructeur)
|
||||
update!(conservation_extension: 0.days)
|
||||
log_dossier_operation(instructeur, :repasser_en_construction)
|
||||
end
|
||||
|
||||
|
|
|
@ -22,19 +22,13 @@
|
|||
%li
|
||||
= link_to "Tout le dossier", dossier_path(dossier, format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||
|
||||
- if dossier.close_to_expiration?
|
||||
- if dossier.en_construction_close_to_expiration?
|
||||
.card.warning
|
||||
.card-title Votre dossier va expirer
|
||||
- if dossier.brouillon?
|
||||
%p
|
||||
Votre dossier est en brouillon, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été déposé.
|
||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
- else
|
||||
%p
|
||||
Votre dossier a été déposé, mais va bientôt expirer. Cela signifie qu’il va bientôt être supprimé sans avoir été traité par l’administration.
|
||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
%p
|
||||
Votre dossier a été déposé, mais va bientôt expirer. Cela signifie qu'il va bientôt être supprimé sans avoir été traité par l’administration.
|
||||
Si vous souhaitez le conserver afin de poursuivre la démarche, vous pouvez le conserver
|
||||
un mois de plus en cliquant sur le bouton ci-dessous.
|
||||
%br
|
||||
= button_to 'Repousser sa suppression', users_dossier_repousser_expiration_path(dossier), class: 'button secondary'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue