Reworked file structure of concerns.

- can (new methods)
    - checks (events, pre/post function checks)
    - has (model related functions and events)
This commit is contained in:
Rolf Schmidt 2017-05-02 17:21:13 +02:00
parent 998a74b7f0
commit fa454abf3a
44 changed files with 194 additions and 199 deletions

View file

@ -1,23 +1,22 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class ApplicationModel < ActiveRecord::Base class ApplicationModel < ActiveRecord::Base
include ApplicationModel::ActivityStreamLoggable include ApplicationModel::CanActivityStreamLog
include ApplicationModel::Cacheable include ApplicationModel::HasCache
include ApplicationModel::CanLookup include ApplicationModel::CanLookup
include ApplicationModel::CanLookupSearchIndexAttributes include ApplicationModel::CanLookupSearchIndexAttributes
include ApplicationModel::ChecksAttributeLength include ApplicationModel::ChecksAttributeLength
include ApplicationModel::CleansParam include ApplicationModel::CanCleanupParam
include ApplicationModel::CleansRecentView include ApplicationModel::HasRecentViews
include ApplicationModel::FillsByUserColumns include ApplicationModel::ChecksUserColumnsFillup
include ApplicationModel::HandlesCreatesAndUpdates include ApplicationModel::CanCreatesAndUpdates
include ApplicationModel::HasAssets include ApplicationModel::CanAssets
include ApplicationModel::HasAssociations include ApplicationModel::CanAssociations
include ApplicationModel::HasAttachments include ApplicationModel::HasAttachments
include ApplicationModel::HasLatestChangeTimestamp include ApplicationModel::CanLatestChange
include ApplicationModel::HasExternalSync include ApplicationModel::HasExternalSync
include ApplicationModel::Importable include ApplicationModel::ChecksImport
include ApplicationModel::HistoryLoggable include ApplicationModel::CanTouchReferences
include ApplicationModel::TouchesReferences
self.abstract_class = true self.abstract_class = true
end end

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::ActivityStreamLoggable module ApplicationModel::CanActivityStreamLog
extend ActiveSupport::Concern extend ActiveSupport::Concern
=begin =begin

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HasAssets module ApplicationModel::CanAssets
extend ActiveSupport::Concern extend ActiveSupport::Concern
=begin =begin

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HasAssociations module ApplicationModel::CanAssociations
extend ActiveSupport::Concern extend ActiveSupport::Concern
=begin =begin

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::CleansParam module ApplicationModel::CanCleanupParam
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HandlesCreatesAndUpdates module ApplicationModel::CanCreatesAndUpdates
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HasLatestChangeTimestamp module ApplicationModel::CanLatestChange
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::TouchesReferences module ApplicationModel::CanTouchReferences
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::Importable module ApplicationModel::ChecksImport
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::FillsByUserColumns module ApplicationModel::ChecksUserColumnsFillup
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::Cacheable module ApplicationModel::HasCache
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::CleansRecentView module ApplicationModel::HasRecentViews
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,112 +0,0 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HistoryLoggable
extend ActiveSupport::Concern
=begin
create history entry for this object
organization = Organization.find(123)
result = organization.history_log('created', user_id)
returns
result = true # false
=end
def history_log(type, user_id, attributes = {})
attributes.merge!(
o_id: self['id'],
history_type: type,
history_object: self.class.name,
related_o_id: nil,
related_history_object: nil,
created_by_id: user_id,
updated_at: updated_at,
created_at: updated_at,
).merge!(history_log_attributes)
History.add(attributes)
end
# callback function to overwrite
# default history log attributes
# gets called from history_log
def history_log_attributes
{}
end
=begin
get history log for this object
organization = Organization.find(123)
result = organization.history_get()
returns
result = [
{
:type => 'created',
:object => 'Organization',
:created_by_id => 3,
:created_at => "2013-08-19 20:41:33",
},
{
:type => 'updated',
:object => 'Organization',
:attribute => 'note',
:o_id => 1,
:id_to => nil,
:id_from => nil,
:value_from => "some note",
:value_to => "some other note",
:created_by_id => 3,
:created_at => "2013-08-19 20:41:33",
},
]
to get history log for this object with all assets
organization = Organization.find(123)
result = organization.history_get(true)
returns
result = {
:history => [
{ ... },
{ ... },
],
:assets => {
...
}
}
=end
def history_get(fulldata = false)
if !fulldata
return History.list(self.class.name, self['id'])
end
# get related objects
history = History.list(self.class.name, self['id'], nil, true)
history[:list].each { |item|
record = Kernel.const_get(item['object']).find(item['o_id'])
history[:assets] = record.assets(history[:assets])
if item['related_object']
record = Kernel.const_get(item['related_object']).find(item['related_o_id'])
history[:assets] = record.assets(history[:assets])
end
}
{
history: history[:list],
assets: history[:assets],
}
end
end

View file

