fat_free_crm 0.15.0.beta → 0.15.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +517 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +145 -9
- data/Gemfile +11 -13
- data/Gemfile.lock +104 -92
- data/README.md +2 -9
- data/app/assets/javascripts/application.js.erb +1 -1
- data/app/assets/javascripts/crm_select2.js.coffee +0 -1
- data/app/controllers/application_controller.rb +6 -6
- data/app/controllers/comments_controller.rb +7 -5
- data/app/controllers/entities/contacts_controller.rb +4 -4
- data/app/controllers/entities/opportunities_controller.rb +3 -3
- data/app/controllers/entities_controller.rb +3 -2
- data/app/controllers/home_controller.rb +21 -14
- data/app/controllers/passwords_controller.rb +1 -1
- data/app/controllers/users_controller.rb +3 -3
- data/app/helpers/accounts_helper.rb +2 -2
- data/app/helpers/application_helper.rb +20 -19
- data/app/helpers/campaigns_helper.rb +1 -1
- data/app/helpers/opportunities_helper.rb +4 -3
- data/app/helpers/tasks_helper.rb +6 -4
- data/app/helpers/users_helper.rb +1 -1
- data/app/helpers/versions_helper.rb +1 -1
- data/app/inputs/date_pair_input.rb +1 -1
- data/app/inputs/date_time_input.rb +1 -1
- data/app/models/entities/contact.rb +1 -0
- data/app/models/entities/lead.rb +4 -9
- data/app/models/entities/opportunity.rb +3 -6
- data/app/models/fields/field.rb +2 -3
- data/app/models/polymorphic/address.rb +1 -1
- data/app/models/polymorphic/comment.rb +1 -1
- data/app/models/polymorphic/task.rb +2 -3
- data/app/models/polymorphic/version.rb +5 -5
- data/app/models/setting.rb +6 -7
- data/app/models/users/user.rb +2 -2
- data/app/views/shared/_tags.html.haml +1 -5
- data/config/environments/test.rb +1 -1
- data/config/initializers/assets.rb +1 -1
- data/config/initializers/paper_trail.rb +1 -1
- data/config/initializers/simple_form.rb +1 -1
- data/config/initializers/views.rb +0 -1
- data/config/locales/th.rb +4 -4
- data/config/unicorn.rb +2 -2
- data/db/migrate/20100928030620_remove_uuid.rb +2 -4
- data/db/migrate/20111201030535_add_field_groups_klass_name.rb +2 -1
- data/db/migrate/20120224073107_remove_default_value_and_clear_settings.rb +1 -1
- data/db/schema.rb +0 -2
- data/fat_free_crm.gemspec +5 -5
- data/lib/fat_free_crm.rb +1 -3
- data/lib/fat_free_crm/callback.rb +2 -1
- data/lib/fat_free_crm/core_ext/string.rb +2 -2
- data/lib/fat_free_crm/engine.rb +1 -1
- data/lib/fat_free_crm/fields.rb +1 -1
- data/lib/fat_free_crm/i18n.rb +1 -1
- data/lib/fat_free_crm/mail_processor/base.rb +8 -2
- data/lib/fat_free_crm/mail_processor/comment_replies.rb +2 -1
- data/lib/fat_free_crm/permissions.rb +1 -1
- data/lib/fat_free_crm/version.rb +1 -1
- data/lib/gravatar_image_tag.rb +2 -2
- data/lib/tasks/ffcrm/comment_replies.rake +2 -2
- data/lib/tasks/ffcrm/config.rake +7 -6
- data/lib/tasks/ffcrm/demo.rake +1 -1
- data/lib/tasks/ffcrm/dropbox.rake +2 -2
- data/lib/tasks/ffcrm/setup.rake +4 -2
- data/lib/tasks/ffcrm/update_data.rake +5 -7
- data/spec/controllers/entities/campaigns_controller_spec.rb +1 -1
- data/spec/controllers/entities/leads_controller_spec.rb +1 -1
- data/spec/controllers/home_controller_spec.rb +5 -5
- data/spec/controllers/tasks_controller_spec.rb +3 -2
- data/spec/factories/sequences.rb +1 -2
- data/spec/factories/shared_factories.rb +5 -5
- data/spec/factories/user_factories.rb +3 -3
- data/spec/models/entities/opportunity_spec.rb +1 -1
- data/spec/models/fields/custom_field_pair_spec.rb +2 -2
- data/spec/models/setting_spec.rb +1 -1
- data/spec/shared/controllers.rb +1 -1
- data/spec/support/auth_macros.rb +6 -5
- data/spec/support/macros.rb +1 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -3
- data/spec/views/campaigns/show.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +1 -1
- data/spec/views/tasks/index.haml_spec.rb +1 -1
- data/spec/views/tasks/update.js.haml_spec.rb +7 -7
- metadata +29 -4
@@ -23,7 +23,7 @@ module VersionsHelper
|
|
23
23
|
first = link_to(h(account.name), account_path(account))
|
24
24
|
end
|
25
25
|
if second.present? && (account = Account.find_by_id(second))
|
26
|
-
second
|
26
|
+
second = link_to(h(account.name), account_path(account))
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -17,7 +17,7 @@ class DatePairInput < SimpleForm::Inputs::Base
|
|
17
17
|
label = field == field1 ? I18n.t('pair.start') : I18n.t('pair.end')
|
18
18
|
[:required, :disabled].each { |k| input_html_options.delete(k) } # ensure these come from field not default options
|
19
19
|
input_html_options.merge!(field.input_options)
|
20
|
-
input_html_options
|
20
|
+
input_html_options[:value] = value(field)
|
21
21
|
out << "<label#{' class="req"' if input_html_options[:required]}>#{label}</label>".html_safe
|
22
22
|
text = @builder.text_field(field.name, merge_wrapper_options(input_html_options, wrapper_options))
|
23
23
|
out << text << '</div>'.html_safe
|
@@ -7,7 +7,7 @@ class DateTimeInput < SimpleForm::Inputs::DateTimeInput
|
|
7
7
|
def input(wrapper_options)
|
8
8
|
add_autocomplete!
|
9
9
|
input_html_options.merge(input_options)
|
10
|
-
input_html_options
|
10
|
+
input_html_options[:value] = value
|
11
11
|
@builder.text_field(attribute_name, merge_wrapper_options(input_html_options, wrapper_options))
|
12
12
|
end
|
13
13
|
|
data/app/models/entities/lead.rb
CHANGED
@@ -85,6 +85,7 @@ class Lead < ActiveRecord::Base
|
|
85
85
|
def self.per_page
|
86
86
|
20
|
87
87
|
end
|
88
|
+
|
88
89
|
def self.first_name_position
|
89
90
|
"before"
|
90
91
|
end
|
@@ -150,9 +151,7 @@ class Lead < ActiveRecord::Base
|
|
150
151
|
# Attach a task to the lead if it hasn't been attached already.
|
151
152
|
#----------------------------------------------------------------------------
|
152
153
|
def attach!(task)
|
153
|
-
unless task_ids.include?(task.id)
|
154
|
-
tasks << task
|
155
|
-
end
|
154
|
+
tasks << task unless task_ids.include?(task.id)
|
156
155
|
end
|
157
156
|
|
158
157
|
# Discard a task from the lead.
|
@@ -175,16 +174,12 @@ class Lead < ActiveRecord::Base
|
|
175
174
|
|
176
175
|
#----------------------------------------------------------------------------
|
177
176
|
def increment_leads_count
|
178
|
-
if campaign_id
|
179
|
-
Campaign.increment_counter(:leads_count, campaign_id)
|
180
|
-
end
|
177
|
+
Campaign.increment_counter(:leads_count, campaign_id) if campaign_id
|
181
178
|
end
|
182
179
|
|
183
180
|
#----------------------------------------------------------------------------
|
184
181
|
def decrement_leads_count
|
185
|
-
if campaign_id
|
186
|
-
Campaign.decrement_counter(:leads_count, campaign_id)
|
187
|
-
end
|
182
|
+
Campaign.decrement_counter(:leads_count, campaign_id) if campaign_id
|
188
183
|
end
|
189
184
|
|
190
185
|
# Make sure at least one user has been selected if the lead is being shared.
|
@@ -91,6 +91,7 @@ class Opportunity < ActiveRecord::Base
|
|
91
91
|
def self.per_page
|
92
92
|
20
|
93
93
|
end
|
94
|
+
|
94
95
|
def self.default_stage
|
95
96
|
Setting[:opportunity_default_stage].try(:to_s) || 'prospecting'
|
96
97
|
end
|
@@ -174,16 +175,12 @@ class Opportunity < ActiveRecord::Base
|
|
174
175
|
|
175
176
|
#----------------------------------------------------------------------------
|
176
177
|
def increment_opportunities_count
|
177
|
-
if campaign_id
|
178
|
-
Campaign.increment_counter(:opportunities_count, campaign_id)
|
179
|
-
end
|
178
|
+
Campaign.increment_counter(:opportunities_count, campaign_id) if campaign_id
|
180
179
|
end
|
181
180
|
|
182
181
|
#----------------------------------------------------------------------------
|
183
182
|
def decrement_opportunities_count
|
184
|
-
if campaign_id
|
185
|
-
Campaign.decrement_counter(:opportunities_count, campaign_id)
|
186
|
-
end
|
183
|
+
Campaign.decrement_counter(:opportunities_count, campaign_id) if campaign_id
|
187
184
|
end
|
188
185
|
|
189
186
|
ActiveSupport.run_load_hooks(:fat_free_crm_opportunity, self)
|
data/app/models/fields/field.rb
CHANGED
@@ -46,7 +46,7 @@ class Field < ActiveRecord::Base
|
|
46
46
|
'url' => { klass: 'CustomField', type: 'string' },
|
47
47
|
'tel' => { klass: 'CustomField', type: 'string' },
|
48
48
|
'select' => { klass: 'CustomField', type: 'string' },
|
49
|
-
'radio_buttons'
|
49
|
+
'radio_buttons' => { klass: 'CustomField', type: 'string' },
|
50
50
|
'check_boxes' => { klass: 'CustomField', type: 'text' },
|
51
51
|
'boolean' => { klass: 'CustomField', type: 'boolean' },
|
52
52
|
'date' => { klass: 'CustomField', type: 'date' },
|
@@ -63,7 +63,7 @@ class Field < ActiveRecord::Base
|
|
63
63
|
validates_inclusion_of :as, in: proc { field_types.keys }, message: "^Invalid field type.", allow_blank: true
|
64
64
|
|
65
65
|
def column_type(field_type = as)
|
66
|
-
(opts = Field.field_types[field_type]) ? opts[:type] :
|
66
|
+
(opts = Field.field_types[field_type]) ? opts[:type] : raise("Unknown field_type: #{field_type}")
|
67
67
|
end
|
68
68
|
|
69
69
|
def input_options
|
@@ -113,7 +113,6 @@ class Field < ActiveRecord::Base
|
|
113
113
|
# Example options: :as => 'datepair', :type => 'date', :klass => 'CustomFieldDatePair'
|
114
114
|
#------------------------------------------------------------------------------
|
115
115
|
def register(options)
|
116
|
-
opts = options.dup
|
117
116
|
as = options.delete(:as)
|
118
117
|
(@@field_types ||= BASE_FIELD_TYPES).merge!(as => options)
|
119
118
|
end
|
@@ -51,7 +51,7 @@ class Address < ActiveRecord::Base
|
|
51
51
|
def self.reject_address(attributes)
|
52
52
|
exists = attributes['id'].present?
|
53
53
|
empty = %w(street1 street2 city state zipcode country full_address).map { |name| attributes[name].blank? }.all?
|
54
|
-
attributes
|
54
|
+
attributes[:_destroy] = 1 if exists && empty
|
55
55
|
(!exists && empty)
|
56
56
|
end
|
57
57
|
|
@@ -23,7 +23,7 @@ class Comment < ActiveRecord::Base
|
|
23
23
|
belongs_to :user
|
24
24
|
belongs_to :commentable, polymorphic: true
|
25
25
|
|
26
|
-
scope :created_by,
|
26
|
+
scope :created_by, ->(user) { where(user_id: user.id) }
|
27
27
|
|
28
28
|
validates_presence_of :user, :commentable, :comment
|
29
29
|
has_paper_trail class_name: 'Version', meta: { related: :commentable },
|
@@ -166,6 +166,7 @@ class Task < ActiveRecord::Base
|
|
166
166
|
"due_later"
|
167
167
|
end
|
168
168
|
end
|
169
|
+
|
169
170
|
# Returns list of tasks grouping them by due date as required by tasks/index.
|
170
171
|
#----------------------------------------------------------------------------
|
171
172
|
def self.find_all_grouped(user, view)
|
@@ -194,7 +195,7 @@ class Task < ActiveRecord::Base
|
|
194
195
|
def self.totals(user, view = "pending")
|
195
196
|
return {} unless ALLOWED_VIEWS.include?(view)
|
196
197
|
settings = (view == "completed" ? Setting.task_completed : Setting.task_bucket)
|
197
|
-
settings.
|
198
|
+
settings.each_with_object(HashWithIndifferentAccess[all: 0]) do |key, hash|
|
198
199
|
hash[key] = (view == "assigned" ? assigned_by(user).send(key).pending.count : my(user).send(key).send(view).count)
|
199
200
|
hash[:all] += hash[key]
|
200
201
|
hash
|
@@ -220,8 +221,6 @@ class Task < ActiveRecord::Base
|
|
220
221
|
Time.zone.now.midnight + 100.years
|
221
222
|
when "specific_time"
|
222
223
|
calendar ? parse_calendar_date : nil
|
223
|
-
else # due_later or due_asap
|
224
|
-
nil
|
225
224
|
end
|
226
225
|
end
|
227
226
|
|
@@ -13,10 +13,10 @@ class Version < PaperTrail::Version
|
|
13
13
|
belongs_to :related, polymorphic: true
|
14
14
|
belongs_to :user, foreign_key: :whodunnit
|
15
15
|
|
16
|
-
scope :default_order,
|
17
|
-
scope :include_events,
|
18
|
-
scope :exclude_events,
|
19
|
-
scope :for,
|
16
|
+
scope :default_order, -> { order('created_at DESC') }
|
17
|
+
scope :include_events, ->(*events) { where(event: events) }
|
18
|
+
scope :exclude_events, ->(*events) { where('event NOT IN (?)', events) }
|
19
|
+
scope :for, ->(user) { where(whodunnit: user.id.to_s) }
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def recent_for_user(user, limit = 10)
|
@@ -32,7 +32,7 @@ class Version < PaperTrail::Version
|
|
32
32
|
.offset(offset)
|
33
33
|
.default_order
|
34
34
|
|
35
|
-
break if query.
|
35
|
+
break if query.empty?
|
36
36
|
versions += query.select { |v| v.item.present? }
|
37
37
|
versions.uniq! { |v| [v.item_id, v.item_type] }
|
38
38
|
offset += limit * 2
|
data/app/models/setting.rb
CHANGED
@@ -56,15 +56,11 @@ class Setting < ActiveRecord::Base
|
|
56
56
|
# Check database
|
57
57
|
if database_and_table_exists?
|
58
58
|
if setting = find_by_name(name.to_s)
|
59
|
-
unless setting.value.nil?
|
60
|
-
return cache[name] = setting.value
|
61
|
-
end
|
59
|
+
return cache[name] = setting.value unless setting.value.nil?
|
62
60
|
end
|
63
61
|
end
|
64
62
|
# Check YAML settings
|
65
|
-
if yaml_settings.key?(name)
|
66
|
-
return cache[name] = yaml_settings[name]
|
67
|
-
end
|
63
|
+
return cache[name] = yaml_settings[name] if yaml_settings.key?(name)
|
68
64
|
end
|
69
65
|
|
70
66
|
# Set setting value
|
@@ -89,7 +85,10 @@ class Setting < ActiveRecord::Base
|
|
89
85
|
# Returns false if table or database is unavailable.
|
90
86
|
# Catches all database-related errors, so that Setting will return nil
|
91
87
|
# instead of crashing the entire application.
|
92
|
-
|
88
|
+
|
89
|
+
table_exists?
|
90
|
+
rescue
|
91
|
+
false
|
93
92
|
end
|
94
93
|
|
95
94
|
# Loads settings from YAML files
|
data/app/models/users/user.rb
CHANGED
@@ -105,7 +105,7 @@ class User < ActiveRecord::Base
|
|
105
105
|
|
106
106
|
#----------------------------------------------------------------------------
|
107
107
|
def awaits_approval?
|
108
|
-
|
108
|
+
suspended? && login_count == 0 && Setting.user_signup == :needs_approval
|
109
109
|
end
|
110
110
|
|
111
111
|
#----------------------------------------------------------------------------
|
@@ -161,7 +161,7 @@ class User < ActiveRecord::Base
|
|
161
161
|
def has_related_assets?
|
162
162
|
sum = %w(Account Campaign Lead Contact Opportunity Comment Task).detect do |asset|
|
163
163
|
klass = asset.constantize
|
164
|
-
|
164
|
+
|
165
165
|
asset != "Comment" && klass.assigned_to(self).exists? || klass.created_by(self).exists?
|
166
166
|
end
|
167
167
|
!sum.nil?
|
@@ -3,8 +3,4 @@
|
|
3
3
|
%td{ :valign => :top, :colspan => span }
|
4
4
|
.label= t(:tags) + ":"
|
5
5
|
|
6
|
-
= f.
|
7
|
-
{:class => "select2_tag", :data => {:tags => Tag.all.map{|t| t.name},
|
8
|
-
:url => url_for(action: 'field_group'), :placeholder => t(:select_or_create_tags),
|
9
|
-
:multiple => true, :asset_id => f.object.try(:id),
|
10
|
-
}, value: f.object.tag_list.join(",")}
|
6
|
+
= f.select :tag_list, Tag.all.map{|t| t.name}, {}, {:class => "select2_tag", :data => {:tags => true, :url => url_for(action: 'field_group'), :placeholder => t(:select_or_create_tags), :multiple => true, :asset_id => f.object.try(:id)}, :multiple => true}
|
data/config/environments/test.rb
CHANGED
@@ -28,7 +28,7 @@ if defined?(FatFreeCRM::Application)
|
|
28
28
|
config.action_dispatch.show_exceptions = false
|
29
29
|
|
30
30
|
# Disable request forgery protection in test environment
|
31
|
-
config.action_controller.allow_forgery_protection
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
32
32
|
|
33
33
|
# Tell Action Mailer not to deliver emails to the real world.
|
34
34
|
# The :test delivery method accumulates sent emails in the
|
@@ -8,7 +8,7 @@ Rails.application.config.assets.version = '1.0'
|
|
8
8
|
|
9
9
|
# Precompile additional assets.
|
10
10
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
-
Rails.application.config.assets.precompile += %w(
|
11
|
+
Rails.application.config.assets.precompile += %w(print.css chosen-sprite.png jquery-ui/* jquery_ui_datepicker/*.js)
|
12
12
|
|
13
13
|
# Don't initialize Rails environment
|
14
14
|
Rails.application.config.assets.initialize_on_precompile = false
|
@@ -1 +1 @@
|
|
1
|
-
PaperTrail.config.track_associations = false
|
1
|
+
PaperTrail.config.track_associations = false
|
@@ -57,7 +57,7 @@ SimpleForm.setup do |config|
|
|
57
57
|
# config.collection_value_methods = [ :id, :to_s ]
|
58
58
|
|
59
59
|
# How the label text should be generated altogether with the required text.
|
60
|
-
config.label_text =
|
60
|
+
config.label_text = ->(label, _required, _explicit_label) { label.to_s }
|
61
61
|
|
62
62
|
# You can define the class to use on all labels. Default is nil.
|
63
63
|
# config.label_class = nil
|
@@ -43,5 +43,4 @@
|
|
43
43
|
controllers: ['campaigns'], actions: ['index'], template: 'campaigns/index_long' },
|
44
44
|
{ name: 'campaigns_show_normal', title: 'Normal format', icon: 'fa-list',
|
45
45
|
controllers: ['campaigns'], actions: ['show'], template: nil }, # default show view
|
46
|
-
|
47
46
|
].each { |view| FatFreeCRM::ViewFactory.new(view) }
|
data/config/locales/th.rb
CHANGED
@@ -41,9 +41,9 @@ end
|
|
41
41
|
|
42
42
|
date: {
|
43
43
|
formats: {
|
44
|
-
default:
|
44
|
+
default: ->(date, _opts) { "%d-%m-#{date.year + 543}" },
|
45
45
|
short: "%d %b",
|
46
|
-
long:
|
46
|
+
long: ->(date, _opts) { "%d %B #{date.year + 543}" }
|
47
47
|
},
|
48
48
|
|
49
49
|
day_names: %w(อาทิตย์ จันทร์ อังคาร พุธ พฤหัสบดี ศุกร์ เสาร์),
|
@@ -56,9 +56,9 @@ end
|
|
56
56
|
|
57
57
|
time: {
|
58
58
|
formats: {
|
59
|
-
default:
|
59
|
+
default: ->(date, _opts) { "%a %d %b #{date.year + 543} %H:%M:%S %z" },
|
60
60
|
short: "%d %b %H:%M น.",
|
61
|
-
long:
|
61
|
+
long: ->(date, _opts) { "%d %B #{date.year + 543} %H:%M น." }
|
62
62
|
},
|
63
63
|
am: "ก่อนเที่ยง",
|
64
64
|
pm: "หลังเที่ยง"
|
data/config/unicorn.rb
CHANGED
@@ -12,7 +12,7 @@ worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
|
|
12
12
|
timeout 15
|
13
13
|
preload_app true
|
14
14
|
|
15
|
-
before_fork do |
|
15
|
+
before_fork do |_server, _worker|
|
16
16
|
Signal.trap 'TERM' do
|
17
17
|
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
|
18
18
|
Process.kill 'QUIT', Process.pid
|
@@ -22,7 +22,7 @@ before_fork do |server, worker|
|
|
22
22
|
ActiveRecord::Base.connection.disconnect!
|
23
23
|
end
|
24
24
|
|
25
|
-
after_fork do |
|
25
|
+
after_fork do |_server, _worker|
|
26
26
|
Signal.trap 'TERM' do
|
27
27
|
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
|
28
28
|
end
|
@@ -4,14 +4,12 @@ class RemoveUuid < ActiveRecord::Migration
|
|
4
4
|
def self.up
|
5
5
|
[:users, :accounts, :campaigns, :leads, :contacts, :opportunities, :tasks].each do |table|
|
6
6
|
remove_column table, :uuid
|
7
|
-
if
|
8
|
-
execute("DROP TRIGGER IF EXISTS #{table}_uuid")
|
9
|
-
end
|
7
|
+
execute("DROP TRIGGER IF EXISTS #{table}_uuid") if uuid_configured?
|
10
8
|
end
|
11
9
|
end
|
12
10
|
|
13
11
|
def self.down
|
14
|
-
|
12
|
+
raise ActiveRecord::IrreversibleMigration, "Can't recover deleted UUIDs"
|
15
13
|
end
|
16
14
|
|
17
15
|
private
|
@@ -6,7 +6,8 @@ class AddFieldGroupsKlassName < ActiveRecord::Migration
|
|
6
6
|
%w(Account Campaign Contact Lead Opportunity).each do |entity|
|
7
7
|
klass = entity.classify.constantize
|
8
8
|
field_group = FieldGroup.new
|
9
|
-
field_group.label
|
9
|
+
field_group.label = 'Custom Fields'
|
10
|
+
field_group.klass_name = klass.name
|
10
11
|
field_group.save!
|
11
12
|
Field.where(field_group_id: nil, klass_name: klass.name).update_all(field_group_id: field_group.id)
|
12
13
|
end
|
@@ -3,7 +3,7 @@ class RemoveDefaultValueAndClearSettings < ActiveRecord::Migration
|
|
3
3
|
remove_column :settings, :default_value
|
4
4
|
|
5
5
|
# Truncate settings table
|
6
|
-
if connection.adapter_name.
|
6
|
+
if connection.adapter_name.casecmp("sqlite").zero?
|
7
7
|
execute("DELETE FROM settings")
|
8
8
|
else # mysql and postgres
|
9
9
|
execute("TRUNCATE settings")
|
data/db/schema.rb
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20160511053730) do
|
15
|
-
|
16
15
|
# These are extensions that must be enabled in order to support this database
|
17
16
|
enable_extension "plpgsql"
|
18
17
|
|
@@ -455,5 +454,4 @@ ActiveRecord::Schema.define(version: 20160511053730) do
|
|
455
454
|
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
|
456
455
|
add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id", using: :btree
|
457
456
|
add_index "versions", ["whodunnit"], name: "index_versions_on_whodunnit", using: :btree
|
458
|
-
|
459
457
|
end
|
data/fat_free_crm.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.required_ruby_version = '>= 2.0.0'
|
21
21
|
gem.license = 'MIT'
|
22
22
|
|
23
|
-
gem.add_dependency 'rails', '~> 4.2
|
23
|
+
gem.add_dependency 'rails', '~> 4.2'
|
24
24
|
gem.add_dependency 'rails-observers'
|
25
25
|
# Sprockets 2.2.3 appears to have a bug resolving assets from the engine update to '>= 3.0.0 once released'
|
26
26
|
gem.add_dependency 'sprockets-rails', '2.2.2'
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |gem|
|
|
35
35
|
# Manually added paperclip gem dependency "cocaine" in order to fix load error: "no such file to load -- cocaine"
|
36
36
|
gem.add_dependency 'cocaine'
|
37
37
|
gem.add_dependency 'paper_trail', '~> 6.0.0'
|
38
|
-
gem.add_dependency 'authlogic', '>= 3.4.4'
|
38
|
+
gem.add_dependency 'authlogic', '>= 3.4.4', '< 3.5.0' # View tests fail on authlogic 3.5.0+
|
39
39
|
gem.add_dependency 'acts_as_commentable'
|
40
40
|
gem.add_dependency 'acts-as-taggable-on', '>= 3.4.3'
|
41
41
|
gem.add_dependency 'dynamic_form'
|
@@ -52,12 +52,12 @@ Gem::Specification.new do |gem|
|
|
52
52
|
gem.add_dependency 'psych', '~> 1' if RUBY_VERSION.to_f < 2.0
|
53
53
|
gem.add_dependency 'thor'
|
54
54
|
gem.add_dependency 'rails_autolink'
|
55
|
-
gem.add_dependency 'coffee-script-source', '~>1.8.0' # pegged until https://github.com/jashkenas/coffeescript/issues/3829 is resolved
|
55
|
+
gem.add_dependency 'coffee-script-source', '~> 1.8', '>= 1.8.0' # pegged until https://github.com/jashkenas/coffeescript/issues/3829 is resolved
|
56
56
|
gem.add_dependency 'country_select'
|
57
57
|
|
58
58
|
# FatFreeCRM has released it's own versions of the following gems:
|
59
59
|
#-----------------------------------------------------------------
|
60
|
-
gem.add_dependency 'ransack_ui', '>= 1.3.1'
|
61
|
-
gem.add_dependency 'ransack', '~> 1.6.2'
|
60
|
+
gem.add_dependency 'ransack_ui', '~> 1.3', '>= 1.3.1'
|
61
|
+
gem.add_dependency 'ransack', '~> 1.6', '>= 1.6.2'
|
62
62
|
gem.add_dependency 'email_reply_parser_ffcrm'
|
63
63
|
end
|
data/lib/fat_free_crm.rb
CHANGED
@@ -26,9 +26,7 @@ module FatFreeCRM
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# Load Fat Free CRM as a Rails Engine, unless running as a Rails Application
|
29
|
-
unless defined?(FatFreeCRM::Application)
|
30
|
-
require 'fat_free_crm/engine'
|
31
|
-
end
|
29
|
+
require 'fat_free_crm/engine' unless defined?(FatFreeCRM::Application)
|
32
30
|
|
33
31
|
require 'fat_free_crm/load_settings' # register load hook for Setting
|
34
32
|
|