Re: [rt-users] Tickets from other Ticketsystem

2015-09-14 Thread Eierschmalz, Bernhard
Hello Kevin,

I found a solution on my own now - maybe interesting for somebody.
Quick discription:
1. I recognize the external ticket number with regex from subject and write 
this number to a Custom Field
2. search for existing tickets with same value in same Custom Field and merge 
the tickets

Now how I did: 

Step 1: create a custom field for all queues used for the external ticket 
number.

Step 2: Create the following Scrip:

CustomIsApplicableCode: (at this part we check with if a ticket is created from 
a valid address with a valid regex-syntax for external ticket system)
# only on creating tickets
return 0 unless $self->TransactionObj->Type eq "Create";

my $subject = $self->TransactionObj->Subject;
return 0 unless defined($subject);

# mail-addresses from other ticket systems
my @ticketsender = ('...'); #<-- this is an array of addresses or parts 
of addresses wich are recognized for other ticketsystem-verification.

my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);

if ( $subject =~ / \[plus ticket\d{8}\]/) #<-- regex-code for other 
external ticket numbers in message subject
{
  foreach (@ticketsender)
  {
 if ($ticketRequestor =~ /$_/) #<-- check if sender is permitted
 {
   return 1;
 }
  }
}
return 0; 


CustomPrepareCode (at this part we write the external ticket number to the 
custom field)
my $subject = $self->TransactionObj->Subject;

