ticket attachment for reply [solved]

English! place to talk about development, programming and coding
Post Reply
thiloschaller
Znuny newbie
Posts: 3
Joined: 16 Jul 2012, 16:12
Znuny Version: 3.1.7
Real Name: Thilo Schaller

ticket attachment for reply [solved]

Post by thiloschaller »

Hallo,
i woud like to have the attachment of me original ticket in the normal answer ticket.
My customer don't want to use the forward ticket.
For this i program these lines into
AgentTicketCompose.pm

# get last customer article or selected article ...
my %Data=();
if ( $GetParam{ArticleID} ) {
%Data = $Self->{TicketObject}->ArticleGet(
ArticleID => $GetParam{ArticleID},
DynamicFields => 0,
);
}
else {
%Data = $Self->{TicketObject}->ArticleLastCustomerArticle(
TicketID => $Self->{TicketID},
DynamicFields => 0,
);
}


# add attachmens to upload cache
my %AttachmentIndex = $Self->{TicketObject}->ArticleAttachmentIndex( %Data, );
foreach (keys %AttachmentIndex) {
my %Attachment = $Self->{TicketObject}->ArticleAttachment(
ArticleID => $Data{ArticleID},
FileID => $_,
);

$Self->{UploadCachObject}->FormIDAddFile(
FormID => $Self->{FormID},
%Attachment,
);
}

this should get the attachment from the original Ticket, but it doesnt :(

Any idears or tips what i can change orh how does it work.

i use OTRS 3.1.7
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: ticket attachment for reply

Post by reneeb »

What does not work? Do you get any error message (in OTRS log or webserver log)?

There is a typo: You have "UploadCachObject" but it should be "UploadCacheObject"
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
thiloschaller
Znuny newbie
Posts: 3
Joined: 16 Jul 2012, 16:12
Znuny Version: 3.1.7
Real Name: Thilo Schaller

Re: ticket attachment for reply

Post by thiloschaller »

reneeb wrote:What does not work? Do you get any error message (in OTRS log or webserver log)?

There is a typo: You have "UploadCachObject" but it should be "UploadCacheObject"

Thanks for the typo, but this was not the error.
I get no error message, my problem is, that ich get no attachments with this part of the source code

# get last customer article or selected article ...
my %Data=();
if ( $GetParam{ArticleID} ) { %Data = $Self->{TicketObject}->ArticleGet(ArticleID => $GetParam{ArticleID},DynamicFields => 0,); }
else { %Data = $Self->{TicketObject}->ArticleLastCustomerArticle( TicketID => $Self->{TicketID}, DynamicFields => 0,);}

# add attachmens to upload cache
my %AttachmentIndex = $Self->{TicketObject}->ArticleAttachmentIndex( %Data, );

No Index returned with this call,
How can i get the attachments of the ticket like it is done in AgentTicketForward.

Sorry for ma late answer (hollidays :-))
thiloschaller
Znuny newbie
Posts: 3
Joined: 16 Jul 2012, 16:12
Znuny Version: 3.1.7
Real Name: Thilo Schaller

Re: ticket attachment for reply

Post by thiloschaller »

I found what im looking for
viewtopic.php?f=64&t=11893&p=46517&hili ... ent#p46517

1. i want the attachment of the first artikel,
2. i have to use the different parameter fpr ArticelAttachmentIndex

%Data = $Self->{TicketObject}->ArticleFirstArticle(
TicketID => $Self->{TicketID},
DynamicFields => 1,
);

# add attachmens to upload cache
my %AttachmentIndex = $Self->{TicketObject}->ArticleAttachmentIndex(
ArticleID => $Data{ArticleID},
UserID => $Self->{UserID},
Article => \%Data,
StripPlainBodyAsAttachment => 3,
);

now it works fine.
Post Reply