[otrs-cvs] SIRIOS/Kernel/Modules AgentTicketWorkflow.pm, 1.8,
1.9 AgentWorkingRoleSelection.pm, 1.4, 1.5
cvs-log at otrs.org
cvs-log at otrs.org
Sun Feb 3 08:19:24 GMT 2008
Comments:
Update of /home/cvs/SIRIOS/Kernel/Modules
In directory lancelot:/tmp/cvs-serv20697/Kernel/Modules
Modified Files:
AgentTicketWorkflow.pm AgentWorkingRoleSelection.pm
Log Message:
Use OTRSRecode to improve the code style.
Author: tr
Index: AgentTicketWorkflow.pm
===================================================================
RCS file: /home/cvs/SIRIOS/Kernel/Modules/AgentTicketWorkflow.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AgentTicketWorkflow.pm 29 Aug 2007 11:07:33 -0000 1.8
--- AgentTicketWorkflow.pm 3 Feb 2008 08:19:18 -0000 1.9
***************
*** 1,5 ****
# --
# Kernel/Modules/AgentTicketWorkflow.pm - the workflow view of all tickets
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
# --
# $Id$
--- 1,5 ----
# --
# Kernel/Modules/AgentTicketWorkflow.pm - the workflow view of all tickets
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
# --
[...1266 lines suppressed...]
! || $Self->{ConfigObject}->Get('PreferencesGroups')->{QueueView}->{DataSelected};
! if ( $TicketView ne 'AgentTicketQueueTicketViewLite' ) {
return $Self->{LayoutObject}->Output(
TemplateFile => 'AgentTicketQueueTicketView',
! Data => { %Param, %Article, %AclAction },
);
}
***************
*** 701,705 ****
return $Self->{LayoutObject}->Output(
TemplateFile => 'AgentTicketQueueTicketViewLite',
! Data => { %Param, %Article, %AclAction},
);
}
--- 791,795 ----
return $Self->{LayoutObject}->Output(
TemplateFile => 'AgentTicketQueueTicketViewLite',
! Data => { %Param, %Article, %AclAction },
);
}
Author: tr
Index: AgentWorkingRoleSelection.pm
===================================================================
RCS file: /home/cvs/SIRIOS/Kernel/Modules/AgentWorkingRoleSelection.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AgentWorkingRoleSelection.pm 7 Dec 2006 13:27:05 -0000 1.4
--- AgentWorkingRoleSelection.pm 3 Feb 2008 08:19:18 -0000 1.5
***************
*** 1,5 ****
# --
# Kernel/Modules/AgentWorkingRoleSelection.pm - so the agent can select the working group
! # Copyright (C) 2003-2006 OTRS GmbH, http://otrs.com/
# --
# $Id$
--- 1,5 ----
# --
# Kernel/Modules/AgentWorkingRoleSelection.pm - so the agent can select the working group
! # Copyright (C) 2001-2008 OTRS AG, http://otrs.org/
# --
# $Id$
***************
*** 7,11 ****
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
--- 7,11 ----
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
! # did not receive this file, see http://www.gnu.org/licenses/gpl-2.0.txt.
# --
***************
*** 13,37 ****
use strict;
use vars qw($VERSION);
! $VERSION = '$Revision$';
! $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
sub new {
! my $Type = shift;
! my %Param = @_;
# allocate new hash for object
my $Self = {};
! bless ($Self, $Type);
! foreach (keys %Param) {
$Self->{$_} = $Param{$_};
}
# check needed objects
! foreach (qw(ParamObject DBObject LayoutObject LogObject ConfigObject)) {
! if (!$Self->{$_}) {
! $Self->{LayoutObject}->FatalError(Message => "Got no $_!");
}
}
--- 13,36 ----
use strict;
+ use warnings;
use vars qw($VERSION);
! $VERSION = qw($Revision$) [1];
sub new {
! my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
! bless( $Self, $Type );
! for ( keys %Param ) {
$Self->{$_} = $Param{$_};
}
# check needed objects
! for (qw(ParamObject DBObject LayoutObject LogObject ConfigObject)) {
! if ( !$Self->{$_} ) {
! $Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
}
}
***************
*** 40,93 ****
sub PreRun {
! my $Self = shift;
! my %Param = @_;
my $Output;
! if (!$Self->{RequestedURL}) {
$Self->{RequestedURL} = 'Action=';
}
# redirect if no primary group is selected
! if (!$Self->{PrimaryRoleID} && $Self->{Action} ne 'AgentWorkingRoleSelection') {
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => $Self->{RequestedURL},
);
! return $Self->{LayoutObject}->Redirect(OP => "Action=AgentWorkingRoleSelection");
}
# redefine group settings (just for non admin modules)
! if ($Self->{Action} !~ /^Admin/ && $Self->{PrimaryRoleID}) {
! # print STDERR "Force\n";
$Self->{GroupObject}->{ForceCache} = 1;
! foreach my $Type (@{$Self->{ConfigObject}->Get('System::Permission')}) {
my %Groups = $Self->{GroupObject}->GroupRoleMemberList(
RoleID => $Self->{PrimaryRoleID},
! Type => $Type,
Result => 'HASH',
);
# reset current permissions
! undef $Self->{GroupObject}->{"GroupMemberList::".$Type."::ID::UserID::$Self->{UserID}"};
! undef $Self->{GroupObject}->{"GroupMemberList::".$Type."::HASH::UserID::$Self->{UserID}"};
! undef $Self->{GroupObject}->{"GroupMemberList::".$Type."::Name::UserID::$Self->{UserID}"};
# set new current permissions
! foreach (keys %Groups) {
! push (@{$Self->{GroupObject}->{"GroupMemberList::".$Type."::ID::UserID::$Self->{UserID}"}}, $_);
! push (@{$Self->{GroupObject}->{"GroupMemberList::".$Type."::Name::UserID::$Self->{UserID}"}}, $Groups{$_});
! $Self->{GroupObject}->{"GroupMemberList::".$Type."::HASH::UserID::$Self->{UserID}"}->{$_} = $Groups{$_};
}
}
}
! foreach my $Type (@{$Self->{ConfigObject}->Get('System::Permission')}) {
! foreach (keys %{$Self->{GroupObject}->{"GroupMemberList::".$Type."::HASH::UserID::$Self->{UserID}"}}) {
! # print STDERR "########## $Type $_\n";
}
my %Groups = $Self->{GroupObject}->GroupMemberList(
UserID => $Self->{UserID},
! Type => $Type,
Result => 'HASH',
);
! foreach (keys %Groups) {
! # print STDERR "$Type {$_ => $Groups{$_}} ---------\n";
}
}
--- 39,123 ----
sub PreRun {
! my ( $Self, %Param ) = @_;
!
my $Output;
! if ( !$Self->{RequestedURL} ) {
$Self->{RequestedURL} = 'Action=';
}
+
# redirect if no primary group is selected
! if ( !$Self->{PrimaryRoleID} && $Self->{Action} ne 'AgentWorkingRoleSelection' ) {
!
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => $Self->{RequestedURL},
);
! return $Self->{LayoutObject}->Redirect( OP => "Action=AgentWorkingRoleSelection" );
}
+
# redefine group settings (just for non admin modules)
! if ( $Self->{Action} !~ /^Admin/ && $Self->{PrimaryRoleID} ) {
!
! # print STDERR "Force\n";
$Self->{GroupObject}->{ForceCache} = 1;
! for my $Type ( @{ $Self->{ConfigObject}->Get('System::Permission') } ) {
my %Groups = $Self->{GroupObject}->GroupRoleMemberList(
RoleID => $Self->{PrimaryRoleID},
! Type => $Type,
Result => 'HASH',
);
+
# reset current permissions
! undef $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::ID::UserID::$Self->{UserID}" };
! undef $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::HASH::UserID::$Self->{UserID}" };
! undef $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::Name::UserID::$Self->{UserID}" };
!
# set new current permissions
! for ( keys %Groups ) {
! push(
! @{
! $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::ID::UserID::$Self->{UserID}" }
! },
! $_
! );
! push(
! @{
! $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::Name::UserID::$Self->{UserID}" }
! },
! $Groups{$_}
! );
! $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::HASH::UserID::$Self->{UserID}" }->{$_}
! = $Groups{$_};
}
}
}
! for my $Type ( @{ $Self->{ConfigObject}->Get('System::Permission') } ) {
! for (
! keys %{
! $Self->{GroupObject}
! ->{ "GroupMemberList::" . $Type . "::HASH::UserID::$Self->{UserID}" }
! }
! )
! {
!
! # print STDERR "########## $Type $_\n";
}
my %Groups = $Self->{GroupObject}->GroupMemberList(
UserID => $Self->{UserID},
! Type => $Type,
Result => 'HASH',
);
! for ( keys %Groups ) {
!
! # print STDERR "$Type {$_ => $Groups{$_}} ---------\n";
}
}
***************
*** 96,161 ****
sub Run {
! my $Self = shift;
! my %Param = @_;
my $Output;
! if (!$Self->{RequestedURL}) {
$Self->{RequestedURL} = 'Action=';
}
! my $PrimaryRoleID = $Self->{ParamObject}->GetParam(Param => 'PrimaryRoleID');
! if ($Self->{PrimaryRoleID}) {
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => '',
);
# redirect
! return $Self->{LayoutObject}->Redirect(OP => "$Self->{UserRequestedURL}");
}
elsif ($PrimaryRoleID) {
! my %Role = $Self->{GroupObject}->RoleGet(ID => $PrimaryRoleID);
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRoleRealname',
! Value => "$Role{Comment} ($Role{Name})",
);
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRole',
! Value => $Role{Name},
);
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRoleID',
! Value => $PrimaryRoleID,
);
# clean up group sesssion info
my %Data = $Self->{SessionObject}->GetSessionIDData(
SessionID => $Self->{SessionID},
);
# remove all env of group info
! foreach my $Session (keys %Data) {
! if ($Session =~ /^UserIsGroup/) {
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => $Session,
! Value => '',
);
}
}
# get role groups
! foreach my $Type (qw(ro rw)) {
my %Groups = $Self->{GroupObject}->GroupRoleMemberList(
RoleID => $PrimaryRoleID,
! Type => $Type,
Result => 'HASH',
);
! foreach (keys %Groups) {
! #print STDERR " +++++++++ {$_ => $Groups{$_}} ---------\n";
! if ($Type eq 'ro') {
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => "UserIsGroupRo[$Groups{$_}]",
! Value => 'Yes',
);
}
--- 126,197 ----
sub Run {
! my ( $Self, %Param ) = @_;
!
my $Output;
! if ( !$Self->{RequestedURL} ) {
$Self->{RequestedURL} = 'Action=';
}
! my $PrimaryRoleID = $Self->{ParamObject}->GetParam( Param => 'PrimaryRoleID' );
! if ( $Self->{PrimaryRoleID} ) {
!
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => '',
);
+
# redirect
! return $Self->{LayoutObject}->Redirect( OP => "$Self->{UserRequestedURL}" );
}
elsif ($PrimaryRoleID) {
! my %Role = $Self->{GroupObject}->RoleGet( ID => $PrimaryRoleID );
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRoleRealname',
! Value => "$Role{Comment} ($Role{Name})",
);
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRole',
! Value => $Role{Name},
);
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'PrimaryRoleID',
! Value => $PrimaryRoleID,
);
+
# clean up group sesssion info
my %Data = $Self->{SessionObject}->GetSessionIDData(
SessionID => $Self->{SessionID},
);
+
# remove all env of group info
! for my $Session ( keys %Data ) {
! if ( $Session =~ /^UserIsGroup/ ) {
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => $Session,
! Value => '',
);
}
}
+
# get role groups
! for my $Type (qw(ro rw)) {
my %Groups = $Self->{GroupObject}->GroupRoleMemberList(
RoleID => $PrimaryRoleID,
! Type => $Type,
Result => 'HASH',
);
! for ( keys %Groups ) {
!
! #print STDERR " +++++++++ {$_ => $Groups{$_}} ---------\n";
! if ( $Type eq 'ro' ) {
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => "UserIsGroupRo[$Groups{$_}]",
! Value => 'Yes',
);
}
***************
*** 163,182 ****
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => "UserIsGroup[$Groups{$_}]",
! Value => 'Yes',
);
}
}
}
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => '',
);
# redirect
! return $Self->{LayoutObject}->Redirect(OP => "$Self->{UserRequestedURL}");
}
else {
# check if just one role is available and redirect
my %RoleList = $Self->{GroupObject}->GroupUserRoleMemberList(
--- 199,221 ----
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => "UserIsGroup[$Groups{$_}]",
! Value => 'Yes',
);
}
}
}
+
# remove requested url from sesseion storage
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
! Key => 'UserRequestedURL',
! Value => '',
);
+
# redirect
! return $Self->{LayoutObject}->Redirect( OP => "$Self->{UserRequestedURL}" );
}
else {
+
# check if just one role is available and redirect
my %RoleList = $Self->{GroupObject}->GroupUserRoleMemberList(
***************
*** 184,211 ****
Result => 'HASH',
);
! my $Count = 0;
my $LastRoleID = '';
! foreach (sort keys %RoleList) {
$Count++;
$LastRoleID = $_;
}
! if ($Count == 1) {
return $Self->{LayoutObject}->Redirect(
! OP => "Action=AgentWorkingRoleSelection&PrimaryRoleID=$LastRoleID&RequestedURL=$Self->{RequestedURL}",
);
}
# get session info
my @Sessions = $Self->{SessionObject}->GetAllSessionIDs();
! foreach (@Sessions) {
my %Data = $Self->{SessionObject}->GetSessionIDData(
SessionID => $_,
);
! foreach (keys %Data) {
! if ($_ eq 'PrimaryRoleRealname') {
! $Self->{$Data{$_}}++;
}
}
}
! $Output = $Self->{LayoutObject}->Header(Title => 'Role-Selection');
$Output .= $Self->_Mask(
RoleList => \%RoleList,
--- 223,252 ----
Result => 'HASH',
);
! my $Count = 0;
my $LastRoleID = '';
! for ( sort keys %RoleList ) {
$Count++;
$LastRoleID = $_;
}
! if ( $Count == 1 ) {
return $Self->{LayoutObject}->Redirect(
! OP =>
! "Action=AgentWorkingRoleSelection&PrimaryRoleID=$LastRoleID&RequestedURL=$Self->{RequestedURL}",
);
}
+
# get session info
my @Sessions = $Self->{SessionObject}->GetAllSessionIDs();
! for (@Sessions) {
my %Data = $Self->{SessionObject}->GetSessionIDData(
SessionID => $_,
);
! for ( keys %Data ) {
! if ( $_ eq 'PrimaryRoleRealname' ) {
! $Self->{ $Data{$_} }++;
}
}
}
! $Output = $Self->{LayoutObject}->Header( Title => 'Role-Selection' );
$Output .= $Self->_Mask(
RoleList => \%RoleList,
***************
*** 217,247 ****
sub _Mask {
! my $Self = shift;
! my %Param = @_;
my %RoleList = ();
! foreach (keys %{$Param{RoleList}}) {
! my %Role = $Self->{GroupObject}->RoleGet(ID => $_);
$RoleList{$_} = "$Role{Comment} ($Role{Name})";
}
# config map
my %Max = ();
! if ($Self->{ConfigObject}->Get('MaxRoleLimit')) {
! %Max = %{$Self->{ConfigObject}->Get('MaxRoleLimit')};
}
else {
! $Self->{LogObject}->Log(Priority => 'error', Message => "Need MaxRoleLimit in Kernel/Config.pm!");
}
! foreach (sort keys %RoleList) {
$Self->{LayoutObject}->Block(
Name => 'Role',
! Data => { },
);
! if ($Self->{$RoleList{$_}} && $Max{$RoleList{$_}} && $Max{$RoleList{$_}} <= $Self->{$RoleList{$_}}) {
$Self->{LayoutObject}->Block(
Name => 'RolePassive',
Data => {
RoleID => $_,
! Name => $RoleList{$_},
! Count => $Self->{$RoleList{$_}}||0,
FormID => $Self->{FormID},
},
--- 258,295 ----
sub _Mask {
! my ( $Self, %Param ) = @_;
!
my %RoleList = ();
! for ( keys %{ $Param{RoleList} } ) {
! my %Role = $Self->{GroupObject}->RoleGet( ID => $_ );
$RoleList{$_} = "$Role{Comment} ($Role{Name})";
}
+
# config map
my %Max = ();
! if ( $Self->{ConfigObject}->Get('MaxRoleLimit') ) {
! %Max = %{ $Self->{ConfigObject}->Get('MaxRoleLimit') };
}
else {
! $Self->{LogObject}
! ->Log( Priority => 'error', Message => "Need MaxRoleLimit in Kernel/Config.pm!" );
}
! for ( sort keys %RoleList ) {
$Self->{LayoutObject}->Block(
Name => 'Role',
! Data => {},
);
! if (
! $Self->{ $RoleList{$_} }
! && $Max{ $RoleList{$_} }
! && $Max{ $RoleList{$_} } <= $Self->{ $RoleList{$_} }
! )
! {
$Self->{LayoutObject}->Block(
Name => 'RolePassive',
Data => {
RoleID => $_,
! Name => $RoleList{$_},
! Count => $Self->{ $RoleList{$_} } || 0,
FormID => $Self->{FormID},
},
***************
*** 252,258 ****
Name => 'RoleActive',
Data => {
! RoleID => $_,
! Name => $RoleList{$_},
! Count => $Self->{$RoleList{$_}}||0,
RequestedURL => $Self->{RequestedURL},
},
--- 300,306 ----
Name => 'RoleActive',
Data => {
! RoleID => $_,
! Name => $RoleList{$_},
! Count => $Self->{ $RoleList{$_} } || 0,
RequestedURL => $Self->{RequestedURL},
},
***************
*** 260,267 ****
}
}
# get output back
my $Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AgentWorkingRoleSelection',
! Data => \%Param,
);
return $Output;
--- 308,316 ----
}
}
+
# get output back
my $Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AgentWorkingRoleSelection',
! Data => \%Param,
);
return $Output;
More information about the cvs-log
mailing list