[rt-users] Follow-up question on Merge Ticket with existing ticket with the same subject

rmp dmd rmp.dmd1229 at gmail.com
Tue Aug 18 10:31:15 EDT 2009


Experts,

I hope you can help me on below.

I've been trying some modifications, but I could not get it working.


Thanks!
Roehl

On Mon, Aug 17, 2009 at 3:49 PM, rmp dmd <rmp.dmd1229 at gmail.com> wrote:

> Thanks for the help.  I was able to make the scrip below work.
>
> The scrip was able to merge new ticket with Subject: "Test Ticket Subject"
> to an existing ticket with the same subject.
>
> Just few more questions:
> - what to add on the scrip to ignore preceeding characters such as RE: and
> FWD:? A new ticket with subject: "RE:  Test Ticket Subject" to an existing
> ticket with the same subject
> - the scrip does not merge new ticket with subject: "** PROBLEM alert -
> Saturn backup server/DNS is CRITICAL **" to an existing ticket with the same
> subject. Is there a syntax that I need to add for this?
>
> All help will be greatly appreciated.
>
>
> 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;
>     $same_desc=$ticket->Subject;
>    #if ($same_desc eq $problem_desc){
>    if ($problem_desc eq $same_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;
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Fri, Aug 14, 2009 at 9:41 AM, Rémi <mirebob at gmail.com> wrote:
>
>> 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/20090818/9a751b19/attachment.htm>


More information about the rt-users mailing list