@ -1,8 +1,8 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Calendar < ApplicationModel class Calendar < ApplicationModel
include NotifiesClients include ChecksClientNotification
include UniqNamed include CanUniqName
store :business_hours store :business_hours
store :public_holidays store :public_holidays

View file

@ -1,5 +1,5 @@
class Chat::Message < ApplicationModel class Chat::Message < ApplicationModel
include HtmlSanitized include ChecksHtmlSanitized
sanitized_html :content sanitized_html :content
end end

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module Seedable module CanSeed
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module UniqNamed module CanUniqName
extend ActiveSupport::Concern extend ActiveSupport::Concern
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module NotifiesClients module ChecksClientNotification
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module ValidatesCondition module ChecksConditionValidation
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module HtmlSanitized module ChecksHtmlSanitized
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module LatestChangeObserved module ChecksLatestChangeObserved
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module LogsActivityStream module HasActivityStreamLog
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
@ -69,7 +69,7 @@ delete object activity stream, will be executed automatically
serve methode to ignore model attributes in activity stream and/or limit activity stream permission serve methode to ignore model attributes in activity stream and/or limit activity stream permission
class Model < ApplicationModel class Model < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
activity_stream_permission 'admin.user' activity_stream_permission 'admin.user'
activity_stream_attributes_ignored :create_article_type_id, :preferences activity_stream_attributes_ignored :create_article_type_id, :preferences
end end

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module Historisable module HasHistory
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
@ -120,6 +120,114 @@ delete object history, will be executed automatically
History.remove(self.class.to_s, id) History.remove(self.class.to_s, id)
end end
=begin
create history entry for this object
organization = Organization.find(123)
result = organization.history_log('created', user_id)
returns
result = true # false
=end
def history_log(type, user_id, attributes = {})
attributes.merge!(
o_id: self['id'],
history_type: type,
history_object: self.class.name,
related_o_id: nil,
related_history_object: nil,
created_by_id: user_id,
updated_at: updated_at,
created_at: updated_at,
).merge!(history_log_attributes)
History.add(attributes)
end
# callback function to overwrite
# default history log attributes
# gets called from history_log
def history_log_attributes
{}
end
=begin
get history log for this object
organization = Organization.find(123)
result = organization.history_get()
returns
result = [
{
:type => 'created',
:object => 'Organization',
:created_by_id => 3,
:created_at => "2013-08-19 20:41:33",
},
{
:type => 'updated',
:object => 'Organization',
:attribute => 'note',
:o_id => 1,
:id_to => nil,
:id_from => nil,
:value_from => "some note",
:value_to => "some other note",
:created_by_id => 3,
:created_at => "2013-08-19 20:41:33",
},
]
to get history log for this object with all assets
organization = Organization.find(123)
result = organization.history_get(true)
returns
result = {
:history => [
{ ... },
{ ... },
],
:assets => {
...
}
}
=end
def history_get(fulldata = false)
if !fulldata
return History.list(self.class.name, self['id'])
end
# get related objects
history = History.list(self.class.name, self['id'], nil, true)
history[:list].each { |item|
record = Kernel.const_get(item['object']).find(item['o_id'])
history[:assets] = record.assets(history[:assets])
if item['related_object']
record = Kernel.const_get(item['related_object']).find(item['related_o_id'])
history[:assets] = record.assets(history[:assets])
end
}
{
history: history[:list],
assets: history[:assets],
}
end
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it
class_methods do class_methods do
=begin =begin
@ -127,7 +235,7 @@ delete object history, will be executed automatically
serve methode to ignore model attributes in historization serve methode to ignore model attributes in historization
class Model < ApplicationModel class Model < ApplicationModel
include Historisable include HasHistory
history_attributes_ignored :create_article_type_id, :preferences history_attributes_ignored :create_article_type_id, :preferences
end end

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module SearchIndexed module HasSearchIndexBackend
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
@ -102,7 +102,7 @@ returns
serve methode to ignore model attributes in search index serve methode to ignore model attributes in search index
class Model < ApplicationModel class Model < ApplicationModel
include SearchIndexed include HasSearchIndexBackend
search_index_attributes_ignored :password, :image search_index_attributes_ignored :password, :image
end end

View file

@ -1,5 +1,5 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
module Taggable module HasTags
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class EmailAddress < ApplicationModel class EmailAddress < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
has_many :groups, after_add: :cache_update, after_remove: :cache_update has_many :groups, after_add: :cache_update, after_remove: :cache_update
belongs_to :channel belongs_to :channel

View file

@ -1,10 +1,10 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Group < ApplicationModel class Group < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
include Historisable include HasHistory
has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update
belongs_to :email_address belongs_to :email_address

View file

@ -1,8 +1,8 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Job < ApplicationModel class Job < ApplicationModel
include NotifiesClients include ChecksClientNotification
include ValidatesCondition include ChecksConditionValidation
load 'job/assets.rb' load 'job/assets.rb'
include Job::Assets include Job::Assets

