Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETQ usager, je peux créer de nouveaux dossiers sur la démarche qui remplace la démarche fermée #8943

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/procedure.rb
Expand Up @@ -453,6 +453,10 @@ def accepts_new_dossiers?
publiee? || brouillon?
end

def replaced_by_procedure?
replaced_by_procedure_id.present?
end

def dossier_can_transition_to_en_construction?
accepts_new_dossiers? || depubliee?
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/dossiers/_dossier_actions.html.haml
@@ -1,6 +1,6 @@
- has_edit_action = !dossier.read_only?
- has_delete_action = dossier.can_be_deleted_by_user?
- has_new_dossier_action = dossier.procedure.accepts_new_dossiers?
- has_new_dossier_action = dossier.procedure.accepts_new_dossiers? || dossier.procedure.replaced_by_procedure?
- has_transfer_action = dossier.user == current_user
- has_actions = has_edit_action || has_delete_action || has_new_dossier_action || has_transfer_action

Expand Down
5 changes: 5 additions & 0 deletions spec/views/users/dossiers/_dossier_actions.html.haml_spec.rb
Expand Up @@ -18,4 +18,9 @@
let(:procedure) { create(:procedure, :closed) }
it { is_expected.not_to have_link('Commencer un autre dossier') }
end

context 'when the procedure is closed and replaced' do
let(:procedure) { create(:procedure, :closed, replaced_by_procedure: create(:procedure)) }
it { is_expected.to have_link('Commencer un autre dossier') }
end
end