$subject =~ s/.*\[plus ticket//;
my $cfval = "PLUS".substr($subject,0,8); # <-- cfval contains the Value 
number of the external ticket plus some first letters to identify - this is to 
be able to add more external ticket numbers

# write to CustomField
my $cf = RT::CustomField->new ( $RT::SystemUser );
$cf->Load('21'); #<-- ID of the custom field from step 1
$self->TicketObj->AddCustomFieldValue ( Field => $cf, Value => $cfval );
return 1;



CustomCommitCode (at this part we search for already existing tickets with same 
CF and merge them)


my $extnr = $self->TicketObj->FirstCustomFieldValue('21'); #<-- load 
the custom field value

# find all the ticket  to the reference number from ticketsystem
my $search = new RT::Tickets(RT->SystemUser);
$search->LimitCustomField(CUSTOMFIELD => '21', OPERATOR => '=', VALUE 
=> $extnr);

while (my $ticket = $search->Next)
{
# ignore if finding the new ticket itself
next if $self->TicketObj->Id == $ticket->Id;

my $id = $ticket->Id;

# Logging
$RT::Logger->info("Merging ticket " . $self->TicketObj->Id . " into 
$id because of Reference number $extnr match.");

# merge Tickets
$self->TicketObj->MergeInto($id);
}


best regards,
Bernhard



-Ursprüngliche Nachricht-
Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im Auftrag von 
Eierschmalz, Bernhard
Gesendet: Montag, 11. Mai 2015 10:44
An: rt-users@lists.bestpractical.com
Cc: falc...@bestpractical.com
Betreff: Re: [rt-users] Tickets from other Ticketsystem

Hello Kevin,

I know this is a very old mail below. I didn't install the plugin in this 
times, because it was not so urgent.
But now I have the same problem again.

I read about the extension you mentioned. But I think there is one problem.
What I understood about the extension is:
- when there is a new mail to an existing resolved ticket with defined ticket 
number
- open a new ticket


What I need is the following
- when there is a new mail to a new ticket AND the subject is starting with 
defined syntax
- check if there is any ticket with almost the same subject
- attach the new mail to the existing ticket instead of opening a new one.


So the difference is that the extension searches for a ticket with defined 
number - what I need is to search for any existing ticket with a defined syntax.

Are you sure the extension would work in my case?
Can you tell me how to use it?


Best regards
Bernhard


-Ursprüngliche Nachricht-
Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im Auftrag von 
Kevin Falcone
Gesendet: Mittwoch, 3. September 2014 22:34
An: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Tickets from other Ticketsystem

On Mon, Aug 25, 2014 at 08:27:00AM +, Eierschmalz, Bernhard wrote:
> Hello Kevin,
> 
> I already thought about creating a scrip like
> Condition:
> Transaction obj = "create"
> Subject contains "[plus ticket#"
> 
> Action:
> Search tickets with same plus-ticket no.
> If one exists, combine
> 
> What do you think about this solution

Re: [rt-users] Tickets from other Ticketsystem

2015-05-11 Thread Eierschmalz, Bernhard
Hello Kevin,

I know this is a very old mail below. I didn't install the plugin in this 
times, because it was not so urgent.
But now I have the same problem again.

I read about the extension you mentioned. But I think there is one problem.
What I understood about the extension is:
- when there is a new mail to an existing resolved ticket with defined ticket 
number
- open a new ticket


What I need is the following
- when there is a new mail to a new ticket AND the subject is starting with 
defined syntax
- check if there is any ticket with almost the same subject
- attach the new mail to the existing ticket instead of opening a new one.


So the difference is that the extension searches for a ticket with defined 
number - what I need is to search for any existing ticket with a defined syntax.

Are you sure the extension would work in my case?
Can you tell me how to use it?


Best regards
Bernhard


-Ursprüngliche Nachricht-
Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im Auftrag von 
Kevin Falcone
Gesendet: Mittwoch, 3. September 2014 22:34
An: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Tickets from other Ticketsystem

On Mon, Aug 25, 2014 at 08:27:00AM +, Eierschmalz, Bernhard wrote:
 Hello Kevin,
 
 I already thought about creating a scrip like
 Condition:
 Transaction obj = create
 Subject contains [plus ticket#
 
 Action:
 Search tickets with same plus-ticket no.
 If one exists, combine
 
 What do you think about this solution? Or would you prefer the strongly 
 modified plugin?
 

Scrip runs after the second ticket is created and sends email.  You then Merge 
it.
The plugin never allows the second ticket to be created.

-kevin

 
 
 -Ursprüngliche Nachricht-
 Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im 
 Auftrag von Kevin Falcone
 Gesendet: Freitag, 22. August 2014 16:01
 An: rt-users@lists.bestpractical.com
 Betreff: Re: [rt-users] Tickets from other Ticketsystem
 
 On Tue, Aug 19, 2014 at 05:36:04AM +, Eierschmalz, Bernhard wrote:
  we have one customer using its own ticket system. This customer 
  sends us mails with an information about his own ticket in the subject.
  
  i.e. [PLUS.DE Ticket#PD077994]
  
  sometimes when this customer answers, he doesn’t send our ticket 
  number in subject, so he opens a new ticket.
  
  Is it possible to identify a mail by this PLUS ticket number and add 
  to our already opened ticket instead of open a new one?
 
 Look at the code in
 https://github.com/bestpractical/rt-extension-repliestoresolved
 
 The function it hooks can be used to lie to RT and return a ticket id of the 
 existing ticket (as opposed to what this extension does, which is suppress 
 the ticket id so that a new ticket will be created).
 
 -kevin
 --
 RT Training - Boston, September 9-10
 http://bestpractical.com/training


Re: [rt-users] Tickets from other Ticketsystem

2014-09-03 Thread Kevin Falcone
On Mon, Aug 25, 2014 at 08:27:00AM +, Eierschmalz, Bernhard wrote:
 Hello Kevin,
 
 I already thought about creating a scrip like
 Condition:
 Transaction obj = create
 Subject contains [plus ticket#
 
 Action:
 Search tickets with same plus-ticket no.
 If one exists, combine
 
 What do you think about this solution? Or would you prefer the strongly 
 modified plugin?
 

Scrip runs after the second ticket is created and sends email.  You
then Merge it.
The plugin never allows the second ticket to be created.

-kevin

 
 
 -Ursprüngliche Nachricht-
 Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im Auftrag 
 von Kevin Falcone
 Gesendet: Freitag, 22. August 2014 16:01
 An: rt-users@lists.bestpractical.com
 Betreff: Re: [rt-users] Tickets from other Ticketsystem
 
 On Tue, Aug 19, 2014 at 05:36:04AM +, Eierschmalz, Bernhard wrote:
  we have one customer using its own ticket system. This customer sends 
  us mails with an information about his own ticket in the subject.
  
  i.e. [PLUS.DE Ticket#PD077994]
  
  sometimes when this customer answers, he doesn’t send our ticket 
  number in subject, so he opens a new ticket.
  
  Is it possible to identify a mail by this PLUS ticket number and add 
  to our already opened ticket instead of open a new one?
 
 Look at the code in
 https://github.com/bestpractical/rt-extension-repliestoresolved
 
 The function it hooks can be used to lie to RT and return a ticket id of the 
 existing ticket (as opposed to what this extension does, which is suppress 
 the ticket id so that a new ticket will be created).
 
 -kevin
 -- 
 RT Training - Boston, September 9-10
 http://bestpractical.com/training


pgpcd1u6T0stv.pgp
Description: PGP signature
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Re: [rt-users] Tickets from other Ticketsystem

2014-08-25 Thread Eierschmalz, Bernhard
Hello Kevin,

I already thought about creating a scrip like
Condition:
Transaction obj = create
Subject contains [plus ticket#

Action:
Search tickets with same plus-ticket no.
If one exists, combine

What do you think about this solution? Or would you prefer the strongly 
modified plugin?


Best regards
Bernhard


-Ursprüngliche Nachricht-
Von: rt-users [mailto:rt-users-boun...@lists.bestpractical.com] Im Auftrag von 
Kevin Falcone
Gesendet: Freitag, 22. August 2014 16:01
An: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Tickets from other Ticketsystem

On Tue, Aug 19, 2014 at 05:36:04AM +, Eierschmalz, Bernhard wrote:
 we have one customer using its own ticket system. This customer sends 
 us mails with an information about his own ticket in the subject.
 
 i.e. [PLUS.DE Ticket#PD077994]
 
 sometimes when this customer answers, he doesn’t send our ticket 
 number in subject, so he opens a new ticket.
 
 Is it possible to identify a mail by this PLUS ticket number and add 
 to our already opened ticket instead of open a new one?

Look at the code in
https://github.com/bestpractical/rt-extension-repliestoresolved

The function it hooks can be used to lie to RT and return a ticket id of the 
existing ticket (as opposed to what this extension does, which is suppress the 
ticket id so that a new ticket will be created).

-kevin
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Re: [rt-users] Tickets from other Ticketsystem

2014-08-22 Thread Kevin Falcone
On Tue, Aug 19, 2014 at 05:36:04AM +, Eierschmalz, Bernhard wrote:
 we have one customer using its own ticket system. This customer sends us mails
 with an information about his own ticket in the subject.
 
 i.e. [PLUS.DE Ticket#PD077994]
 
 sometimes when this customer answers, he doesn’t send our ticket number in
 subject, so he opens a new ticket.
 
 Is it possible to identify a mail by this PLUS ticket number and add to our
 already opened ticket instead of open a new one?

Look at the code in
https://github.com/bestpractical/rt-extension-repliestoresolved

The function it hooks can be used to lie to RT and return a ticket
id of the existing ticket (as opposed to what this extension does,
which is suppress the ticket id so that a new ticket will be created).

-kevin


pgpBS2JDPvdsM.pgp
Description: PGP signature
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

[rt-users] Tickets from other Ticketsystem

2014-08-18 Thread Eierschmalz, Bernhard
Hello,

we have one customer using its own ticket system. This customer sends us mails 
with an information about his own ticket in the subject.
i.e. [PLUS.DE Ticket#PD077994]

sometimes when this customer answers, he doesn't send our ticket number in 
subject, so he opens a new ticket.
Is it possible to identify a mail by this PLUS ticket number and add to our 
already opened ticket instead of open a new one?

Best regards
bernhard
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training