Просмотр исходного кода

Merge branch 'develop' into feature/rails4

Conflicts:
	Gemfile
	app/controllers/application_controller.rb
Martin Edenhofer 11 лет назад
Родитель
Сommit
a0cdaf31e7

+ 0 - 3
app/assets/javascripts/app/controllers/getting_started.js.coffee

@@ -136,9 +136,6 @@ class Index extends App.ControllerContent
   relogin: (data, status, xhr) =>
     @log 'notice', 'relogin:success', data
 
-    # login check
-    App.Auth.loginCheck()
-
     # add notify
     App.Event.trigger 'notify:removeall'
 #      @notify

+ 4 - 4
app/assets/javascripts/app/lib/app_post/auth.js.coffee

@@ -3,10 +3,10 @@ class App.Auth
   @login: (params) ->
     App.Log.notice 'Auth', 'login', params
     App.Ajax.request(
-      id:     'login',
-      type:   'POST',
-      url:     App.Config.get('api_path') + '/signin',
-      data:    JSON.stringify(params.data),
+      id:     'login'
+      type:   'POST'
+      url:    App.Config.get('api_path') + '/signin'
+      data:   JSON.stringify(params.data)
       success: (data, status, xhr) =>
 
         # set login (config, session, ...)

+ 1 - 1
app/assets/javascripts/app/views/package.jst.eco

@@ -11,7 +11,7 @@
     </ul>
 -->
     <p>
-      <form action="api/packages" method="post" enctype="multipart/form-data">
+      <form action="<%= App.Config.get('api_path') %>/packages" method="post" enctype="multipart/form-data">
         <input type="file" name="file_upload"/>
         <button class="btn btn-primary" type="submit"><%- @T('Install Package') %></button>
       </form>

+ 1 - 1
app/assets/javascripts/app/views/ticket_zoom/article_view.jst.eco

@@ -32,7 +32,7 @@
       <% if article.attachments: %>
         <div>
         <% for attachment in article.attachments: %>
-          <a href="api/ticket_attachment/<%= article.ticket_id %>/<%= article.id %>/<%= attachment.id %>" target="_blank" data-type="attachment" class="" title="<%= attachment.size %>"><%= attachment.filename %></a>
+          <a href="<%= App.Config.get('api_path') %>/ticket_attachment/<%= article.ticket_id %>/<%= article.id %>/<%= attachment.id %>" target="_blank" data-type="attachment" class="" title="<%= attachment.size %>"><%= attachment.filename %></a>
         <% end %>
         </div>
       <% end %>

+ 4 - 1
app/controllers/application_controller.rb

@@ -76,7 +76,10 @@ class ApplicationController < ActionController::Base
 
   # update session updated_at
   def session_update
-    session[:ping] = Time.now.utc.iso8601
+
+    # on many paralell requests, session got reinitialised if Time. is used, as workaround use DateTime.
+    #session[:ping] = Time.now.utc.iso8601
+    session[:ping] = DateTime.now.iso8601
 
     # check if remote ip need to be updated
     if !session[:remote_id] || session[:remote_id] != request.remote_ip

+ 1 - 1
app/models/observer/session.rb

@@ -14,7 +14,7 @@ class Observer::Session < ActiveRecord::Observer
 
   def check(record)
     return if !record.data
-
+    return if record[:request_type]
     # remember request type
     if record.data['request_type']
       record[:request_type] = record.data['request_type']

+ 1 - 1
app/models/organization/search.rb

@@ -53,7 +53,7 @@ returns
           end
         }
         if !organization_exists
-          organizations.push organization
+          organizations.push organization_by_user
         end
       }
     end

+ 49 - 38
app/models/ticket/escalation.rb

@@ -150,6 +150,55 @@ returns
     self.save
   end
 
+=begin
+
+return sla for ticket
+
+  ticket = Ticket.find(123)
+  result = ticket.escalation_calculation_get_sla
+
+returns
+
+  result = selected_sla
+
+=end
+
+def escalation_calculation_get_sla
+    sla_selected = nil
+    sla_list = Cache.get( 'SLA::List::Active' )
+    if sla_list == nil
+      sla_list = Sla.where( :active => true ).all
+      Cache.write( 'SLA::List::Active', sla_list, { :expires_in => 1.hour } )
+    end
+    sla_list.each {|sla|
+      if !sla.condition || sla.condition.empty?
+        sla_selected = sla
+      elsif sla.condition
+        hit = false
+        map = [
+          [ 'tickets.ticket_priority_id', 'ticket_priority_id' ],
+          [ 'tickets.group_id', 'group_id' ]
+        ]
+        map.each {|item|
+          if sla.condition[ item[0] ]
+            if sla.condition[ item[0] ].class == String
+              sla.condition[ item[0] ] = [ sla.condition[ item[0] ] ]
+            end
+            if sla.condition[ item[0] ].include?( self[ item[1] ].to_s )
+              hit = true
+            else
+              hit = false
+            end
+          end
+        }
+        if hit
+          sla_selected = sla
+        end
+      end
+    }
+    sla_selected
+  end
+
   private
 
     #type could be:
@@ -257,44 +306,6 @@ returns
       diff
     end
 
-    def escalation_calculation_get_sla
-
-      sla_selected = nil
-      sla_list = Cache.get( 'SLA::List::Active' )
-      if sla_list == nil
-        sla_list = Sla.where( :active => true ).all
-        Cache.write( 'SLA::List::Active', sla_list, { :expires_in => 1.hour } )
-      end
-      sla_list.each {|sla|
-        if !sla.condition || sla.condition.empty?
-          sla_selected = sla
-        elsif sla.condition
-          hit = false
-          map = [
-            [ 'tickets.ticket_priority_id', 'ticket_priority_id' ],
-            [ 'tickets.group_id', 'group_id' ]
-          ]
-          map.each {|item|
-            if sla.condition[ item[0] ]
-              if sla.condition[ item[0] ].class == String
-                sla.condition[ item[0] ] = [ sla.condition[ item[0] ] ]
-              end
-              if sla.condition[ item[0] ].include?( self[ item[1] ].to_s )
-                hit = true
-              else
-                hit = false
-              end
-            end
-          }
-          if hit
-            sla_selected = sla
-          end
-        end
-      }
-
-      return sla_selected
-    end
-
     def calculation_higher_time(escalation_time, check_time, done_time)
       return escalation_time if done_time
       return check_time if !escalation_time

+ 1 - 0
app/models/user.rb

@@ -1,5 +1,6 @@
 # Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
 
+require 'sso'
 require 'digest/sha2'
 require 'organization'
 

+ 1 - 1
db/migrate/20130502000001_scheduler_update.rb

@@ -23,7 +23,7 @@ class SchedulerUpdate < ActiveRecord::Migration
     )
     Scheduler.create_or_update(
       :name           => 'Generate Session data',
-      :method         => 'Session.jobs',
+      :method         => 'Sessions.jobs',
       :period         => 60,
       :prio           => 1,
       :active         => true,

Некоторые файлы не были показаны из-за большого количества измененных файлов