Re: [rt-users] saved search as a drag and drop board (kanban ajax)

2016-09-01 Thread Vegard Vesterheim
On Wed, 31 Aug 2016 23:15:57 +0200 akos.to...@docca.hu wrote:

> If anyone interested, just let us know - to give us more motivation :)

This looks very interesting. Please keep us posted about the progress.

-- 
- Vegard V -
-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Boston - October 24-26
* Los Angeles - Q1 2017


Re: [rt-users] Alternative GUIs for RT?

2016-06-07 Thread Vegard Vesterheim
On Wed, 1 Jun 2016 15:17:15 +0200 Christian Loos <cl...@netcologne.de> wrote:

> Am 01.06.2016 um 11:53 schrieb Vegard Vesterheim:
>> I tried to register a new User Custom Field, naming the Field
>> 'PreferEditDisplay', and allowing two values for the field: 'Edit' or
>> 'Display'. I have registered the value 'Edit' for a specific user for
>> this Custom Field, but I am not able to extract the value
>> programmatically. I expected the following code to work, but I get no
>> values back.
>> 
>> my $UserObj = RT::User->new( $session{'CurrentUser'} );
>> my $cf_values = $UserObj->CustomFieldValues('PreferEditDisplay');
>
>
> You can easily add custom user preferences.
> Have a look here:
> https://github.com/tbrumm/RT-Extension-SideBySideView/blob/master/lib/RT/Extension/SideBySideView.pm#L9-L17

Ah, this is much better than using a User Custom Field, since this is a
custom user preference after all. Thank you.

> This new preference is used here:
> https://github.com/tbrumm/RT-Extension-SideBySideView/blob/master/html/Callbacks/SideBySideView/Ticket/Display.html/BeforeShowSummary#L15

I ended up using the EachRow callback from CollectionList. I sneakingly
alter the link for the Ticket landing page (from Display.html to our
local Edit.html) according to the user preference.

The callback hooks in RT is *very* useful for doing these sorts of
hacks;-)

-- 
- Vegard V -
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Alternative GUIs for RT?

2016-06-01 Thread Vegard Vesterheim
On Wed, 1 Jun 2016 12:01:10 +0200 Emmanuel Lacour <elac...@easter-eggs.com> 
wrote:

> Le 01/06/2016 11:53, Vegard Vesterheim a écrit :
>> 
>> 
>> I tried to register a new User Custom Field, naming the Field
>> 'PreferEditDisplay', and allowing two values for the field: 'Edit' or
>> 'Display'. I have registered the value 'Edit' for a specific user for
>> this Custom Field, but I am not able to extract the value
>> programmatically. I expected the following code to work, but I get no
>> values back.
>> 
>> my $UserObj = RT::User->new( $session{'CurrentUser'} );
>> my $cf_values = $UserObj->CustomFieldValues('PreferEditDisplay');
>> 
>
> You just wan't:
>
> my $cf_value = $UserObj->FirstCustomFieldValue('PreferEditDisplay');
>
> I think.

Yes, but I had tried that as well, same result.

I found a solution, I think the problem was related to loading the
correct User Object.

The following works:

my $UserObj = $session{'CurrentUser'}->UserObj;
my $cf_value = $UserObj->FirstCustomFieldValue('PreferEditDisplay');

I would have thought that
  RT::User->new($session{'CurrentUser'})
and
  $session{'CurrentUser'}->UserObj

would be equivalent, but apparently not.

Thanks for the hint.

-- 
- Vegard V -
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Alternative GUIs for RT?

2016-06-01 Thread Vegard Vesterheim
On Thu, 10 Mar 2016 14:36:12 +0100 Vegard Vesterheim 
<vegard.vesterh...@uninett.no> wrote:

