Commit bedac4e4d130911a45498e0dfa3508e33e64d4f2

Authored by Larissa Reis
1 parent 3526dd07

Prevents expired form from being submited in task page

plugins/custom_forms/lib/custom_forms_plugin/membership_survey.rb
... ... @@ -9,6 +9,8 @@ class CustomFormsPlugin::MembershipSurvey < Task
9 9  
10 10 def perform
11 11 form = CustomFormsPlugin::Form.find(form_id)
  12 + raise 'Form expired' if form.expired?
  13 +
12 14 answers = build_answers(submission, form)
13 15 s = CustomFormsPlugin::Submission.create!(:form => form, :profile => target)
14 16 answers.map {|answer| answer.submission = s; answer.save!}
... ...
plugins/custom_forms/views/tasks/custom_forms_plugin/_membership_survey_accept_details.html.erb
... ... @@ -3,8 +3,10 @@
3 3  
4 4 <h2><%= @form.name %></h2>
5 5 <p><%= @form.description %></p>
  6 +<% if @form.expired? %>
  7 + <h3><%= _('Sorry, you can\'t fill this form right now') %></h3>
  8 +<% end %>
6 9  
7 10 <% f.fields_for :submission do |fi| %>
8   - <%#= fi.error_messages_for :submission %>
9 11 <%= render :partial => 'shared/form_submission', :locals => {:f => fi} %>
10 12 <% end %>
... ...