[rt-users] Merge Ticket with existing ticket with the same subject

Rémi mirebob at gmail.com
Fri Aug 14 09:41:04 EDT 2009


hi
try using $TicketObj->SetSubject() function,

$TicketObj->Subject is just an accessor method

Rémi


2009/8/13 rmp dmd <rmp.dmd1229 at gmail.com>

> Hi,
>
> I'm using the scrip below to merge newly created ticket with existing
> ticket with the same subject. However, im getting
>
> Scrip 36 Commit failed: Can't modify non-lvalue subroutine call at (eval
> 1311) line 21.
>
> code for line 21 is :
> $ticket->Subject = $same_desc;
>
> Im not exactly sure what the error means. Please help in making the scrip
> work.
>
>
> Thanks!
>
>
>
> ====
>
> my $problem_desc = undef;
> my $Transaction = $self->TransactionObj;
> my $subject = $Transaction->Attachments->First->GetHeader('Subject');
> $problem_desc = $subject;
> $RT::Logger->debug("This is the subject to match: $problem_desc");
> # look for subject on existing tickets
> my $search = RT::Tickets->new($RT::SystemUser);
> $search->LimitQueue(VALUE => 'IT');
> $search->LimitStatus(VALUE => 'new', OPERATOR => '=', ENTRYAGGREGATOR =>
> 'or');
> $search->LimitStatus(VALUE => 'open', OPERATOR => '=');
> if ($search->Count == 0) { return 1; }
> my $id = undef;
> my $same_desc = undef;
> while (my $ticket = $search->Next) {
>     # Ignore this ticket that opened this transaction
>     next if $self->TicketObj->Id == $ticket->Id;
>     $ticket->Subject = $same_desc;
>     if ($same_desc eq $problem_desc){
>        # Found the same subject
>        $RT::Logger->debug("SAME $same_desc and $problem_desc");
>        $id = $ticket->Id;
>        $RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . " into
> $id because of OA number match.");
>        $self->TicketObj->MergeInto($id);
>     }
> }
> $id || return 1;
> 1;
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090814/8b7819b3/attachment.htm>


More information about the rt-users mailing list