> Some of our users find the RT web gui complex, and also ineffective for
> some use-cases. I have been tasked to investigate alternative GUIs
> for RT.
>
> The "criticism" relates to the fact that some fields are irrelevant for
> some users and should be possible to suppress, and also that the default
> ticket display does not allow editing the fields directly. We are
> considering creating a new ticket display page which combines the
> contents from Basics (Ticket/Modify.html) and History
> (Ticket/History.html). This is fairly easy to implement, I guess.

We have now implemented a variant of the Jumbo edit page, calling it
./local/html/Ticket/Edit.html. The idea is to allow this page to be used
as the default ticket display page (instead of Ticket/Display.html).

The user can now edit the ticket directly, having access to the ticket
history in the same page. We need to test this functionality a bit more,
but I wonder if something like this could be considered for inclusion
into RT.

> Maybe one could even add a user preference for default ticket display
> page.

I tried to register a new User Custom Field, naming the Field
'PreferEditDisplay', and allowing two values for the field: 'Edit' or
'Display'. I have registered the value 'Edit' for a specific user for
this Custom Field, but I am not able to extract the value
programmatically. I expected the following code to work, but I get no
values back.

my $UserObj = RT::User->new( $session{'CurrentUser'} );
my $cf_values = $UserObj->CustomFieldValues('PreferEditDisplay');

I tried to enable DBI tracing, expecting to observe some relevant
SELECT-statements from the objectcustomfieldvalues table, but there are
none.

rt4=> select content, disabled from objectcustomfieldvalues where 
customfield=(select id from customfields where name='PreferEditDisplay');
 content | disabled 
-+--
 Edit|1
 Display |1
 Edit|0


Any hints on how to extract custom field values for a specific custom
field, and a specific User object?

-- 
- Vegard V -
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Alternative GUIs for RT?

2016-04-01 Thread Vegard Vesterheim
On Thu, 31 Mar 2016 17:44:55 +0200 akos.to...@docca.hu wrote:

> We don't know if our coding style and quality is okay for RT or not, and we
> are not familiar how to share this plugins on github or so. So we use these
> in house, but we could give you access to our test system, you can try it,
> and if you find useful we could send you the code for 3.8 (and the 4.2 as
> well but it is not in everyday use).

This looks promising, with funtionality along the same lines that we
have been contemplating. We would be very interested in having a look at
the code, and also possibly finding a way to continue
sharing/co-developing.this further. Please consider putting this on
Github or a similar hosting service.

 - Vegard V -
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


[rt-users] Alternative GUIs for RT?

2016-03-10 Thread Vegard Vesterheim
Some of our users find the RT web gui complex, and also ineffective for
some use-cases. I have been tasked to investigate alternative GUIs
for RT.

The "criticism" relates to the fact that some fields are irrelevant for
some users and should be possible to suppress, and also that the default
ticket display does not allow editing the fields directly. We are
considering creating a new ticket display page which combines the
contents from Basics (Ticket/Modify.html) and History
(Ticket/History.html). This is fairly easy to implement, I guess. Maybe
one could even add a user preference for default ticket display page.

BTW, I am aware of the Jumbo option, and I also know that the latest
version (4.4) can suppress display of unused fields. The mobile UI is
also a possible solution to the complexity concern.

My questions to the list, however, are of a more general nature:

  Has anyone considered/implemented/used any alternative GUIs for
  manipulating RT tickets?