View file

@ -1,8 +1,8 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Macro < ApplicationModel class Macro < ApplicationModel
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
store :perform store :perform
validates :name, presence: true validates :name, presence: true

View file

@ -1,5 +1,5 @@
class ObjectManager::Attribute < ApplicationModel class ObjectManager::Attribute < ApplicationModel
include NotifiesClients include ChecksClientNotification
self.table_name = 'object_manager_attributes' self.table_name = 'object_manager_attributes'

View file

@ -1,11 +1,11 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Organization < ApplicationModel class Organization < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
include Historisable include HasHistory
include SearchIndexed include HasSearchIndexBackend
load 'organization/permission.rb' load 'organization/permission.rb'
include Organization::Permission include Organization::Permission

View file

@ -1,10 +1,10 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Overview < ApplicationModel class Overview < ApplicationModel
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
include ValidatesCondition include ChecksConditionValidation
include Seedable include CanSeed
load 'overview/assets.rb' load 'overview/assets.rb'
include Overview::Assets include Overview::Assets

View file

@ -1,8 +1,8 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Permission < ApplicationModel class Permission < ApplicationModel
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
has_and_belongs_to_many :roles has_and_belongs_to_many :roles
validates :name, presence: true validates :name, presence: true

View file

@ -1,9 +1,9 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Role < ApplicationModel class Role < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update has_and_belongs_to_many :users, after_add: :cache_update, after_remove: :cache_update
has_and_belongs_to_many :permissions, after_add: :cache_update, after_remove: :cache_update, before_add: :validate_agent_limit has_and_belongs_to_many :permissions, after_add: :cache_update, after_remove: :cache_update, before_add: :validate_agent_limit

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Signature < ApplicationModel class Signature < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
has_many :groups, after_add: :cache_update, after_remove: :cache_update has_many :groups, after_add: :cache_update, after_remove: :cache_update
validates :name, presence: true validates :name, presence: true

View file

@ -1,8 +1,8 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Sla < ApplicationModel class Sla < ApplicationModel
include NotifiesClients include ChecksClientNotification
include ValidatesCondition include ChecksConditionValidation
load 'sla/assets.rb' load 'sla/assets.rb'
include Sla::Assets include Sla::Assets

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Template < ApplicationModel class Template < ApplicationModel
include NotifiesClients include ChecksClientNotification
store :options store :options
validates :name, presence: true validates :name, presence: true

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class TextModule < ApplicationModel class TextModule < ApplicationModel
include NotifiesClients include ChecksClientNotification
validates :name, presence: true validates :name, presence: true
validates :content, presence: true validates :content, presence: true

View file

@ -1,12 +1,12 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Ticket < ApplicationModel class Ticket < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include LatestChangeObserved include ChecksLatestChangeObserved
include Historisable include HasHistory
include Taggable include HasTags
include SearchIndexed include HasSearchIndexBackend
include Ticket::Escalation include Ticket::Escalation
include Ticket::Subject include Ticket::Subject

View file

@ -1,9 +1,9 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Article < ApplicationModel class Ticket::Article < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include Historisable include HasHistory
include HtmlSanitized include ChecksHtmlSanitized
load 'ticket/article/assets.rb' load 'ticket/article/assets.rb'
include Ticket::Article::Assets include Ticket::Article::Assets
@ -305,12 +305,12 @@ returns
end end
class Sender < ApplicationModel class Sender < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
validates :name, presence: true validates :name, presence: true
end end
class Type < ApplicationModel class Type < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
validates :name, presence: true validates :name, presence: true
end end
end end

View file

@ -1,6 +1,6 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Ticket::State < ApplicationModel class Ticket::State < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
after_create :ensure_defaults after_create :ensure_defaults
after_update :ensure_defaults after_update :ensure_defaults

View file

@ -1,6 +1,6 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Ticket::StateType < ApplicationModel class Ticket::StateType < ApplicationModel
include LatestChangeObserved include ChecksLatestChangeObserved
has_many :states, class_name: 'Ticket::State' has_many :states, class_name: 'Ticket::State'
validates :name, presence: true validates :name, presence: true

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
class Trigger < ApplicationModel class Trigger < ApplicationModel
include ValidatesCondition include ChecksConditionValidation
store :condition store :condition
store :perform store :perform

View file

@ -24,10 +24,10 @@ require 'digest/md5'
# @property active [Boolean] The flag that shows the active state of the User. # @property active [Boolean] The flag that shows the active state of the User.
# @property note [String] The note or comment stored to the User. # @property note [String] The note or comment stored to the User.
class User < ApplicationModel class User < ApplicationModel
include LogsActivityStream include HasActivityStreamLog
include NotifiesClients include ChecksClientNotification
include Historisable include HasHistory
include SearchIndexed include HasSearchIndexBackend
load 'user/permission.rb' load 'user/permission.rb'
include User::Permission include User::Permission