git-svn-id: https://192.168.0.254/svn/Rodax.redmine_rodax_crm/trunk@4 ff88604e-da85-c949-a72f-fc3aa3ba3724
25 lines
1.1 KiB
Ruby
25 lines
1.1 KiB
Ruby
module RedmineContacts
|
|
module Patches
|
|
module ProjectPatch
|
|
def self.included(base) # :nodoc:
|
|
base.class_eval do
|
|
unloadable # Send unloadable so it will not be unloaded in development
|
|
has_and_belongs_to_many :contacts, :order => "last_name, first_name", :uniq => true
|
|
has_many :deals, :dependent => :delete_all
|
|
has_many :contracts, :dependent => :delete_all
|
|
has_many :deal_categories, :dependent => :delete_all, :order => "#{DealCategory.table_name}.name"
|
|
has_many :contract_categories, :dependent => :delete_all, :order => "#{ContractCategory.table_name}.name"
|
|
has_and_belongs_to_many :deal_statuses, :order => "#{DealStatus.table_name}.position", :uniq => true
|
|
has_and_belongs_to_many :contract_statuses, :order => "#{ContractStatus.table_name}.position", :uniq => true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Dispatcher.to_prepare do
|
|
|
|
unless Project.included_modules.include?(RedmineContacts::Patches::ProjectPatch)
|
|
Project.send(:include, RedmineContacts::Patches::ProjectPatch)
|
|
end
|
|
end |