-- 
- Vegard V -
-
RT 4.4 and RTIR Training Sessions 
(http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Making original email a true attachment in AdminCC notifications

2016-03-09 Thread Vegard Vesterheim
On Tue, 14 Jun 2011 15:22:56 -0400 Kevin Falcone  
wrote:

> On Tue, Jun 14, 2011 at 01:26:38PM -0400, Paul Fincher wrote:
>>I have been looking into changing the notification emails that are 
>> delivered to AdminCcs
>>when a ticket is created to have the original email from the requestor be 
>> a true
>>message/rfc822 attachment instead of the original content inlined in the 
>> AdminCc email.  It
>>doesn't appear you can do this directly in the template but instead It 
>> appears it requires a
>>change to the action code.  Has anyone done anything like this? Am I 
>> barking up the wrong
>>tree? I am using RT 3.8.9.
>
> You'd need to steal from some of the forwarding code and write a custom
> action to make it message/rfc822. Doing it inline in the template
> doesn't work.

I searched the RT-users archive for the wording "original email" and
found this old thread.

We would like to do something similar now: attach the original email (in
its entirety, attachments and all) to an outgoing message in
RT. Creating a 'message/rfc822' attachments seems like a natural choice.

When a ticket changes queue, we notify the new adminCCs via a
scrip/template. It would be useful to have the original mail attached to
this outgoing message. We would like to do the same when a ticket
changes owner. The rationale for doing this, is to be able to respond to
the ticket directly via email, without having to visit the RT web-gui.

We have done something similar in another context earlier. We archive
all emails into individual files (via procmail) *before* being piped
into RT. Using the Message-ID as identifiers, we can retrieve the exact
copy of the original email message. We use this as a simple way to
"forward" the original email to external parties from our RT
installation. We implemented this as a "dummy queue" with a
corresponding scrip. For tickets moved into this queue, we simply
retrieve the original email from the archive (grep'ing for the
message-id), and resend it to the external party. 

This same solution can be used in our new use-case, but I was wondering
if this could be accomplished inside RT, and if so, if somebody else has
done this before.

-- 
- Vegard V -
-
RT 4.4 and RTIR Training Sessions 
(http://bestpractical.com/services/training.html)
* Hamburg Germany - March 14 & 15, 2016
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Report for original queue count

2015-01-22 Thread Vegard Vesterheim
On Tue, 6 Jan 2015 14:36:32 -0500 Hamilton T. Preston 
hamiltontpres...@gmail.com wrote:

 How would I write a report to count the number of tickets created in a
 queue? Many of our tickets are moved to other queues and I don't know
 how to get counts on the original queue the ticket was created in.

I am tasked with a similar problem. My approach is to search for
Transactions where the Queue Field has been changed, something like
this:

- snip - snip -
my $queuename = 'myqueue';
CleanEnv();
RT::LoadConfig();
RT::Init();
my $user = RT-SystemUser;
my $queue = new RT::Queue($user);
$queue-Load($queuename);

my $objs = RT::Transactions-new( $user );

$objs-Limit( FIELD = 'ObjectType', VALUE = RT::Ticket, ENTRYAGGREGATOR = 
'AND');
$objs-Limit( FIELD = 'Field',  VALUE = Queue,  ENTRYAGGREGATOR = 
'AND' );
$objs-Limit( FIELD = 'OldValue',   VALUE = $queue-Id,   ENTRYAGGREGATOR = 
'AND' );
$objs-OrderBy( FIELD = 'Created');
my $ticket = RT::Ticket-new($user);
while (my $t = $objs-Next) {
$ticket-Load ($t-ObjectId);
}

- snip - snip -

This is a sledgehammer approach, I know. If you have a many
tickets/transactions, the query could take a long time. 

In my case I want to restrict the search to a given timeperiod, aka: How
many tickets where moved out of queue foo yesterday)

Hope this helps.

 - Vegard V -


Re: [rt-users] Duplicate ticket detection at OnCreate

2015-01-22 Thread Vegard Vesterheim
On Thu, 22 Jan 2015 16:48:13 -0500 Kevin Falcone falc...@bestpractical.com 
wrote:

 Heck, you could filter at the mail level using bin/rt to search for
 tickets and blackhole mail from getting to RT if you find tickets with
 the same subject.

Yes, we do exactly that for a similar case, it works nicely. 

We use procmail to pipe the mail message through a script that calls
bin/rt looking for existing ticket with similar subjects. In our case
we want to merge the new message into the existing ticket, so we simply
alter the Subject header adding the RT ticket number, something like this:

my $rt_cli = '/usr/local/bin/rt';
my $timeout_cmd = '/usr/bin/timeout';

my $ticket_response = `$timeout_cmd 5 $rt_cli ls -i -t ticket Subject like 
whatever-you-like`;
if (my ($ticket) = $ticket_response =~ m!^ticket/(\d+)\s*!) {
  printf STDERR Found existing RT-ticket $ticket\n if $debug;
  $in_subject .=  [example.org #${ticket}];
}

You could, of course ,skip the message altogether.

 - Vegard V -


Re: [rt-users] Report for original queue count

2015-01-22 Thread Vegard Vesterheim
On Thu, 22 Jan 2015 16:34:50 -0500 Kevin Falcone falc...@bestpractical.com 
wrote:

 On Thu, Jan 22, 2015 at 11:25:28AM +0100, Vegard Vesterheim wrote:
 my $ticket = RT::Ticket-new($user);
 while (my $t = $objs-Next) {
 $ticket-Load ($t-ObjectId);
 }

 You may appreciate my $ticket = $t-Object as a shortcut

Ah, much preferred, thanks for the tip.

 This is a sledgehammer approach, I know. If you have a many
 tickets/transactions, the query could take a long time. 

 You may benefit from additional indexes, if this is something you do
 frequently (or the database slow query logs tell you when you hit
 that).

Yup. In my case this isn't a problem, but it might be for others.

 In my case I want to restrict the search to a given timeperiod, aka: How
 many tickets where moved out of queue foo yesterday)

 It wasn't clear from your code if you know how to do that in the
 query, or if you're just stopping the iteration when you get far
 enough back.

In my own version of the script, I have additional code for limiting
against 'Created'. The original poster did not seem to have similar
requirements, so I left that out from the example.

 - Vegard V -



[rt-users] Automatic generation of RTAddressRegexp, is that feasible ?

2014-03-14 Thread Vegard Vesterheim
One of the things I find cumbersome when establishing/removing RT
Queues, is to update the RTAddressRegexp variable.

I hacked the script generate-rtaddresregexp so that I can supply a set
of extra email addresses which our RT queues are accessible via. Whenever
we add a queue, I temporarily remove RTAddressRegexp from the configuration,
run this script, and do an cut-and-paste of the result into the
configuration.

I was thinking that the set of extra email addresses could be added to
the configuration, and then the process of generating RTAddressRegexp
could be done automatically by RT itself.

Is this feasible, or are there any other ways of simplifying this task?

 - Vegard V -
-- 
RT Training London, March 19-20 and Dallas May 20-21
http://bestpractical.com/training


[rt-users] Having 'On Correspond Notify Owner' as default

2014-02-06 Thread Vegard Vesterheim
I added a scrip 'On Correspond Notify Owner', that notifies the owner of
a ticket when he/she is *not* among the AdminCCs. The change was simple
enough to add. 

The default behaviour seems counter-intuitive. Are there any good
reasons for not doing this be default?

 - Vegard V -


Re: [rt-users] Slow query on CFs

2013-06-05 Thread Vegard Vesterheim
On Tue, 4 Jun 2013 17:30:02 +0400 Ruslan Zakirov r...@bestpractical.com wrote:

 Hi,

 It's not a bug, but missing feature. 

Hm, ok. This problem makes searching for multiple values in CFs unusable
for our purposes. I would like to help in getting it fixed. For now I
have worked around it by searching for one CF value at a time in a
loop. Seems a bit silly since this is something SQL could handle easily.

Should I register this as a feature request somewhere, or is this
something that is already on the map?

 It's possible to improve using similar improvements to searches by
 watchers. If you want to help then you can take a look at recent
 changes in lib/RT/Tickets_SQL.pm.

Yes, I had a quick look at the relevant git commits. I guess the problem
is similar. 

 - Vegard V -


-- 
RT Training in Seattle, June 19-20: http://bestpractical.com/training


Re: [rt-users] Slow query on CFs

2013-06-05 Thread Vegard Vesterheim
On Tue, 04 Jun 2013 07:47:02 -0700 Thomas Sibley t...@bestpractical.com wrote:

 I'm sure you've considered this, but I have to ask: Could you simplify
 most of the CF conditions with CF.{utstyr} ENDSWITH '.uninett.no'?

Thanks for the suggestion, but no, that will not give me the result I am
after.

 - Vegard V -


-- 
RT Training in Seattle, June 19-20: http://bestpractical.com/training


[rt-users] Tip on making mailto-links from transactions

2013-06-05 Thread Vegard Vesterheim
I just added the following to the wiki:

I hate using a web browser for composing mail. I much prefer to use my
regular email client when responding to RT tickets. However, browsing
ticket history is better done in a web brower. I wanted to combine these
needs.

Using the brilliant callback-mechanism in RT, I insert some mailto
hyperlinks at the top of each Transaction in RT, when clicked, an email
response is generated in my email client ready to be edited.

I simply created the file
/html/Callbacks/COMPANY/Ticket/Elements/ShowTransaction/AfterDescription
in my local RT directory: 

- snip - snip -
% if ($Transaction-Type eq 'Correspond' or $Transaction-Type eq 'Comment' or 
$Transaction-Type eq 'Create') {
| a href=mailto:% $Ticket-QueueObj-CorrespondAddress %?subject=% 
$subject|u%references=% $message_id|nu %body=% $content | un%Email 
reply/a
| a href=mailto:% $Ticket-QueueObj-CommentAddress %?subject=% 
$subject|u%references=% $message_id|nu %body=% $content | un%Email 
comment/a
% }
%init
my $Ticket = $Transaction-TicketObj;
my $subject = [.$RT::Config-Get('rtname'). #.$Ticket-Id.] 
.$Ticket-Subject;
my $content = $Transaction-Content('Quote' = 1, 'Wrap' = 75, 'Type' = 
'text/plain');
my $message_id = $Transaction-Message-First-GetHeader ('Message-ID') if 
$Transaction-Message-First;
/%init

%args
$Transaction
/%args
- snip - snip -


-- 
RT Training in Seattle, June 19-20: http://bestpractical.com/training


[rt-users] Slow query on CFs

2013-06-04 Thread Vegard Vesterheim
A RT (TicketSQL) query like this:

Queue = 'drift' AND (  Status = 'new' or Status = 'open' or Status =
'stalled' ) AND (  CF.{utstyr} = 'ufisaweb.uninett.no' OR CF.{utstyr} =
'dss2.uninett.no' OR CF.{utstyr} = 'myrhauk.uninett.no' OR CF.{utstyr} =
'angel.uninett.no' OR CF.{utstyr} = 'jatoba-esxi2.uninett.no' OR
CF.{utstyr} = 'bold.uninett.no' OR CF.{utstyr} = 'nidar.uninett.no' OR
CF.{utstyr} = 'voll.uninett.no' OR CF.{utstyr} = 'brekka.uninett.no' OR
CF.{utstyr} = 'www.stroemme.no' OR CF.{utstyr} = 'xen.uninett.no' OR
CF.{utstyr} = 'jatoba-kvm4.uninett.no' OR CF.{utstyr} =
'inventory.uninett.no' OR CF.{utstyr} = 'busy.uninett.no' OR CF.{utstyr}
= 'ufisa.uninett.no' OR CF.{utstyr} = 'wildfire.uninett.no' OR
CF.{utstyr} = 'newfire.uninett.no' OR CF.{utstyr} = 'fou1.uninett.no' OR
CF.{utstyr} = 'kanari.uninett.no' OR CF.{utstyr} = 'dok.uninett.no' OR
CF.{utstyr} = 'ebony-kvm5.uninett.no' OR CF.{utstyr} =
'jatoba-kvm12.uninett.no' )

gets translated to the following SQL:

SELECT COUNT(DISTINCT main.id) FROM Tickets main LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_5 ON (
ObjectCustomFieldValues_5.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_5.Disabled = '0' ) AND (
ObjectCustomFieldValues_5.ObjectId = main.id ) AND (
ObjectCustomFieldValues_5.CustomField = '8' ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_3 ON (
ObjectCustomFieldValues_3.CustomField = '8' ) AND (
ObjectCustomFieldValues_3.Disabled = '0' ) AND (
ObjectCustomFieldValues_3.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_3.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_22 ON (
ObjectCustomFieldValues_22.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_22.CustomField = '8' ) AND (
ObjectCustomFieldValues_22.Disabled = '0' ) AND (
ObjectCustomFieldValues_22.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_19 ON (
ObjectCustomFieldValues_19.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_19.CustomField = '8' ) AND (
ObjectCustomFieldValues_19.Disabled = '0' ) AND (
ObjectCustomFieldValues_19.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_10 ON (
ObjectCustomFieldValues_10.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_10.CustomField = '8' ) AND (
ObjectCustomFieldValues_10.Disabled = '0' ) AND (
ObjectCustomFieldValues_10.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_4 ON (
ObjectCustomFieldValues_4.Disabled = '0' ) AND (
ObjectCustomFieldValues_4.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_4.CustomField = '8' ) AND (
ObjectCustomFieldValues_4.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_8 ON (
ObjectCustomFieldValues_8.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_8.CustomField = '8' ) AND (
ObjectCustomFieldValues_8.ObjectId = main.id ) AND (
ObjectCustomFieldValues_8.Disabled = '0' ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_21 ON (
ObjectCustomFieldValues_21.CustomField = '8' ) AND (
ObjectCustomFieldValues_21.Disabled = '0' ) AND (
ObjectCustomFieldValues_21.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_21.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_12 ON (
ObjectCustomFieldValues_12.CustomField = '8' ) AND (
ObjectCustomFieldValues_12.Disabled = '0' ) AND (
ObjectCustomFieldValues_12.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_12.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_16 ON (
ObjectCustomFieldValues_16.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_16.Disabled = '0' ) AND (
ObjectCustomFieldValues_16.CustomField = '8' ) AND (
ObjectCustomFieldValues_16.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_17 ON (
ObjectCustomFieldValues_17.Disabled = '0' ) AND (
ObjectCustomFieldValues_17.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_17.CustomField = '8' ) AND (
ObjectCustomFieldValues_17.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_20 ON (
ObjectCustomFieldValues_20.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_20.CustomField = '8' ) AND (
ObjectCustomFieldValues_20.Disabled = '0' ) AND (
ObjectCustomFieldValues_20.ObjectId = main.id ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_13 ON (
ObjectCustomFieldValues_13.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_13.Disabled = '0' ) AND (
ObjectCustomFieldValues_13.ObjectId = main.id ) AND (
ObjectCustomFieldValues_13.CustomField = '8' ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_2 ON (
ObjectCustomFieldValues_2.Disabled = '0' ) AND (
ObjectCustomFieldValues_2.ObjectId = main.id ) AND (
ObjectCustomFieldValues_2.ObjectType = 'RT::Ticket' ) AND (
ObjectCustomFieldValues_2.CustomField = '8' ) LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_9 ON (

[rt-users] Linking foreign tickets to RT tickets

2011-11-23 Thread Vegard Vesterheim
We would like to implement automatic handling of email messages with
foreign tickets in our RT installation. 

When we get an email message containing a foreign ticket-id, we will
create a new RT ticket in our system, taken special care to register the
foreign ticket-id. When we get an email message with updated information
about a previously seen foreign ticket-id, we will append/merge this
into the existing RT ticket in our system. Ticket resolution could be
automatic as well.

I found this solution on the wiki, which implements a similar idea. 
http://requesttracker.wikia.com/wiki/AutoCloseOnNagiosRecoveryMessages

We would like this to be handled in a generic way. In principle one
ticket in our RT system can refer to several other tickets on different
foreign ticket systems. The first question is how to store the foreign
ticket-id. One possibility is to use one of the Links fields in RT,
another is to create a specific multivalued custom field. 

I guess this is a common use-case, and it could probably be implemented
in a generic way, maybe even as an RT extension. I am wondering if
someone has done something like this already.

 - Vegard V -

RT Training Sessions (http://bestpractical.com/services/training.html)
*  Barcelona, Spain  November 28  29, 2011


[rt-users] Rights problem in RT

2011-09-08 Thread Vegard Vesterheim
We have noticed that some pages in our RT-3.8.8 installation have
started to load slowly. It turns out that on pages which presents a menu
for Ticket Owner, the menu has become much larger than it used to be. It
is now populated with thousands of entries! Almost equal to the total
number of users (privileged and unprivileged) in our database. We only
have around 100 privileged users. The page for building a New Search from
scratch has this problem.

Looking at the code I see that RT tries to identify users which have the
'OwnTicket' right, and displays these in the menu:

my $Users = RT::Users-new( $session{CurrentUser} );
$Users-WhoHaveRight(
Right   = 'OwnTicket',
Object  = $object,
IncludeSystemRights = 1,
IncludeSuperusers   = $isSU
);

This call returns many more users than expected.

The 'OwnTicket' right had not been granted explicitly to any user or
group, I tried to to assign this right explicitly, but that did not fix
the problem. The System group 'Everyone' only has the rights
CommentOnTicket, CreateTicket, ReplyToTicket.

Any hints on how to resolve this problem?

 - Vegard V -

RT Training Sessions (http://bestpractical.com/services/training.html)
*  Chicago, IL, USA  September 26  27, 2011
*  San Francisco, CA, USA  October 18  19, 2011
*  Washington DC, USA  October 31  November 1, 2011
*  Melbourne VIC, Australia  November 28  29, 2011
*  Barcelona, Spain  November 28  29, 2011


Re: [rt-users] RT 4 - install on Debian Squeeze

2011-05-25 Thread Vegard Vesterheim
On Wed, 18 May 2011 23:08:59 +0200 Alexander Finger a...@genevainformation.ch 
wrote:

 If you want to keep your install clean, try to install the necessary
 modules using apt-get instead of using fixdeps.
Good advice. 

Here are some oneliners from my personal notes on installing RT. These
commands tries naively to identify Debian packages for the missing Perl
modules reported by 'make testdeps'. It is far from perfect, but it
alleviates some of the work of satisfying dependencies.

make testdeps | grep '\.MISSING' | perl -pe 's/\s(\S+)\s.*MISSING/lc 
lib$1-perl/e' | sed \
's/::/-/g' | while read p; do sudo apt-get --yes install $p; done   



make testdeps | perl -wnl -e '/^SOME DEPENDENCIES WERE MISSING/ ... /EOF/ and 
print' | grep\
 '\.MISSING' | perl -pe 's/\s*([^. ]*).*/lc lib$1-perl/e' | sed 's/::/-/g'

 - Vegard V -


Re: [rt-users] simple web script to fill link values to from db

2010-05-20 Thread Vegard Vesterheim
On Tue, 4 May 2010 09:34:43 -0400 Michael W. Lucas 
mwlu...@blackhelicopters.org wrote:

 Hi,

 We're running RT 3.8.6 with postgresql on FreeBSD 8.

 I have a set of outside databases I'd like to extract some RT custom
 field values from: circuit IDs, services, etc.  This seems like it
 would be easy to do with the CustomField Link values to option.

 Surely someone's already written a simple CGI/PHP/somesuch script to
 pull values like this from a postgres database?  I could probably
 remember enough PHP to do it myself, but I'd prefer to use a wheel
 someone else invented.

I am not sure I understand your problem description fully. Why does
this have to be a web/CGI script?  The purpose of the Link values
to option is to make these Custom Field Values in the RT web UI into
hyperlinks to another service. It is not for importing values to RT.

I have recently written a quick'n'dirty perl script to automatically
update som CFs from an external DB. This script has not been put into
production yet, so it may contain errors, but I think it illustrates the
basic idea. I would like to generalize the script so that it can be reused
for other CFs. 

My idea is to run this script periodically (from cron) so that the CF
values are automatically updated.

You will need to fill out the blanks (...) yourself

Kind::DBIx is simply an DBIx::Class-based Perl module for accessing our 
external DB.

- snip - snip -
#! /usr/bin/perl 
# Update customfields in RT with values from external DB

use strict;
use Getopt::Long;
use Kind::DBIx;
use DBI;
use Data::Dumper;

my $rt_passwd;

GetOptions (
'rt_passwd:s' = \$rt_passwd,
   );

my $rt_dbh = DBI-connect ('dbi:Pg:...;dbname=...', 'rt_user...', $rt_passwd);

my $cf = $rt_dbh-selectcol_arrayref
('select id from customfields where name=?', undef, '...CF_FIELD_NAME...');
my $cf_field_no = $cf-[0];
die No valid cf field found unless $cf_field_no;

my $rt_utstyr_ref = $rt_dbh-selectcol_arrayref
('select name from customfieldvalues where customfield = ?', undef, 
$cf_field_no);
my @rt_utstyr = @{$rt_utstyr_ref};

my $rt_insert_sth = $rt_dbh-prepare ('insert into customfieldvalues 
(customfield, name) values (?, ?)');

my @kind_utstyr = map {$_-navn} 
Kind::DBIx-init()-resultset('Utstyr')-search 
({ -and = [
-or = [
# utstyrstype = 20,
   
# utstyrstype = 30,
   
# # utstyrstype = 40, # switches   
   
utstyrstype = 80,
# utstyrstype = 90,
   
# utstyrstype = 100,   
   
   ],
status = 20,
navn = {'!=' = undef},
navn = {'!=' = ''},
   ]});

my %in_rt;
@in_...@rt_utstyr} = ();

my %in_kind;
@in_ki...@kind_utstyr} = ();

my (@new_utstyr, @old_utstyr);
foreach my $rt (@rt_utstyr) {
push (@old_utstyr, $rt) unless exists $in_kind{$rt};
}
 
foreach my $kind (@kind_utstyr) {
push (@new_utstyr, $kind) unless exists $in_rt{$kind};
}

map {$rt_insert_sth-execute ($cf_field_no, $_)} @new_utstyr;
print Added, Dumper @new_utstyr;

# FIXME, remove values that have disappeared
print To be removed, Dumper @old_utstyr;
- snip - snip -

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


[rt-users] Per-user setting of NotifyActor

2010-03-05 Thread Vegard Vesterheim
In the Done section of this page
http://wiki.bestpractical.com/view/WishList, it says:

   Per user NotifyActor option
* RT-3.7 

Does this mean that this setting can be configured per-user? If so,
how?

 - Vegard V -
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22  23
Dublin, Ireland - Mar 15  16
Boston, MA, USA - April 5  6
Washington DC, USA - Oct 25  26

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


[rt-users] How to run standalone_http in debugger

2006-10-27 Thread Vegard Vesterheim
I am trying to debug some of my custom Scrips.

When I run standalone_httpd directly, and piping an email message into
rt-mailgate everything is OK. 

But if I run standalone_httpd in the Perl debugger (perl -d
standalone_httpd), and pressing 'c'(continue) in the debugger, my
request just seems to hang until I press Enter in the debugger, and
I get an error message about 'Bad request' in the debugger. The
response from the rt-mailgate is '500 Server closed connection without
sending any data back'.

How can I run RT with the perl debugger?

 - Vegard -

___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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