Code: Select all
# --
# Kernel/Output/HTML/DashboardUserOnline.pm
# Copyright (C) 2001-2014 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::Output::HTML::TicketOverviewWidget6;
use strict;
use warnings;
use Data::Dumper;
use Kernel::System::State;
use Kernel::System::DynamicField;
use Kernel::System::DynamicField::Backend;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
# get needed objects
for my $Object (
qw(
Config Name ConfigObject LogObject DBObject LayoutObject ParamObject TicketObject
QueueObject UserID
)
)
{
die "Got no $Object!" if ( !$Self->{$Object} );
}
return $Self;
}
sub Preferences {
my ( $Self, %Param ) = @_;
return;
}
sub Config {
my ( $Self, %Param ) = @_;
return (
%{ $Self->{Config} },
# remember, do not allow to use page cache
# (it's not working because of internal filter)
);
}
sub Run {
my ( $Self, %Param ) = @_;
my $ProdTicketsOpen = $Self->{TicketObject}->TicketSearch(
# result (required)
Result => 'COUNT',
StateType => ['open'],
DynamicField_TicketEnvironment => {
Equals => PROD,
}
# user search (UserID is required)
UserID => 1,
Permission => 'ro' || 'rw',
# customer search (CustomerUserID is required)
CustomerUserID => $Self->{UserID},
Permission => 'ro',
);
my $ProdTicketsClosed = $Self->{TicketObject}->TicketSearch(
# result (required)
Result => 'COUNT',
StateType => ['closed'],
DynamicField_TicketEnvironment => {
Like => PROD,
}
# user search (UserID is required)
UserID => 1,
Permission => 'ro' || 'rw',
# customer search (CustomerUserID is required)
CustomerUserID => $Self->{UserID},
Permission => 'ro',
);
#log
#$Self->{LogObject}->Log(
#Priority => 'info',
#Message => "content=".Dumper($ProdTicketsOpen, $ProdTicketsClosed),
#);
#
my $Content = $Self->{LayoutObject}->Output(
TemplateFile => 'CustomerTicketOverviewWidget6',
Data => {
ProdTicketsOpen => $ProdTicketsOpen,
ProdTicketsClosed => $ProdTicketsClosed,
},
);
#log
$Self->{LogObject}->Log(
Priority => 'info',
Message => "content=".Dumper($Content),
);
#
return $Content;
}
1;
Still getting the errors:
Code: Select all
==> /var/log/httpd/error_log <==
[Mon Jul 6 22:30:59 2015] ZZZAAuto.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config/Files/ZZZAAuto.pm line 7.
[Mon Jul 6 22:30:59 2015] ZZZAuto.pm: Subroutine Load redefined at /opt/otrs/Kernel/Config/Files/ZZZAuto.pm line 7.
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine new redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 20.
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine Preferences redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 42.
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine Config redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 48.
==> /tmp/otrs.log.2015-7 <==
[Mon Jul 6 22:31:00 2015][Error][Kernel::Modules::CustomerTicketWidgets::_Element][1365] syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 73, near "UserID"
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 81.
syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 91, near "UserID"
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 95.
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 105.
Global symbol "$ProdTicketsOpen" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 109.
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 115.
syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 121, near "}"
==> /var/log/httpd/error_log <==
ERROR: OTRS-CGI-90 Perl: 5.10.1 OS: linux Time: Mon Jul 6 22:31:00 2015
Message: syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 73, near "UserID"
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 81.
syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 91, near "UserID"
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 95.
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 105.
Global symbol "$ProdTicketsOpen" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 109.
Global symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 115.
syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 121, near "}"
RemoteAddress: 192.168.7.6
RequestURI: /otrs/customer.pl?Action=CustomerTicketWidgets;Subaction=MyTickets
Traceback (31337):
Module: Kernel::Modules::CustomerTicketWidgets::_Element (OTRS 3.3.8) Line: 1365
Module: Kernel::Modules::CustomerTicketWidgets::Run (OTRS 3.3.8) Line: 560
Module: Kernel::System::Web::InterfaceCustomer::Run (OTRS 3.3.8) Line: 1002
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_customer_2epl::handler (unknown version) Line: 41
Module: (eval) (v1.99) Line: 204
Module: ModPerl::RegistryCooker::run (v1.99) Line: 204
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 170
Module: ModPerl::Registry::handler (v1.99) Line: 31
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine new redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 20.
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine Preferences redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 42.
[Mon Jul 6 22:31:00 2015] TicketOverviewWidget6.pm: Subroutine Config redefined at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 48.
[Mon Jul 06 22:31:00 2015] [error] [client 192.168.7.6] syntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 73, near "UserID"\nGlobal symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 81.\nsyntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 91, near "UserID"\nGlobal symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 95.\nGlobal symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 105.\nGlobal symbol "$ProdTicketsOpen" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 109.\nGlobal symbol "$Self" requires explicit package name at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 115.\nsyntax error at /opt/otrs//Kernel/Output/HTML/TicketOverviewWidget6.pm line 121, near "}"\nCompilation failed in require at /opt/otrs/Kernel/cpan-lib/Apache2/Reload.pm line 179.\n, referer: http://172.16.1.31/otrs/customer.pl?Action=CustomerTicketWidgets;Subaction=MyTickets