Commit b06e3bc4 authored by Timmer, Marius's avatar Timmer, Marius

Added missing POD; writing to stdout is optional now

parent 357175e3
......@@ -40,7 +40,8 @@ Exports all tickets and writes them into files.
QueueID => 1,
Filepath => './',
Attachments => 0,
Print => 1
Print => 1,
UserID => 1 # optional, default is 1 (root@localhost)
);
=cut
......@@ -118,7 +119,8 @@ sub Run {
if ($Self->{Attachments}) {
$Self->StoreAttachments(
TicketID => $TicketID,
FilePrefix => $Filepath . $QueueName .'_'. $TicketID .'_'. $TicketData{TicketNumber} .'_'
FilePrefix => $Filepath . $QueueName .'_'. $TicketID .'_'. $TicketData{TicketNumber} .'_',
Print => $Print
);
}
}
......@@ -133,21 +135,23 @@ called just like the exported ticket itself having the original file name
of the attachment at the end.
$Self->StoreAttachments(
TicketID => $TicketID,
FilePrefix => '/path/to/exports/filenameprefix'
TicketID => $TicketID,
FilePrefix => '/path/to/exports/filenameprefix',
Print => 1 # optional, 1 if the filenames and errors can be printed
# to console - Otherwise set this to 0
);
=cut
sub StoreAttachments {
my ($Self, %Param) = @_;
for my $Key (qw(TicketID FilePrefix)) {
for my $Key (qw(TicketID FilePrefix Print)) {
if (!$Param{$Key}) {
print STDERR sprintf('"%s" is required!', $Key);
return;
}
}
my $Print = $Param{Print};
my @TicketHistory = $Self->{TicketObject}->HistoryGet(
TicketID => $Param{TicketID},
UserID => $Self->{UserID}
......@@ -197,24 +201,35 @@ sub StoreAttachments {
Mode => 'binmode',
Permission => '644'
);
if ($WritingStatus) {
# Write a message to stdout that the attachment
# was exported into its file with success.
print STDOUT sprintf("\tWrote attachment to \"%s\"\n", $FileName);
} else {
# An unknown error occured while exporting the attachment
# into a file. Print out all data we have at this point.
print STDERR sprintf(
"\tCould not write file \"%s\" (%d bytes) of content type: %s\n",
$FileName,
$AttachmentData{FilesizeRaw},
$AttachmentData{ContentType}
);
}
if ($Print == 1) {
if ($WritingStatus) {
# Write a message to stdout that the attachment
# was exported into its file with success.
print STDOUT sprintf("\tWrote attachment to \"%s\"\n", $FileName);
} else {
# An unknown error occured while exporting the attachment
# into a file. Print out all data we have at this point.
print STDERR sprintf(
"\tCould not write file \"%s\" (%d bytes) of content type: %s\n",
$FileName,
$AttachmentData{FilesizeRaw},
$AttachmentData{ContentType}
);
}
}
}
}
}
=item CreatePDF()
Uses the native PDF package to create the binary PDF file content and returns it.
$Self->CreatePDF(
TicketID => 1
);
=cut
sub CreatePDF {
my ($Self, %Param) = @_;
......@@ -247,6 +262,15 @@ sub CreatePDF {
);
}
=item GetTicketList()
Executes the sql query to get all the ids of the tickets in a specific queue.
$Self->GetTicketList(
QueueID => 1
);
=cut
sub GetTicketList {
my ($Self, %Param) = @_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment