Merge Ticket with existing ticket with the same subject

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;

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

$TicketObj->Subject is just an accessor method

Rémi2009/8/13 rmp dmd rmp.dmd1229@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@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com