less literals, less typos

This commit is contained in:
rkaldung 2015-02-15 10:23:55 +01:00
parent 42780b7ef9
commit 28d48790b1
3 changed files with 6 additions and 6 deletions

View file

@ -82,7 +82,7 @@ class ApplicationController < ActionController::Base
#session[:ping] = Time.now.utc.iso8601 #session[:ping] = Time.now.utc.iso8601
session[:ping] = DateTime.now.iso8601 session[:ping] = DateTime.now.iso8601
# check if remote ip need to be updated # check if remote ip need to be updated @TODO Move this into model
if !session[:remote_id] || session[:remote_id] != request.remote_ip if !session[:remote_id] || session[:remote_id] != request.remote_ip
session[:remote_id] = request.remote_ip session[:remote_id] = request.remote_ip
session[:geo] = GeoIp.location( request.remote_ip ) session[:geo] = GeoIp.location( request.remote_ip )

View file

@ -80,7 +80,7 @@ class TicketsController < ApplicationController
def destroy def destroy
ticket = Ticket.find( params[:id] ) ticket = Ticket.find( params[:id] )
# permissin check # permission check
return if !ticket_permission(ticket) return if !ticket_permission(ticket)
ticket.destroy ticket.destroy

View file

@ -74,14 +74,14 @@ returns
=end =end
def agent_of_group def agent_of_group
Group.find( self.group_id ).users.where( :active => true ).joins(:roles).where( 'roles.name' => 'Agent', 'roles.active' => true ).uniq() Group.find( self.group_id ).users.where( :active => true ).joins(:roles).where( 'roles.name' => Z_ROLENAME_AGENT, 'roles.active' => true ).uniq()
end end
=begin =begin
get user access conditions get user access conditions
connditions = Ticket.access_condition( User.find(1) ) conditions = Ticket.access_condition( User.find(1) )
returns returns
@ -91,7 +91,7 @@ returns
def self.access_condition(user) def self.access_condition(user)
access_condition = [] access_condition = []
if user.is_role('Agent') if user.is_role(Z_ROLENAME_AGENT)
group_ids = Group.select( 'groups.id' ).joins(:users). group_ids = Group.select( 'groups.id' ).joins(:users).
where( 'groups_users.user_id = ?', user.id ). where( 'groups_users.user_id = ?', user.id ).
where( 'groups.active = ?', true ). where( 'groups.active = ?', true ).
@ -136,7 +136,7 @@ returns
Ticket::Article.create( Ticket::Article.create(
:ticket_id => self.id, :ticket_id => self.id,
:type_id => Ticket::Article::Type.lookup( :name => 'note' ).id, :type_id => Ticket::Article::Type.lookup( :name => 'note' ).id,
:sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id, :sender_id => Ticket::Article::Sender.lookup( :name => Z_ROLENAME_AGENT ).id,
:body => 'merged', :body => 'merged',
:internal => false :internal => false
) )