aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/public_body.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/public_body.rb')
-rw-r--r--app/models/public_body.rb57
1 files changed, 33 insertions, 24 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 77da81d4c..34bcd332c 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,32 +1,27 @@
-# -*- coding: utf-8 -*-
# == Schema Information
+# Schema version: 20120919140404
#
# Table name: public_bodies
#
-# id :integer not null, primary key
-# name :text not null
-# short_name :text not null
-# request_email :text not null
-# version :integer not null
-# last_edit_editor :string(255) not null
-# last_edit_comment :text not null
-# created_at :datetime not null
-# updated_at :datetime not null
-# url_name :text not null
-# home_page :text default(""), not null
-# notes :text default(""), not null
-# first_letter :string(255) not null
-# publication_scheme :text default(""), not null
-# api_key :string(255) not null
-#
-# models/public_body.rb:
-# A public body, from which information can be requested.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# id :integer not null, primary key
+# name :text not null
+# short_name :text not null
+# request_email :text not null
+# version :integer not null
+# last_edit_editor :string(255) not null
+# last_edit_comment :text not null
+# created_at :datetime not null
+# updated_at :datetime not null
+# url_name :text not null
+# home_page :text default(""), not null
+# notes :text default(""), not null
+# first_letter :string(255) not null
+# publication_scheme :text default(""), not null
+# api_key :string(255)
+# info_requests_count :integer default(0), not null
#
-# $Id: public_body.rb,v 1.160 2009-10-02 22:56:35 francis Exp $
+# -*- coding: utf-8 -*-
require 'csv'
require 'securerandom'
require 'set'
@@ -341,7 +336,7 @@ class PublicBody < ActiveRecord::Base
pb = PublicBody.new(
:name => 'Internal admin authority',
:short_name => "",
- :request_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost'),
+ :request_email => Configuration::contact_email,
:home_page => "",
:notes => "",
:publication_scheme => "",
@@ -514,6 +509,20 @@ class PublicBody < ActiveRecord::Base
return self.request_email_domain
end
+ # Returns nil if configuration variable not set
+ def override_request_email
+ e = Configuration::override_all_public_body_request_emails
+ e if e != ""
+ end
+
+ def request_email
+ if override_request_email
+ override_request_email
+ else
+ read_attribute(:request_email)
+ end
+ end
+
# Domain name of the request email
def request_email_domain
return PublicBody.extract_domain_from_email(self.request_email)