OTRS Statistiken [gelöst]

Hilfe zu Znuny Problemen aller Art
Locked
Rene68
Znuny newbie
Posts: 76
Joined: 09 Jun 2010, 14:37
Znuny Version: OTRS 6

OTRS Statistiken [gelöst]

Post by Rene68 »

Hallo,

ich habe ein Problem vielleicht hat jemand eine Idee wie man das lösen könnte:

Ich würde gerne bei Ticket die länger laufen eine Statistik erzeugen mit den angefallenen Arbeitsstunden des letzten Monats.
Das Problem ist das OTRS ja nur die gesamt Zeit ausspuckt.
Ich brauche aber die Aufschlüsselung nach Artikeln. Via SQL könnte man es z.b. so machen:

Code: Select all

select t.tn ticketnumber, t.user_id ownerid, CONCAT(u2.first_name, " ", u2.last_name) owner, a.create_by user_id, CONCAT(u.first_name, " ", u.last_name) name, t.title title, q.name queue, t.customer_user_id customer_user, t.customer_id customer, ta.time_unit time_unit, DATE_FORMAT(ta.create_time, "%m/%d/%y") create_time,  a.a_subject subject, a.a_body body from ticket t left join time_accounting ta on ta.ticket_id=t.id left join queue q on t.queue_id = q.id  left join article a on a.id=ta.article_id left join users u on u.id = a.create_by left join users u2 on u2.id=t.user_id where ta.time_unit is not null order by create_time where DATE(th.create_time) between '2015-10-01' and '2015-10-31'
Aber ich brauche das im OTRS und wenn es als extra Seite ist.

Vielleicht kann mir jemand helfen.
Last edited by Rene68 on 17 Feb 2016, 11:55, edited 1 time in total.
OTRS :5
Rene68
Znuny newbie
Posts: 76
Joined: 09 Jun 2010, 14:37
Znuny Version: OTRS 6

Re: OTRS Statistiken

Post by Rene68 »

Habe mittlerweile zwei Statistiken erstellet ein klappt auch ganz wunderbar aber bei der Zweiten habe ich ein Problem, hier der Code

Code: Select all

package Kernel::System::Stats::Dynamic::VPNicketArticleList;

use strict;
use warnings;
use Kernel::System::Stats::Dynamic::TicketList;

our $VERSION = '1.$Rev: 288 $';
$VERSION =~ s/[^\d\.]//go;

our @ISA;
push @ISA, "Kernel::System::Stats::Dynamic::TicketList";

sub GetObjectName
{
	my ($Self, %Param) = @_;

	return "VPNicketArticleList";
}

sub _TicketAttributes
{
	my ($Self, %Param) = @_;

	my $TicketAttributes = $Self->SUPER::_TicketAttributes(%Param);

	$TicketAttributes->{Notes} = "Notes";
	# intentionally NO TicketID here!

	return $TicketAttributes;
}

sub _SortedAttributes
{
	my ($Self, %Param) = @_;

	my $SortedAttributes = $Self->SUPER::_SortedAttributes(%Param);

	push @$SortedAttributes, "Notes", "TicketID";

	return $SortedAttributes;
}

sub GetStatTable
{
	my ($Self, %Param) = @_;
	my $SelectedValues = $Param{XValue}->{SelectedValues};

	my $NotesIdx = -1;

	for (my $i = 0; $i <= $#$SelectedValues; $i++) {
		if ($SelectedValues->[$i] eq "Notes") {
			$NotesIdx = $i;
			last;
		}
	}

	if ($NotesIdx >= 0) {
		push @$SelectedValues, "TicketID";
	}

	my @StatArray = $Self->SUPER::GetStatTable(%Param);

	if ($NotesIdx >= 0) {
		pop @$SelectedValues; # pop TicketID

		foreach my $ResultRow(@StatArray) {
			my $TicketID = pop @$ResultRow; # pop TicketID
			 my @ArticleIDs = $TicketObject->ArticleIndex(
				TicketID => $TicketID,
			);
			my @Bodys;
			foreach my $ArticleID(@ArticleIDs) {
				my %Article = $TicketObject->ArticleGet(
					ArticleID => $ArticleID,
					UserID => 1
				);
				my $Body = $Article{Body};
				$Body =~ s/\s+/ /g;
				push @Bodys, $Body;
			}
			$ResultRow->[$NotesIdx] = join(" ", @Bodys);
		}
	}

	return @StatArray;
}

1;
Und hier die Fehler Meldung

Code: Select all

Tue Feb 2 11:58:24 2016	error	OTRS-CGI-56	Global symbol "$TicketObject" requires explicit package name at /opt/otrs//Kernel/System/Stats/Dynamic/VPNTicketArticleList.pm line 82.
Tue Feb 2 11:58:24 2016	error	OTRS-CGI-56	???
Ich komme einfach nicht mehr weiter, kann mir eine Helfen?
OTRS :5
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: OTRS Statistiken

Post by RStraub »

Du versucht das TicketObject zu nutzen ohne es vorher zu initialisieren, bzw. zu "holen".

Probier mal vor die Zeilen in denen du es benutzt, diese zu setzen:

Code: Select all

 my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Rene68
Znuny newbie
Posts: 76
Joined: 09 Jun 2010, 14:37
Znuny Version: OTRS 6

Re: OTRS Statistiken

Post by Rene68 »

Klappt leider auch nicht gleicher Fehler.
OTRS :5
Rene68
Znuny newbie
Posts: 76
Joined: 09 Jun 2010, 14:37
Znuny Version: OTRS 6

Re: OTRS Statistiken

Post by Rene68 »

Hast du noch eine Idee??
OTRS :5
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: OTRS Statistiken

Post by RStraub »

Nein, tatsächlich nicht. Bin dafür schwer verwundert dass der Fehler bestehen bleibt, obwohl du nun das TicketObject hast...
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Locked