diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/info_request.rb | 17 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 5 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 10 | ||||
-rw-r--r-- | app/models/public_body.rb | 3 |
4 files changed, 26 insertions, 9 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 231f8dc91..2360a5b8b 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -23,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.150 2008-10-28 13:29:21 francis Exp $ +# $Id: info_request.rb,v 1.151 2008-11-05 18:19:46 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -55,6 +55,7 @@ class InfoRequest < ActiveRecord::Base 'rejected', 'successful', 'partially_successful', + 'internal_review', 'requires_admin' ] @@ -304,7 +305,8 @@ public :status => 'ready', :message_type => 'initial_request', :body => 'This is the holding pen request. It shows responses that were sent to invalid addresses, and need moving to the correct request by an adminstrator.', - :last_sent_at => Time.now() + :last_sent_at => Time.now(), + :what_doing => 'normal_sort' }) ir.outgoing_messages << om @@ -386,10 +388,11 @@ public event.save! end curr_state = nil - elsif !curr_state.nil? && event.event_type == 'followup_sent' && !event.described_state.nil? && event.described_state == 'waiting_response' - # followups can set the status to waiting response, which we don't - # want to propogate to the response itself, as that might already be - # set to waiting_clarification, which we want to know about. + elsif !curr_state.nil? && event.event_type == 'followup_sent' && !event.described_state.nil? && (event.described_state == 'waiting_response' || event.described_state == 'internal_review') + # followups can set the status to waiting response / internal + # review, which we don't want to propogate to the response + # itself, as that might already be set to waiting_clarification + # / a success status, which we want to know about. curr_state = nil end end @@ -630,6 +633,8 @@ public "Waiting clarification." elsif status == 'gone_postal' "Handled by post." + elsif status == 'internal review' + "Awaiting internal review." elsif status == 'requires_admin' "Unusual response." else diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 3a882e0c6..45fb1c48e 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.65 2008-10-28 13:04:20 francis Exp $ +# $Id: info_request_event.rb,v 1.66 2008-11-05 18:19:46 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -60,6 +60,7 @@ class InfoRequestEvent < ActiveRecord::Base 'rejected', 'successful', 'partially_successful', + 'internal_review', 'requires_admin' ] @@ -211,6 +212,8 @@ class InfoRequestEvent < ActiveRecord::Base "Some information sent" elsif status == 'successful' "All information sent" + elsif status == 'internal review' + "Internal review acknowledgement" elsif status == 'requires_admin' "Unusual response" else diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 4ca0d391d..8560f70bd 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: outgoing_message.rb,v 1.71 2008-10-28 13:04:20 francis Exp $ +# $Id: outgoing_message.rb,v 1.72 2008-11-05 18:19:46 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request @@ -32,6 +32,8 @@ class OutgoingMessage < ActiveRecord::Base belongs_to :incoming_message_followup, :foreign_key => 'incoming_message_followup_id', :class_name => 'IncomingMessage' + validates_inclusion_of :what_doing, :in => ['new_information', 'internal_review', 'normal_sort'] + # can have many events, for items which were resent by site admin e.g. if # contact address changed has_many :info_request_events @@ -117,6 +119,9 @@ class OutgoingMessage < ActiveRecord::Base if self.body =~ /#{get_signoff}\s*\Z/ms errors.add(:body, '^Please sign at the bottom with your name, or alter the "' + get_signoff + '" signature') end + if self.what_doing.nil? + errors.add(:what_doing_dummy, '^Please choose what sort of reply you are making.') + end end # Deliver outgoing message @@ -139,6 +144,9 @@ class OutgoingMessage < ActiveRecord::Base if self.info_request.described_state == 'waiting_clarification' self.info_request.set_described_state('waiting_response') end + if self.what_doing == 'internal_review' + self.info_request.set_described_state('internal_review') + end else raise "Message id #{self.id} has type '#{self.message_type}' which send_message can't handle" end diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 032af9820..e27496172 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -24,7 +24,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.120 2008-11-03 21:48:01 francis Exp $ +# $Id: public_body.rb,v 1.121 2008-11-05 18:19:46 francis Exp $ require 'csv' require 'set' @@ -350,6 +350,7 @@ class PublicBody < ActiveRecord::Base set_of_importing = Set.new() line = 0 + CSV::Reader.parse(csv) do |row| line = line + 1 |