Updated header.

This commit is contained in:
Martin Edenhofer 2014-02-03 20:23:00 +01:00
parent cfb2f857fc
commit d18ef99f78
94 changed files with 314 additions and 314 deletions

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationHelper
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module PostsHelper
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class ActivityStream < ApplicationModel
self.table_name = 'activity_streams'
@ -45,10 +45,10 @@ add a new activity entry for an object
# check if entry is needed
result = ActivityStream.where(
:o_id => data[:o_id],
# :activity_stream_type_id => type.id,
# :activity_stream_type_id => type.id,
:role_id => role_id,
:activity_stream_object_id => object.id,
:created_by_id => data[:created_by_id]
:created_by_id => data[:created_by_id]
).last
# resturn if old entry is really freash

View file

@ -1,4 +1,4 @@
# Copyright (C) 2013-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class ApplicationModel < ActiveRecord::Base
include ApplicationModel::Assets

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::ActivityStreamBase
@ -35,4 +35,4 @@ returns
)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::Assets

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::HistoryLogBase
@ -97,4 +97,4 @@ returns
}
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module ApplicationModel::SearchIndexBase
@ -138,4 +138,4 @@ returns
attributes_new.merge(attributes)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Authorization < ApplicationModel
belongs_to :user

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Channel < ApplicationModel
store :options

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'mail'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
# encoding: utf-8

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
#require 'rubygems'
#require 'twitter'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
# process all database filter
module Channel::Filter::Database

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
# delete all X-Zammad header if channel is not trusted
module Channel::Filter::Trusted

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'net/imap'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Channel::MailStdin < Channel::EmailParser
def initialize

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'net/pop'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Channel::Sendmail < Channel::EmailBuild
def send(attr, channel, notification = false)

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Channel::SMTP < Channel::EmailBuild
def send(attr, channel, notification = false)

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'twitter'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class EmailAddress < ApplicationModel
has_many :groups, :after_add => :cache_update, :after_remove => :cache_update

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Group < ApplicationModel
has_and_belongs_to_many :users, :after_add => :cache_update, :after_remove => :cache_update

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class History < ApplicationModel
include History::Assets
@ -313,7 +313,7 @@ returns
=begin
nothing to do on destroying history entries
nothing to do on destroying history entries
=end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module History::Assets
@ -32,4 +32,4 @@ returns
data
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Link < ApplicationModel
belongs_to :link_type, :class_name => 'Link::Type'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Network < ApplicationModel
# belongs_to :group

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Notification < ActiveRecord::Base
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'history'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'history'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
observe 'ticket::_article'
@ -79,4 +79,4 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
end
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::ArticleCounter < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::ArticleSenderType < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::CloseTime < ActiveRecord::Observer
observe 'ticket'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::EscalationCalculation < ActiveRecord::Observer
observe 'ticket', 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::FirstResponse < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::LastContact < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'event_buffer'
require 'notification_factory'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::ResetNewState < ActiveRecord::Observer
observe 'ticket::_article'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::Ticket::UserTicketCounter < ActiveRecord::Observer
observe 'ticket'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Observer::User::Geo < ActiveRecord::Observer
observe 'user'
@ -18,7 +18,7 @@ class Observer::User::Geo < ActiveRecord::Observer
# check if geo update is needed based on old/new location
if record.id
current = User.where( :id => record.id ).first
return if !current
return if !current
current_location = {}
location.each { |item|
@ -61,4 +61,4 @@ class Observer::User::Geo < ActiveRecord::Observer
record.preferences['lat'] = latlng[0]
record.preferences['lng'] = latlng[1]
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Organization < ApplicationModel
include Organization::Assets
@ -13,4 +13,4 @@ class Organization < ApplicationModel
history_support
search_index_support
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Organization::Assets
@ -40,4 +40,4 @@ returns
data
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Organization::Search
@ -71,4 +71,4 @@ returns
end
organizations
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Organization::SearchIndex
@ -57,4 +57,4 @@ returns
attributes_new.merge(attributes)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Overview < ApplicationModel
store :condition

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'rexml/document'
class Package < ApplicationModel

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class PostmasterFilter < ApplicationModel
store :perform

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class RecentView < ApplicationModel
belongs_to :recent_view_object, :class_name => 'RecentView::Object'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Role < ApplicationModel

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Scheduler < ApplicationModel
@ -62,27 +62,27 @@ class Scheduler < ApplicationModel
end
def self.worker
wait = 10
puts "*** Starting worker #{Delayed::Job.to_s}"
wait = 10
puts "*** Starting worker #{Delayed::Job.to_s}"
loop do
result = nil
loop do
result = nil
realtime = Benchmark.realtime do
result = Delayed::Worker.new.work_off
end
count = result.sum
break if $exit
if count.zero?
sleep(wait)
puts "*** worker loop"
else
printf "*** #{count} jobs processed at %.4f j/s, %d failed ...\n" % [count / realtime, result.last]
end
realtime = Benchmark.realtime do
result = Delayed::Worker.new.work_off
end
count = result.sum
break if $exit
if count.zero?
sleep(wait)
puts "*** worker loop"
else
printf "*** #{count} jobs processed at %.4f j/s, %d failed ...\n" % [count / realtime, result.last]
end
end
end
def self.check( name, time_warning = 10, time_critical = 20 )
@ -93,7 +93,7 @@ class Scheduler < ApplicationModel
puts "CRITICAL - no such scheduler jobs '#{name}'"
return true
end
#puts "S " + scheduler.inspect
#puts "S " + scheduler.inspect
if !scheduler.last_run
puts "CRITICAL - scheduler jobs never started '#{name}'"
exit 2

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Setting < ApplicationModel
store :options

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Signature < ApplicationModel
has_many :groups, :after_add => :cache_update, :after_remove => :cache_update

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Sla < ApplicationModel
store :condition

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'digest/md5'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Tag < ApplicationModel
belongs_to :tag_object, :class_name => 'Tag::Object'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Taskbar < ApplicationModel
store :state

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Template < ApplicationModel
store :options

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class TextModule < ApplicationModel
validates :name, :presence => true

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket < ApplicationModel
include Ticket::Escalation

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::ActivityStreamLog
@ -29,4 +29,4 @@ returns
)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Article < ApplicationModel
require 'ticket/article/assets'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Article::ActivityStreamLog
@ -30,4 +30,4 @@ returns
)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Article::Assets
@ -53,4 +53,4 @@ returns
data
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, httpdata[://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Article::HistoryLog
@ -28,4 +28,4 @@ returns
History.add(data)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Assets
@ -48,4 +48,4 @@ returns
data
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Counter < ApplicationModel
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Escalation
@ -163,7 +163,7 @@ returns
=end
def escalation_calculation_get_sla
def escalation_calculation_get_sla
sla_selected = nil
sla_list = Cache.get( 'SLA::List::Active' )
if sla_list == nil
@ -201,115 +201,115 @@ def escalation_calculation_get_sla
private
#type could be:
# real - time without supsend state
# relative - only suspend time
#type could be:
# real - time without supsend state
# relative - only suspend time
def escalation_suspend (start_time, end_time, type, sla_selected, sla_time = 0)
if type == 'relative'
end_time += sla_time * 60
def escalation_suspend (start_time, end_time, type, sla_selected, sla_time = 0)
if type == 'relative'
end_time += sla_time * 60
end
total_time_without_pending = 0
total_time = 0
#get history for ticket
history_list = self.history_get
#loop through hist. changes and get time
last_state = nil
last_state_change = nil
last_state_is_pending = false
history_list.each { |history_item|
# ignore if it isn't a state change
next if !history_item['attribute']
next if history_item['attribute'] != 'ticket_state'
# ignore all newer state before start_time
next if history_item['created_at'] < start_time
# ignore all older state changes after end_time
next if last_state_change && last_state_change > end_time
# if created_at is later then end_time, use end_time as last time
if history_item['created_at'] > end_time
history_item['created_at'] = end_time
end
total_time_without_pending = 0
total_time = 0
#get history for ticket
history_list = self.history_get
#loop through hist. changes and get time
last_state = nil
last_state_change = nil
last_state_is_pending = false
history_list.each { |history_item|
# get initial state and time
if !last_state
last_state = history_item['value_from']
last_state_change = start_time
end
# ignore if it isn't a state change
next if !history_item['attribute']
next if history_item['attribute'] != 'ticket_state'
# check if time need to be counted
counted = true
if history_item['value_from'] == 'pending'
counted = false
elsif history_item['value_from'] == 'close'
counted = false
end
# ignore all newer state before start_time
next if history_item['created_at'] < start_time
# ignore all older state changes after end_time
next if last_state_change && last_state_change > end_time
# if created_at is later then end_time, use end_time as last time
if history_item['created_at'] > end_time
history_item['created_at'] = end_time
end
# get initial state and time
if !last_state
last_state = history_item['value_from']
last_state_change = start_time
end
# check if time need to be counted
counted = true
if history_item['value_from'] == 'pending'
counted = false
elsif history_item['value_from'] == 'close'
counted = false
end
diff = escalation_time_diff( last_state_change, history_item['created_at'], sla_selected )
if counted
puts "Diff count #{history_item['value_from']} -> #{history_item['value_to']} / #{last_state_change} -> #{history_item['created_at']}"
total_time_without_pending = total_time_without_pending + diff
else
puts "Diff not count #{history_item['value_from']} -> #{history_item['value_to']} / #{last_state_change} -> #{history_item['created_at']}"
end
total_time = total_time + diff
if history_item['value_to'] == 'pending'
last_state_is_pending = true
else
last_state_is_pending = false
end
# remember for next loop last state
last_state = history_item['value_to']
last_state_change = history_item['created_at']
}
# if last state isnt pending, count rest
if !last_state_is_pending && last_state_change && last_state_change < end_time
diff = escalation_time_diff( last_state_change, end_time, sla_selected )
puts "Diff count last state was not pending #{diff.to_s} - #{last_state_change} - #{end_time}"
diff = escalation_time_diff( last_state_change, history_item['created_at'], sla_selected )
if counted
puts "Diff count #{history_item['value_from']} -> #{history_item['value_to']} / #{last_state_change} -> #{history_item['created_at']}"
total_time_without_pending = total_time_without_pending + diff
total_time = total_time + diff
end
# if we have not had any state change
if !last_state_change
diff = escalation_time_diff( start_time, end_time, sla_selected )
puts 'Diff state has not changed ' + diff.to_s
total_time_without_pending = total_time_without_pending + diff
total_time = total_time + diff
end
#return sum
if type == 'real'
return total_time_without_pending
elsif type == 'relative'
relative = total_time - total_time_without_pending
return relative
else
raise "ERROR: Unknown type #{type}"
puts "Diff not count #{history_item['value_from']} -> #{history_item['value_to']} / #{last_state_change} -> #{history_item['created_at']}"
end
end
total_time = total_time + diff
def escalation_time_diff( start_time, end_time, sla_selected )
if sla_selected
diff = TimeCalculation.business_time_diff( start_time, end_time, sla_selected.data, sla_selected.timezone)
if history_item['value_to'] == 'pending'
last_state_is_pending = true
else
diff = TimeCalculation.business_time_diff( start_time, end_time )
last_state_is_pending = false
end
diff
# remember for next loop last state
last_state = history_item['value_to']
last_state_change = history_item['created_at']
}
# if last state isnt pending, count rest
if !last_state_is_pending && last_state_change && last_state_change < end_time
diff = escalation_time_diff( last_state_change, end_time, sla_selected )
puts "Diff count last state was not pending #{diff.to_s} - #{last_state_change} - #{end_time}"
total_time_without_pending = total_time_without_pending + diff
total_time = total_time + diff
end
def calculation_higher_time(escalation_time, check_time, done_time)
return escalation_time if done_time
return check_time if !escalation_time
return escalation_time if !check_time
return check_time if escalation_time > check_time
return escalation_time
# if we have not had any state change
if !last_state_change
diff = escalation_time_diff( start_time, end_time, sla_selected )
puts 'Diff state has not changed ' + diff.to_s
total_time_without_pending = total_time_without_pending + diff
total_time = total_time + diff
end
end
#return sum
if type == 'real'
return total_time_without_pending
elsif type == 'relative'
relative = total_time - total_time_without_pending
return relative
else
raise "ERROR: Unknown type #{type}"
end
end
def escalation_time_diff( start_time, end_time, sla_selected )
if sla_selected
diff = TimeCalculation.business_time_diff( start_time, end_time, sla_selected.data, sla_selected.timezone)
else
diff = TimeCalculation.business_time_diff( start_time, end_time )
end
diff
end
def calculation_higher_time(escalation_time, check_time, done_time)
return escalation_time if done_time
return check_time if !escalation_time
return escalation_time if !check_time
return check_time if escalation_time > check_time
return escalation_time
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Flag < ApplicationModel
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::HistoryLog
@ -79,4 +79,4 @@ returns
}
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Number < ApplicationLib
@ -15,7 +15,7 @@ returns
=end
def self.generate
# generate number
(1..50_000).each { |i|
number = adapter.generate

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Number::Date
extend self

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Number::Increment
extend self

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Overviews
@ -187,62 +187,62 @@ returns
end
private
def self._condition(condition)
sql = ''
bind = [nil]
condition.each {|key, value|
if sql != ''
sql += ' AND '
end
if value.class == Array
sql += " #{key} IN (?)"
bind.push value
elsif value.class == Hash || value.class == ActiveSupport::HashWithIndifferentAccess
time = Time.now
if value['area'] == 'minute'
if value['direction'] == 'last'
time -= value['count'].to_i * 60
else
time += value['count'].to_i * 60
end
elsif value['area'] == 'hour'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60
else
time += value['count'].to_i * 60 * 60
end
elsif value['area'] == 'day'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24
else
time += value['count'].to_i * 60 * 60 * 24
end
elsif value['area'] == 'month'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24 * 31
else
time += value['count'].to_i * 60 * 60 * 24 * 31
end
elsif value['area'] == 'year'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24 * 365
else
time += value['count'].to_i * 60 * 60 * 24 * 365
end
end
def self._condition(condition)
sql = ''
bind = [nil]
condition.each {|key, value|
if sql != ''
sql += ' AND '
end
if value.class == Array
sql += " #{key} IN (?)"
bind.push value
elsif value.class == Hash || value.class == ActiveSupport::HashWithIndifferentAccess
time = Time.now
if value['area'] == 'minute'
if value['direction'] == 'last'
sql += " #{key} > ?"
bind.push time
time -= value['count'].to_i * 60
else
sql += " #{key} < ?"
bind.push time
time += value['count'].to_i * 60
end
elsif value['area'] == 'hour'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60
else
time += value['count'].to_i * 60 * 60
end
elsif value['area'] == 'day'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24
else
time += value['count'].to_i * 60 * 60 * 24
end
elsif value['area'] == 'month'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24 * 31
else
time += value['count'].to_i * 60 * 60 * 24 * 31
end
elsif value['area'] == 'year'
if value['direction'] == 'last'
time -= value['count'].to_i * 60 * 60 * 24 * 365
else
time += value['count'].to_i * 60 * 60 * 24 * 365
end
else
sql += " #{key} = ?"
bind.push value
end
}
bind[0] = sql
return bind
end
end
if value['direction'] == 'last'
sql += " #{key} > ?"
bind.push time
else
sql += " #{key} < ?"
bind.push time
end
else
sql += " #{key} = ?"
bind.push value
end
}
bind[0] = sql
return bind
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Permission
@ -44,4 +44,4 @@ returns
return false
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::Priority < ApplicationModel
self.table_name = 'ticket_priorities'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::ScreenOptions
@ -167,4 +167,4 @@ returns
}
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Search
@ -33,29 +33,29 @@ returns
if current_user.is_role('Agent')
groups = Group.joins(:users).
where( 'groups_users.user_id = ?', current_user.id ).
where( 'groups.active = ?', true )
group_condition = []
groups.each {|group|
group_condition.push group.name
}
where( 'groups_users.user_id = ?', current_user.id ).
where( 'groups.active = ?', true )
group_condition = []
groups.each {|group|
group_condition.push group.name
}
condition = {
'query_string' => { 'default_field' => 'Ticket.group.name', 'query' => "\"#{group_condition.join('" OR "')}\"" }
'query_string' => { 'default_field' => 'Ticket.group.name', 'query' => "\"#{group_condition.join('" OR "')}\"" }
}
query_extention['bool']['must'].push condition
else
if !current_user.organization || ( !current_user.organization.shared || current_user.organization.shared == false )
condition = {
'query_string' => { 'default_field' => 'Ticket.customer_id', 'query' => current_user.id }
'query_string' => { 'default_field' => 'Ticket.customer_id', 'query' => current_user.id }
}
# customer_id: XXX
# conditions = [ 'customer_id = ?', current_user.id ]
# customer_id: XXX
# conditions = [ 'customer_id = ?', current_user.id ]
else
condition = {
'query_string' => { 'query' => "Ticket.customer_id:#{current_user.id} OR Ticket.organization_id:#{current_user.organization.id}" }
'query_string' => { 'query' => "Ticket.customer_id:#{current_user.id} OR Ticket.organization_id:#{current_user.organization.id}" }
}
# customer_id: XXX OR organization_id: XXX
# conditions = [ '( customer_id = ? OR organization_id = ? )', current_user.id, current_user.organization.id ]
# customer_id: XXX OR organization_id: XXX
# conditions = [ '( customer_id = ? OR organization_id = ? )', current_user.id, current_user.organization.id ]
end
query_extention['bool']['must'].push condition
end
@ -101,4 +101,4 @@ returns
tickets
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::SearchIndex
@ -61,8 +61,8 @@ returns
end
file = Store.find( attachment.id )
data = {
"_name" => file.filename,
"content" => Base64.encode64( file.store_file.data )
"_name" => file.filename,
"content" => Base64.encode64( file.store_file.data )
}
article_attributes['attachments'].push data
}
@ -76,4 +76,4 @@ returns
SearchIndexBackend.add(self.class.to_s, attributes)
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::State < ApplicationModel
belongs_to :state_type, :class_name => 'Ticket::StateType'
@ -22,10 +22,10 @@ returns:
:state_type_id => Ticket::StateType.where( :name => ['new', 'open', 'pending reminder', 'pending action'] )
)
elsif category == 'closed'
return Ticket::State.where(
return Ticket::State.where(
:state_type_id => Ticket::StateType.where( :name => ['closed'] )
)
end
end
raise "Unknown category '#{category}'"
end
@ -44,7 +44,7 @@ returns:
=end
def ignore_escalation?
ignore_escalation = ['removed', 'closed', 'merged']
ignore_escalation = ['removed', 'closed', 'merged']
return true if ignore_escalation.include?( self.name )
return false
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Ticket::StateType < ApplicationModel
has_many :states, :class_name => 'Ticket::State'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module Ticket::Subject
@ -75,4 +75,4 @@ returns
return subject
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class TimeAccounting < ActiveRecord::Base
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Token < ActiveRecord::Base
before_create :generate_token

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Translation < ApplicationModel
before_create :set_initial

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class Trigger < ActiveRecord::Base
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
require 'digest/md5'

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module User::Assets
@ -37,4 +37,4 @@ returns
data
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module User::Search
@ -65,4 +65,4 @@ returns
return users
end
end
end

View file

@ -1,4 +1,4 @@
# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
module User::SearchIndex
@ -25,4 +25,4 @@ returns
return if attributes.empty?
attributes
end
end
end