Re: [rt-users] Where are saved searches stored in the db

2017-01-10 Thread Emmanuel Lacour
Le 10/01/2017 à 14:51, Woody - Wild Thing Safaris a écrit :
> Thanks Emmanuel,
>
> I see the "Content" is encoded, which is why it didn't come up with my
> grep.
>
> How do i decode/encode it?

as far as I remember (no time to check now), it's base64 encoded. You
have a script in RT to see attributes by id: rt/sbin/rt-attribute-viewer.


Re: [rt-users] Where are saved searches stored in the db

2017-01-10 Thread Emmanuel Lacour
Le 10/01/2017 à 12:53, Woody - Wild Thing Safaris a écrit :
> Hi all,
>
> I was expecting to find a database table called "SavedSearches" but
> there isn't one. I have a saved search that contains the string
> '__CurrentUser_' but if i dump the DB and grep for that, i don't find it.
>
> Anyone know where saved searches are?

In table "Attributes".

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com



Re: [rt-users] How unprivileged users could see all tickets in their queue?

2017-01-04 Thread Emmanuel Lacour
Le 03/01/2017 à 18:27, Felix Defrance a écrit :
>
> Hi all,
>
> I don't find how I could add ShowTickets or QueueList in SelfService.
>
> I want to allow my unprivileged users, grouped by company name, to see
> all tickets in their queue.
>
> The group rights on the queue is correctly defined and users could
> access to the tickets by entring the ticket number in the "goto
> Ticket" field (top right in SelfService).
>
> I have tried to play with CustomRole but it's not working for me. So
> anybody known how I can do it?
>

SelfService filters ticket list to tickets the user is watcher on
(requestor or Cc). This is hard coded in
share/html/SelfService/Elements/MyRequests:

my $id = $session{'CurrentUser'}->id;
my $Query = "( Watcher.id = $id )";

if ($status) {
$status =~ s/(['\\])/\\$1/g;
$Query .= " AND Status = '$status'";
}


so if you wan't to relax this to all tickets users have ShowTicket
rights, you have to modify this query ;)

But I strongly discourage (unless really needed) to setup an RT instance
with one queue per customer, best to think queues per internal support
team and play with customroles/groups or customfields to set the customer.


Re: [rt-users] Where to put Crontool conditions?

2016-12-19 Thread Emmanuel Lacour
Le 19/12/2016 à 17:07, Alex Hall a écrit :
> Hi list,
> Where do I put custom conditions for rt-crontool? I'm trying to get
> UntouchedInHours to work. Its page says to place it in
> local/RT/bin/... But I have no bin inside local/RT. I'm assuming that,
> like so many Wiki pages, this is simply not updated for the newer RT
> versions? What's the right path to use under 4.4.1? Thanks. Oh, the
> page I'm using:
> https://rt-wiki.bestpractical.com/wiki/UntouchedInHours


like any custom RT scrip condition: local/lib/RT/Condition/ (you need to
create this directory if not yet done).


Re: [rt-users] Disable mobile UI?

2016-12-13 Thread Emmanuel Lacour
Le 13/12/2016 à 10:06, Giuseppe Sollazzo a écrit :
>
> Hi list,
>
> is there any configuration option to (temporarily) disable the Mobile
> UI, so that it goes to the full website from mobile UAs, without
> having to manually alter the URL?
>


unfortunatly, no, you have to override the method "MobileClient" of
lib/RT/Interfaces/Web.pm so it returns always undef.
-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017

Re: [rt-users] missing callbacks in 4.4.1 CSS?

2016-12-09 Thread Emmanuel Lacour
Le 09/12/2016 à 17:08, Alex Hall a écrit :
> Thanks. By "lib", I assume you just mean to make a folder somewhere,
> then use "@import myNewLib/myFile.css"? Should I make a replacement
> for the css file in local/html/NoAut/something that I'm replacing? I
> actually don't see a static folder around this CSS folder, so I'm not
> quite sure what should go where.h
>

Hi,

you just have to create a folder local/static/css and put CSS files here
with thinks you want to add/override. THen to use them, add each CSS
file name (without path) in configuration variable @CSSFiles and restart
you're web server.

Doc:
https://docs.bestpractical.com/rt/4.4.1/RT_Config.html#Web-interface 
->@CSSFiles.
-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017

Re: [rt-users] Looking for users of RT 4.4 that use the Asset feature

2016-11-30 Thread Emmanuel Lacour

We have a customer using it: as of now 9522 assets (computers, screen,
...) are in the database. Imported from an old system (home made script
pulling from the Oracle database, using RT API) and manual csv import
when needed (using custom script). 568 privileged users, 6128
unprivileged users, 161367 tickets.

Works fine, with as usual small customisation (callbacks, patches and
scrips).

As others already told, linking assets to existing ticket is not easy,
but we are looking at producting a patch to autocomplete on assets for
example.

Also, would be nice to make a gateway to get assets from fusion
inventory ...

We also have also another small RT instance using Assets for hardware
and contracts (hardware linked to groups that are customers, contracts
linked to hrdwares).

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com

-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017


Re: [rt-users] Exporting Data From RT

2016-11-24 Thread Emmanuel Lacour
Le 23/11/2016 à 16:05, Eddie Jones a écrit :
>
> *From:*Eddie Jones [mailto:ejo...@eastontelecom.com]
> *Sent:* Wednesday, November 23, 2016 9:55 AM
> *To:* 'rt-users@lists.bestpractical.com'
> *Subject:* Exporting Data From RT
>
>  
>
> Hello,
>
>  
>
> I need to export data from RT, including all ticket information
> (comments, custom field values, etc.).  Is there an easy way to do that?
>
>  
>

http://lists.bestpractical.com/pipermail/rt-users/2013-June/080582.html
for example.

There is also a tool to serialize the RT DB in RT, but it's targeted to
be use to migrate datas from one instance to another RT one.
-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017

Re: [rt-users] Different signature per queue

2016-11-10 Thread Emmanuel Lacour
Le 10/11/2016 à 14:49, John Angel a écrit :
>> Here I use the callback
>>  rt/local/html/Callbacks/MyCompany/Elements/MessageBox/Default with the
>> following content:
> That's great help and works like a charm, many thanks Emmanuel.
>
>

nice to hear :)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com

-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017


Re: [rt-users] Create a team lead view/dashboard to see several user's open tickets

2016-11-09 Thread Emmanuel Lacour
Le 04/11/2016 à 00:15, Kevin Long a écrit :
> Is it possible to create a dashboard where a team manager can see the top 10 
> tickets for each user on his team, i.e.:
>
>

not dynamically, you have to either update your dashboard with
appropriate search each time a new user join/leave your team (may be
done with a script) or code yourself a new component to include in
dashboards.

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com

-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017

Re: [rt-users] Different signature per queue

2016-11-09 Thread Emmanuel Lacour
Le 08/11/2016 à 11:18, John Angel a écrit :
> Trying to make different signature per queue. Don't want to use templates
> but $SignatureAboveQuote.
>


Here I use the callback
rt/local/html/Callbacks/MyCompany/Elements/MessageBox/Default with the
following content:


<%INIT>
# Use queue template "Signature" as signature if any, overwise, use the
currentuser's one
if ( $id ) {
   my $SystemTicket = RT::Ticket->new( $RT::SystemUser );
   $SystemTicket->Load( $id );
   my $QueueSignature = RT::Template->new( $RT::SystemUser );
   my ($val, $msg) = $QueueSignature->LoadQueueTemplate( Queue =>
$SystemTicket->QueueObj->Id, Name => 'Signature' );
   if ( $val && $QueueSignature->Content ) {
   my ($queue_signature, ) =
$QueueSignature->_ParseContent(TicketObj => $SystemTicket);
   $queue_signature =~ s!^\s*Content-Type\s*:\s+(.*)\s*$!!mi;
   my $ContentType = $1 || ' text/plain';
   if ( $ContentType eq 'text/html' ) {
   $$SignatureRef = "-- " . $queue_signature;
   } else {
   $$SignatureRef = "-- \n" . $queue_signature;
   }
   } else {
   $RT::Logger->info("Unable to load queue template
signature: $msg");
   }
}

<%ARGS>
$SignatureRef => undef
$id => undef



you need to setup a template named "Signature" on queue where you wan't
queue signature, then the above code will use this signature in place of
user one.

If you don't wan't to use a template, you can use above code as example
to access ticket queue name.

(it's on RT 4.2, but should work on 4.4)
-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017


Re: [rt-users] rt-crontool on condition x change queue

2016-10-18 Thread Emmanuel Lacour
Le 18/10/2016 à 11:03, Joel Bergmark a écrit :
>
> Hi,
>
>  
>
> Just a quick one this time, is there any easy way to use rt crontool
> get something like this working:
>
>  
>
> /opt/rt4/bin/rt-crontool --search RT::Search::FromSQL --search-arg
> "Queue = 'X' AND (Status='new' OR Status='open')" --condition
> RT::Condition::Overdue --action RT::Queue  "Newqueue"
>
>  
>
> I know its not really under rt::action but is there a way to call upon
> rt::queue from this? Tried a bunch of different syntax but get
> “RT::Queue::Prepare Unimplemented in main.”
>
>  
>


there is no stock SetQueue RT action, you have to write it yourself.
Just put the following content (untested) in
rt/local/lib/RT/Action/SetQueue.pm and call it like this:

/opt/rt4/bin/rt-crontool --search RT::Search::FromSQL --search-arg
"Queue = 'X' AND (Status='new' OR Status='open')" --condition
RT::Condition::Overdue --action SetQueue --action-arg "Newqueue"


 cut

package RT::Action::SetQueue;
use base 'RT::Action';

use strict;
use warnings;


sub Describe  {
  my $self = shift;
  return (ref $self . " will set a ticket's queue to the argument
provided.");
}


sub Prepare  {
return 1;
}

sub Commit {
my $self = shift;
$self->TicketObj->SetQueue($self->Argument);

}

1;
 cut



-
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] Using self service interface for privileged users in 4.4.1?

2016-10-12 Thread Emmanuel Lacour
Le 11/10/2016 à 20:11, Matt Zagrabelny a écrit :
> On Tue, Oct 11, 2016 at 8:05 AM, Alex Hall  wrote:
>> Hello list,
>> I have 4.4.1 running. Someone said on this list that it included the option
>> to use the self service interface, even for privileged users? I don't see
>> that option in my user preferences. How do I enable it, and can I have a
>> toggle for users to switch between the two without leaving the ticket
>> they're viewing? Thanks.
> Privileged users can always browse to:
>
> rt.example.com/SelfService
>
> You can probably use a callback to add a link to the self service URL
> for displaying a ticket.

link from standard UI to selfservice:

rt/local/html/Callbacks/YourOrg/Elements/Tabs/Privileged:

<%init>
Menu->child( 'simplified-ui' => title => loc("SelfService"), sort_order
=> 1, path => '/SelfService/', attributes => { style => 'font-style:
italic;' });



link back to standard UI from selfservice:

rt/local/html/Callbacks/YourOrg/Elements/Tabs/SelfService:
<%init>
# Add link to full UI if allowed
if ( $session{CurrentUser}->Privileged ) {
Menu->child( 'full-ui' => title => loc("Full web interface"), sort_order
=> 1, path => '/index.html', attributes => { style => 'font-style:
italic;' });
}





;)
-
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] Connecting RT to IBM iSeries and/or MSSQL databases?

2016-10-10 Thread Emmanuel Lacour
Le 10/10/2016 à 17:15, Alex Hall a écrit :
>
>
> * Can Perl code in scripts talk to an external database as I've described?
>

yes, scrips run any kind of perl code, you can include needed modules.
There is perl libs to talk to almost any kind of databases, even
proprietary ones ;) A quick internet search on perl + MSSQL will give
you examples of code.

we have here scrips that get and write informations to third party
softwares using DB access, ldap, soap, xmlrpc, depending on the needs.

> * Can the RT cron tool do this job? If so, what might the workflow
> look like? I haven't yet looked very deeply into this tool's abilities
> or syntax.
>

it can if the Action used is one that you self create for your needs (in
rt/local/lib/RT/Actions)


-
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] show msg to user in scrip

2016-10-05 Thread Emmanuel Lacour
Le 05/10/2016 à 16:12, David Schmidt a écrit :
> Hello list
>
> I want to write a scrip that aborts the action the user is trying to
> commit and redisplay the current page with an added info message. How
> can i display an info message to the user?
>


you cannot do this within a scrip (unless playing with some customfield
to store the msg :().

the best here is probably to use a callback in the target page rather
than a scrip.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com

-
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] Postgresql 4.4.1 slow queries?

2016-09-28 Thread Emmanuel Lacour
Le 28/09/2016 à 11:12, Joel Bergmark a écrit :
> Hi!
>
> This is the output from explain:
>
> postgres=# EXPLAIN SELECT DISTINCT main.* FROM Users main CROSS JOIN ACL 
> ACL_3 JOIN Principals Principals_1  ON ( Principals_1.id = main.id ) JOIN 
> CachedGroupMembers CachedGroupMembers_2  ON ( CachedGroupMembers_2.MemberId = 
> Principals_1.id ) JOIN CachedGroupMembers CachedGroupMembers_4  ON ( 
> CachedGroupMembers_4.MemberId = Principals_1.id )  WHERE ((ACL_3.ObjectType = 
> 'RT::Queue' AND ACL_3.ObjectId   = 56) OR (ACL_3.ObjectType = 'RT::System' 
> AND ACL_3.ObjectId   = 1)) AND (ACL_3.PrincipalId = 
> CachedGroupMembers_4.GroupId) AND (ACL_3.PrincipalType = 'Group') AND 
> (ACL_3.RightName = 'OwnTicket') AND (CachedGroupMembers_2.Disabled = '0') AND 
> (CachedGroupMembers_2.GroupId = '4') AND (CachedGroupMembers_4.Disabled = 
> '0') AND (Principals_1.Disabled = '0') AND (Principals_1.PrincipalType = 
> 'User') AND (Principals_1.id != '1')  ORDER BY main.Name ASC;
> ERROR:  relation "users" does not exist
> LINE 1: EXPLAIN SELECT DISTINCT main.* FROM Users main CROSS JOIN AC...
>

seems you are not connected to the right database as the table Users is
not found ;)
-
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] Merging Tickets

2016-09-26 Thread Emmanuel Lacour
Le 26/09/2016 à 07:44, Thanos Constantopoulos a écrit :
> Odyssey
>
> Dear All
>
>  
>
> Is there a way to prevent ticket merging when the tickets are not in
> the same queue?
>
>  
>


you have to override the method RT::Ticket->MergeInto for this.

Here is an (untested) sample code to put in rt/local/lib/RT/Ticket_Local.pm:


package RT::Ticket;

use strict;
no warnings qw(redefine);

my $old_mergeinto = \

*MergeInto = sub {
my $self = shift;
my $ticket_id = shift;

my $MergeInto = RT::Ticket->new($self->CurrentUser);
$MergeInto->Load($ticket_id);

if ( $MergeInto->Id ) {
if ( $self->Queue != $MergeInto->Queue ) {
 return ( 0, $self->loc("Can't merge tickets from
different queues ([_1], [_2])", $self->QueueObj->Name,
$MergeInto->QueueObj->Name) );
}
}
   
return $old_mergeinto->($self, @_);

};

1;



if you only take care of the web interface, youb should be able to block
the merge processing using the callback located in
share/html/Ticket/ModifyLinks.html, by looking at posted args, loading
target ticket and checking queues against $TicketObj->Queue. Then if
queues does not match, push a message in @$Results and delete the merge
from $ARGSRef.
-
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] stop form submit on ticket reply

2016-08-24 Thread Emmanuel Lacour
Le 24/08/2016 à 17:06, Hugo Escobar a écrit :
> Thanks Emmanuel for your response.
> 
> My initial post was a little inaccurate, I forgot to mention some details:
> 
> 1.The user wants to add a ticket reply
> 2.The user writes (and prepares her message, attachments, etc)
> 3.The user presses the "Update Ticket", some condition is evaluated
> two possible outcomes (true, false)
> 3.1   If false => submit reply

ok

> 3.2   If true  => the user is asked if the reply should be submitted

use another callback in the same Update.html page to display a
confirmation button

> 3.2.1 User wants to continue => reply submitted

in you're first callback, get the submit value from $ARGSRef that say
the confirm button has been pressed.

> 3.2.2 User decides to abort reply submission => no ticket reply should
> be added
> 

the same, with a "Discard" button, you catch the value from $ARGSRef and
then use MaybeRedirectForResults to Display.html after emptying submited
values from $ARGSRef.




> I tried to implement something in javascript to handle "3.2.2" but the
> reply is always submitted
> 



no need for JS here, thought you can of course do this using only js ;)
-
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] Questions about specific capabilities of RT

2016-08-24 Thread Emmanuel Lacour
Le 24/08/2016 à 01:35, Alex Hall a écrit :
> 
> 
> * In OST, agents (that is, staff who can take care of tickets and make 
> internal notes) must belong to one department only. We can use multiple 
> teams, but those are harder to deal with than departments.. In RT, can staff 
> belong to multiple departments, assuming RT has a similar setup?
> 

users may be in multiple groups (teams). And may have rights and roles
(works) on multiple queues (team+workflow). So yes.

> * Can SLAs be set to ignore weekends and holidays? If a 72-hour SLA is 
> assigned on Friday, that should mean three business days, not that it has to 
> be done Monday.
> 

yes, see
https://docs.bestpractical.com/rt/4.4.1/customizing/sla.html#Does-business-time-support-holidays

> * Can things be set so that staff are notified upon certain events firing? A 
> very overdue ticket in any department might go to one guy in management 
> automatically, for instance, so that he can keep tabs on all overdue items.
> 

yes, using rt-crontool you can do automatic escalation. You can also use
saved searches with relative dates and dashboards subscriptions.

> * Can we use custom IMAP folders? I had to modify OSTicket to do this, but we 
> have just tick...@domain.com for our email address for the system. It's with 
> Gmail, so I have tickets+graph...@domain.com set to go to Graphics. I did 
> this by telling Graphics to check the 'graphics' folder in the tickets email 
> account. Each department has the same setup, with a custom folder. We did 
> this because each new email address costs money, and we saw no point in 
> paying hundreds per year for a feature I could add to OST. RT will have to be 
> able to do the same, though.
> 

best use of RT is usually to directly send email to him using smtp, but
you can use fetchmail to get emails from pop/imap/...

> * In OST, replying to an email notification posts only an internal comment, 
> not a full ticket reply. OST says they do this so two agents don't reply with 
> conflicting information for the user. For our situation, though, we need 
> email replies to post ticket replies, so everyone on the ticket gets email 
> notifications. Essentially, part of what we want is to let users carry on 
> email conversations surrounding a ticket, but for those responses to be 
> posted to the ticket at the same time. This will keep activity archived, and 
> will automatically create ad-hoc email groups for everyone who needs to be 
> part of a given issue. Since we're not using this for customers, we don't 
> care who sees what in * In OST, when an agent creates a ticket, it *must* be 
> done on behalf of a user. Since most of our tickets are internal, this gets 
> very annoying, and results in us posting tickets to ourselves most of the 
> time. I'd much prefer it if tickets could be opened on behalf of agents or, 
> better still,
>   on beha
>  lf of no one at all. I just want a ticket to consist of the issue, the 
> creator, and everyone who needs to deal with it, plus an SLA.
> 

in RT notification are fully customizables and there is usually to kind
of emails address per queue, one for comments, other for replies.




As you have a great view of what you wan't but litle knowledge of RT
which is higly configurable/customizable, I strongly suggest you to
contact Bestpractical or other RT specialist working near you to help
you so you'll do the rights choices between
queues/customfields/groups/roles for your org.

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
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] stop form submit on ticket reply

2016-08-23 Thread Emmanuel Lacour
Le 23/08/2016 à 22:59, Hugo Escobar a écrit :
> Hi,
> 
> I need to be able to stop submitting a "Public Reply" correspondence
> based on a evaluation that returns a Boolean value.
> 
> This decision must be taken when the user clicks the "Update Ticket" button
> 
> Everything I have tried fails because the form is always submitted.
> 
> Any help will be highly appreciated
> 
> 

create a file named
/rt/local/html/Callbacks/YourOrg/Ticket/Update.html/BeforeUpdate

with a content such as:

<%init>

if ( exists $ARGSRef->{SubmitTicket} ) {
  # Write here your evaluation, you can use submitted values in
%$ARGSRef and the ticket object $TicketObj
  if ( !$evaluation ) {
push @$results, loc("Message that should be displayed to user");
$$skip_update = 1;
  }
}

<%args>
$TicketObj => undef
$skip_update => undef
$results => undef
$ARGSRef => undef



don't forget to cleanup your mason cache and restart your webserver.
-
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] Can you limit ticket access via CF

2016-08-23 Thread Emmanuel Lacour
Le 23/08/2016 à 04:09, Stephen Switzer a écrit :
> Emmanuel,
> 
>This is awesome, thanks for the input! I didn't think to do that.
> Does this work with the self-service interface, too?
> 

of course, because it uses core RT features/ACLs

> Also, on set-up... I did these steps, creating a group called
> 'Cust-AbcCompany' and adding users, but when I went to assign a group to
> the 'Company" role on a ticket:
> 
> "
> Could not find or create user 'Cust-AbcCompany'
> "


see ... https://issues.bestpractical.com/Ticket/Display.html?id=32208

I still did not had time to develop this :(

The workaround is to create a multi users/groups custom role instead of
a single.

If you're able to patch a bit RT, you can easily hide this role from
Ticket/People and add a widget to choose the group from the Basic of a
ticket.

I have such a patch, but very tied to our usage and I do not recommand
to use it if you are not going to maintain it yourself for your org.
-
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] Can you limit ticket access via CF

2016-08-22 Thread Emmanuel Lacour
Le 22/08/2016 à 12:44, aixenv a écrit :
> Hello,
> 
> We have a situation where we would like to limit ticket access within a
> specific queue based on CF, is that possible?
> 
> for example, let's say the queue name is Technical-Client-Support and
> when someone from a particular email submits a ticket it associates a CF
> with their company name let's say "ABC Company".
> 
> Can I limit "ABC Company" to only be able to view all tickets associated
> within the "Technical-Client-Support" queue based on the CF that assigns
> their company value? for all users within the company that populate the
> custom CF with their particular company or for specific users. Say Fred
> Jones from ABC Company as an example
> 
> The goal here is to allow ABC Company to view all associated tickets to
> their company.
> 
> 

we did this years ago (using RT 4.0) but with a dirty patch ...

the best will be to upgrade to 4.4 and use custom role instead of CF to
record the ticket customer:

- create groups or users for each of your customers (here we sync our
customers companies as groups and contacts as members from our LDAP)
- create a "custom role" named "Company"
- grant Showticket, ... to this role in your queue rights
- create if possible a scrip that automatically add the corresponding
group/user as company role to the ticket, on ticket creation, based on
the requestor

this is the way we use RT now for customers support, it's very flexible
and can be tied to your SI such as an LDAP database of customers to sync
them and automatically set the right customer on the ticket.
-
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] Default requestor for linked / child tickets

2016-07-28 Thread Emmanuel Lacour
Le 28/07/2016 à 09:47, Emmanuel Lacour a écrit :
> 
> 
> I see, I used a self made callback:
> 
> 
> $m->callback( CallbackName => "MassageClone", Clone => \$clone,
> CloneTicketObj => $CloneTicketObj, ARGSRef => \%ARGS );
> 
> 
> Which pass the original ticketobj, so with the new standard
> MassageCloneArgs, the code should looks like:
> 
> 
> <%init>
>my $CloneTicketObj = LoadTicket( $$DECODED_ARGS{'CloneTicket'} );
>$$ARGSRef{Requestors} = $CloneTicketObj->OwnerObj->EmailAddress;
> 
> <%args>
>$ARGSRef => undef
> 
> 
> 


for the record:

https://issues.bestpractical.com/Ticket/Display.html?id=32212


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Default requestor for linked / child tickets

2016-07-28 Thread Emmanuel Lacour
Le 28/07/2016 à 09:23, Reinhold Pescoller a écrit :
> 
>>>
>> it should works (it works here). What version of RT are you using. Can
>> you send me the full error log?
>>
>>
>> I see that your callback is named "MassageCloneArgs". Is this a typo in
>> this email, there is no "Args" at the end.
>>
>>
>>
>>
> I use version 4.4.0.
> 
> In my Create.html i found this name:
> 
> $m->callback( CallbackName => 'MassageCloneArgs', ARGSRef => $clone,
> Queue => $Queue );
> 
> 
>

I see, I used a self made callback:


$m->callback( CallbackName => "MassageClone", Clone => \$clone,
CloneTicketObj => $CloneTicketObj, ARGSRef => \%ARGS );


Which pass the original ticketobj, so with the new standard
MassageCloneArgs, the code should looks like:


<%init>
   my $CloneTicketObj = LoadTicket( $$DECODED_ARGS{'CloneTicket'} );
   $$ARGSRef{Requestors} = $CloneTicketObj->OwnerObj->EmailAddress;

<%args>
   $ARGSRef => undef



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] prevent moving tickets to a queue, but still make the queue visible?

2016-07-28 Thread Emmanuel Lacour
Le 27/07/2016 à 22:09, David Parter a écrit :
> I have searched, and experimented, but have not found the answer.
> 
> I want to prevent anyone except a specific group moving tickets to a
> particular queue, but I still want that queue and the tickets in the
> queue to be visible to other groups. Most of our queues should not be
> restricted.
> 
> It seems that the permission that controls moving a ticket to a
> different queue is "modify tickets" which is based on the queue that the
> ticket is currently in, not the queue that the ticket is moving to.
> 

yes

> Is there a way to do that? Any advice or ideas would be appreciated.
> 

the needed right is not easy to implement in RT because there is needed
parameter such as grant right "MoveTicket" on a queue with parameter
such as "from" or "to".

Thought you can prevent your users from doing this on the UI with two
methods:


Using lifecycles:

- create two lifecycles in your config, with same status/transitions if
needed, but different names, one for each queue. And *do not set a
mapping*  between those lifecycles. RT will refuse to move tickets
between the queues. But no one will be able to move them.

Using callbacks:

use callbacks such as
rt/local/html/Callbacks/YourOrg/Ticket/Modify.html/Default

and in this callback, check if there is a queue change
($$ARGSRef{Queue}), and if so, get groups for $session{'CurrentUser'}
and if the user is not in the allowed group, push a message in @$results
and block update with $$skip_update = 1


you may have to do this in one or two other places such as
Search/Bulk.html and Ticket/ModifyAll.html I suppose.


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


Re: [rt-users] Default requestor for linked / child tickets

2016-07-26 Thread Emmanuel Lacour
Le 26/07/2016 à 12:32, Reinhold Pescoller a écrit :
> Hi All,
> 
> I have this question. Default rt sets for a new linked ticket (depend on
> or child ticket ) as requestor the requestor of the parent ticket. I
> would like to set the owner email address as requestor for the new child
> ticket.
> 
> Where can I change this behavior?
> 


use the following callback (example, untested):

rt/local/html/Callbacks/YourOrg/Ticket/Create.html/MassageClone

  <%init>
  $$Clone->{Requestors} = $CloneTicketObj->OwnerObj->EmailAddress;
  
  <%args>
  $ARGSRef => undef
  $Clone => undef
  $CloneTicketObj => undef
  


you have to customize it to your needs and add error checking (what if
there is no owner or if owner has no email address, ...)
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] url encoding

2016-06-22 Thread Emmanuel Lacour
Le 22/06/2016 à 10:48, Christian Loos a écrit :
>> https://umbc.co1.qualtrics.com/SE/?SID=SV_4IbNK0n1unOaIEB=BSG={$Ticket->Id}={$Ticket->OwnerObj->EmailAddress}={$Ticket->RequestorAddresses}={uri_escape($Ticket->Subject)}
> 
> I would use the /Elements/QueryString RT component here, which will do
> all the funny URI encoding and parameter concatenation for you:
> 
> {
> my $query_string = $m->comp('/Elements/QueryString',
> SID   => 'SV_4IbNK0n1unOaIEB',
> groupid   => 'BSG',
> ticketid  => $Ticket->Id,
> ticketowner   => $Ticket->OwnerObj->EmailAddress,
> customeremail => $Ticket->RequestorAddresses,
> ticketsubject => $Ticket->Subject,
> );
> }
> 
> https://umbc.co1.qualtrics.com/SE/?{$query_string}
>


Nice idea, but is $m available in RT templates (never tried) ?
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] url encoding

2016-06-22 Thread Emmanuel Lacour
Le 22/06/2016 à 01:16, Joe Kirby a écrit :
> I have a template which provides a link to our survey tool and recently
> I was asked to add subject to the parts included in the url. 
> 
> Since the ticket subject contains spaces, etc. that may not lend them
> selves to a url
> 
> I found a way to handle spaces but then I get a subject with a # sign
> which creates a short circuited subject value
> 
> Below are 2 options with the ending part(in red) differs. 
> 
> The first one works but only handles spaces. 
> 
> The second one would be wholistic but RT does not like the syntax. Any
> ideas?
> 


you can use:


{use URI::Escape; uri_escape($Ticket->Subject);}


or any other perl module that does the same.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] RT 4.4.0 ShowHistory -> Scroll problem with French GUI

2016-06-17 Thread Emmanuel Lacour
Le 16/06/2016 à 19:54, Dustin Graves a écrit :
> Hi Guys,
> 
> Thanks for the fix, Emmanuel. We ended up doing it a little differently
> though with the JS I18N engine. You can see the
> branch 4.4/fix-history-scroll-js for the details. We are planning on
> merging the fix into 4.4.1.
> 

nice :)

(I lack JS knowledge :()

Do you think you have time to review some of my latest small patches
before 4.4.1:

https://issues.bestpractical.com/Search/Results.html?Format=%27+++%3Cb%3E%3Ca+href%3D%22%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca+href%3D%22%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27=ASC|ASC|ASC|ASC=id|||==Status+%3D+%27in-review%27+AND+Requestor.EmailAddress+%3D+%27elacour%40easter-eggs.com%27=100=new=
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Ticket-overview

2016-06-16 Thread Emmanuel Lacour
Le 16/06/2016 à 13:07, Joel Bergmark a écrit :
> Hi
> 
>  
> 
> Is there an existing way or new way to create a ticket overview similar
> to RT-at-a-glance where one can list all users owned tickets stats like:
> 
>  
> 
> Status  Open  Stalled
> 
> FooUser 10  15
> 
> Foo2User 1  20
> 


you just have to make a search of

you just have to make a search of all stalled/or/open tickets, Then
click on Chart and use a group by Owner And Status, save this chart.
After this you will see the saved chart available in the "RT at a
glance" config tab.

Or you can write a dedicated component in local/html/Elements/ and
expose it through  $HomepageComponents so it can be configured on RT at
a glance.

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


Re: [rt-users] Adding menu items with external data to SelfService

2016-06-16 Thread Emmanuel Lacour
Le 13/06/2016 à 06:18, Stephen Switzer a écrit :
> Hi Everyone!
>I have a goal to make RT's Self Service interface a full customer
> portal where they can log in to see their outstanding invoices as well
> as report trouble by creating a ticket. I imagine adding a custom field
> to the users to store an external ID for any user that I would like to
> enable this option for.


why not playing with privileged/unprivileged users, your customers
should be unprivileged, and RT 4.4 Customer role (or a few lines of code
to add a role on RT 4.2) which would point to groups that represents a
company, so each of a company group memeber can see all tickets of this
company ?

> No big deal there. It took a little time to
> figure it out but I have added an "Accounting" option to the top of the
> page, right after "Tickets" by editing
> /opt/rt4/local/html/Elements/Tabs. 

don't do it thi way, it will be hard to follow RT upgrades. You have a
callback in share/htmls/Elements/Tabs named "SelfService" so you just
have to create a
local/html/Callbacks/MyCompany/Elements/Tabs/SelfService file with a
content such as:

<%INIT>
my $accounting = Menu->child( accounting => title => loc('Accounting'),
path => '/SelfService/AccountingARInvoices.html' );



> I then added
> /opt/rt4/local/html/SelfService/AccountingARInvoices.html (which I coped
> from Closed.html and modified). Here's an Excerpt:
> 
> <& /SelfService/Elements/ARInvoices,
> %ARGS,
> status  => [ RT::Queue->InactiveStatusArray ],
> title   => loc('My Open Invoices'),
> BaseURL => RT->Config->Get('WebPath')
> ."/SelfService/AccountingARInvoices.html?",
> Page=> $Page,
> &>
> 
> This then calls /opt/rt4/local/html/SelfService/Elements/ARInvoices. I
> found that in the call to CollectionList, I can comment out the Query
> parameter, and pass Collection instead.
> 
> This is where I seem to have a mental block. I'm not a perl newbie, but
> I infrequently code in perl and keep forgetting things I'd once learned,
> so it might be obvious to others. However, I am new to the Mason
> approach. I'd like to use as many of the built in RT components as
> possible to display the data. I have already built an API that can
> return a list of open invoices in JSON format, and I plan to call this
> API then pass the data as a collection. However, in testing the approach
> I tried hard coding the collection parameter to figure out what this
> collection needs to look like to work... such as: Collection => [('a' =>
> '1'), ('b' => '2')]; ... but I kept getting:
> 


I never played with Collections using other than a query, so I let
others confirm (or not)  if it's possible.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] RT 4.4.0 ShowHistory -> Scroll problem with French GUI

2016-06-16 Thread Emmanuel Lacour
Le 14/06/2016 à 13:53, Eierschmalz, Bernhard a écrit :
> Hi,
> 
>  
> 
> I’m using RT 4.4.0 on a PostgreSQL 9.3 database.
> 
>  
> 
> Today I activated the option
> 
> Set($ShowHistory, ‘scroll’);
> 
>  
> 
> And I ran into a problem with users with French GUI.
> 
> When you open a ticket, you should first see “Ticket metadata” and “history”
> 
> On the French users, the history is not shown.
> 


I confirm that it's broken and proposed a fix here:
https://issues.bestpractical.com/Ticket/Display.html?id=32090



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


Re: [rt-users] Changing shape of ticket ID

2016-06-16 Thread Emmanuel Lacour
Le 16/06/2016 à 08:23, Primoz Jeroncic a écrit :
> 
> I'm sure it can be done, but no matter how much I try and search, I
> don't find way how to do it.


it can be done, but it's a bit tricky, to do it cleanly you have to
override some methods by starting from:

grep SubjectTag lib/ -r


;)


> 
> PS: I know changing this, would break all connections of new
> tickets/replies to old tickets with existing tickets, but I'm fine with
> that.
> 


no, you can stay backward compatible in RT::Interface::Email::ParseTicketId


if it was me I would not change the default format, just allow for
incoming other formats if needed.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Transaction Report

2016-06-15 Thread Emmanuel Lacour
Le 14/06/2016 21:33, Jesse Maseto a écrit :
> Hello Matt,
> 
> I want to have a report or a list of tickets showing if the original
> owner reassigns a ticket to another co-worker.
> 
there is no direct webui access to such information, but you can create
a customfield to record your need through a scrip (and a script using RT
API for backlog), you will then be able to make graphs/reports based on
this CF.

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


Re: [rt-users] Send email when a ticket is deleted?

2016-06-09 Thread Emmanuel Lacour
Le 08/06/2016 18:01, Omen Wild a écrit :
> Is there an easy way to have RT send an email when a ticket is deleted?
> We get some spam to our queues and it would be nice to know if someone
> already deleted it.
> 


You have to write a custom condition scrip like (untested):



return 1 if ( $self->TransactionObj->Type eq 'Status' &&
$self->TransactionObj->NewValue eq 'deleted' );

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Expanding ticket numbers

2016-06-09 Thread Emmanuel Lacour
Le 08/06/2016 16:34, Joel Bergmark a écrit :
> Hi,
> 
>  
> 
> Got a bit confused regarding expanding current ticket numbers, tried
> google this but didn’t find anything clear. Ee are using #123456 hence
> #99 possible tickets? Problem is that due to spam and other
> unexpected high volume of tickets we are up to 13 already, this was
> much higher than anticipated after just a few months of use and soon
> this will increase even quicker.
> 


I don't know the exact limit (the size of int in perl/postgresql), but I
know RT instances with tickets numbers above million.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] can't paste images in line

2016-06-07 Thread Emmanuel Lacour
Le 07/06/2016 à 19:35, Andrea Caputto a écrit :
> are you sure that extension is working for RT 4.4?
> 

I don't know, I do not have 4.4 on production servers yet (will do soon).
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] remove large attachments and replace with download link

2016-06-07 Thread Emmanuel Lacour
Le 07/06/2016 à 23:23, Hugo Escobar a écrit :
> We need to give our users the possibility of receiving large files (say
>> 10MB)
> 
> Knowing the attachment size limit all email services impose, we thought
> there should be a way to tell RT to replace large attachments with a
> download
> link when constructing the email message allowing the user to access those
> files.
> 
> I've been searching the internet to no avail.
> 
> 

Have a look at this plugin I just made:

http://search.cpan.org/~elacour/RT-Extension-AttachmentFilter-0.01/

It does not do what you ask for, but it can help you to understand the
process and now some usefull callbacks.

To my knowledge, nobody as done this, but I'm sure it's possible to do
it cleanly.


Be careful there is code change on file upload between RT 4.2 and 4.4, I
still did not work on 4.4 code (but will do soon ...).
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] Scrip check multiple fields

2016-06-04 Thread Emmanuel Lacour
Le 03/06/2016 à 21:31, maks a écrit :
> Hello,
> 
> How can I
> also check which queue the ticket is currently in within the same condition?
> 

return 0 unless $self->TicketObj->QueueObj->Name eq 'blah';
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] can't paste images in line

2016-06-03 Thread Emmanuel Lacour
Le 03/06/2016 à 15:25, Andrea Caputto a écrit :
> Hello Emmanuel  thanks for your comment, it is right if i put :
> 
>  Set($RT::Extension::PermissiveHTML, '1');
>

Install the extension and follow the configuration doc. Here I had:

Plugin('RT::Extension::PermissiveHTMLMail');
Set($MaxInlineBody, 100);
Set($ShowTransactionImages, 1); # (default)


and the file:

$ cat rt/local/lib/RT/Interface/Web_Local.pm
package HTML::Mason::Commands;

# Show inline data images (mostly for Ctrl+v in richtext editor)
$SCRUBBER_RULES{'img'}->{'src'} .= "|".qr/^data:/i if
RT->Config->Get('ShowTransactionImages');

1;



thought I prefer now the patch I submited in the ticket.
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016


Re: [rt-users] can't paste images in line

2016-06-03 Thread Emmanuel Lacour
Le 30/05/2016 à 19:21, Andrea Caputto a écrit :
> Hello, i want to paste images or screenshots in new tickets or commented
> but i cant, maybe is related with this:
> 
> http://www.gossamer-threads.com/lists/rt/users/109983
> 
> Anyone can help me?
> 

have a look at this:

https://issues.bestpractical.com/Ticket/Display.html?id=32043

here it works fine, ckeditor convert copy/paste to data:base64 inline
images, but:

RT may not display it because:

- src:data isn't allowed (see RT::Extension::PermissiveHTML to fix this)
- src:data need to increase $MaxInlineBody to display it
- src:data isn't displayed in all mail user agents, like gmail for example

with the above patch, it works.
-
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 Emmanuel Lacour
Le 01/06/2016 13:13, Vegard Vesterheim a écrit :
> 
> 
> I found a solution, I think the problem was related to loading the
> correct User Object.
> 

indeed, I misread you're code :(

> 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.
> 

no, either:


my $UserObj = RT::User->new($session{'CurrentUser'});
$UserObj->Load(a user name);

or in your case, just $session{'CurrentUser'}->UserObj

> Thanks for the hint.
> 

you're welcome

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
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 Emmanuel Lacour
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.


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


Re: [rt-users] Importing ticketing data into the RT SQL database

2016-04-27 Thread Emmanuel Lacour
Le 27/04/2016 18:30, Dave Florek a écrit :
> Hi,
> 
> I'm about to import a large amount of ticketing data into the RT SQL
> database. I spotted three sections in the SQL db
> (objectcustomfieldvalues, attachments, tickets) to import the data to.
> Since I'm unfamiliar with the db backend, can I generate any of my own
> set of identifiers as long as they aren't duplicate of the identifiers
> that are already present in the SQL db?
> 
> 

I strongly suggest to use the RT perl API by writting a script taht does
sql in source DB and create tickets/users/rt objects using the RT API.
Doing this with RT cli is possible but will be very slow will not allow
you to skip some internal RT auto-et of values (such as Created date for
transactions, tickets, ...).

Here is an example script I did to import tickets from a third party DB
(ICW) into RT. It's just an example as it was done for a one shot
execution and very specific needs, but this way we imported more than
300k tickets with users/history/customfields.




-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


import-icw.pl
Description: Perl program
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Show Ticket Message in Search/Results.html

2016-04-21 Thread Emmanuel Lacour
Le 21/04/2016 15:12, David Schmidt a écrit :
> When I list tickets I want to show the first 3 lines of the ticket
> message for each ticket.
> 
> I am using the following patch to achieve this, but it is quite a hack.
> Can someone recommend a cleaner solution.
> 
> 


you don't have to patch, you can use the callback "Once" in
Elements/RT__Ticket/ColumnMap

so just create a file
local/Callbacks/YourOrg/Elements/RT__Ticket/ColumnMap/Once

with a content that will ad such column.

Something like:

<%init>
$COLUMN_MAP->{First3Lines} = {
title => 'First3Lines',
value => sub { return loc($_[0]->First3Lines) }
};


<%args>
$COLUMN_MAP => undef
$GenericMap => undef




And in a local/lib/rt/Ticket_Local.pm:

package RT::Ticket;

use strict;
no warnings qw(redefine);
use utf8;

sub First3Lines {
my $self = shift;

[your code here]

return $content;
}

1;


Then another callback to make this new "First3Lines" available as a
columns in the search builder:

local/Callbacks/YourOrg/Search/Elements/BuildFormatString/Default
<%init>
push @$Fields, 'First3Lines';

<%args>
$Fields => undef





this way, you don't have to patch and your changes should stay as is
from rt versions to rt versions.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installed extension not working

2016-04-15 Thread Emmanuel Lacour
Le 15/04/2016 02:54, pelotek a écrit :
> Your reply made me realize that I hadn't put that portlet on a dashboard or
> on RT at a Glance.  I knew the issue was probably something easy that I
> didn't think of.  I was able to put the portlet on the dashboard and it's
> working now.  Thanks for your help!
> 
> 

you're welcome :)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Due dates

2016-04-15 Thread Emmanuel Lacour
Le 15/04/2016 04:11, Steven H a écrit :
> I installed rt4.4.0
> 
> When I configure queue, there is no place to input due dates. Instead there
> are fields "Starts" and "Due" which can be fill in a date such as
> "2016-04-15 00:00:00". I did a test creating a ticket, the due date is what
> I set in that fields.
> 
> What I need is setting duedate such as 3 days after tickets created.
> 
> I also use SLA. It can set a duetime in RT_Siteconif.pm for all queues, But
> I need set different duedates for different queues.
> 
> 


look at "QueueDefault" here
https://docs.bestpractical.com/rt/4.4.0/RT_Config.html#SLA, it's what
you need.

though this information is missing from
https://docs.bestpractical.com/rt/4.4.0/customizing/sla.html.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installed extension not working

2016-04-14 Thread Emmanuel Lacour
Le 14/04/2016 21:52, pelotek a écrit :
> I've replaced it with
> 
> Set( $HomepageComponents, [ qw(QuickCreate Quicksearch MyAdminQueues
> MyCalendar MySupportQueues MyReminders RefreshHomepage Dashboards
> SavedSearches FindUser) ] );
> 
> but MyCalendar still doesn't show up
> 

where did you look for it?




-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installed extension not working

2016-04-14 Thread Emmanuel Lacour
Le 14/04/2016 21:03, pelotek a écrit :
> Set( $HomepageComponents, [qw(MyCalendar)] );

You must take the default value un RT_Config.pm, copy it here and *add*
MyCalendar to it!

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installed extension not working

2016-04-14 Thread Emmanuel Lacour
Le 14/04/2016 16:56, pelotek a écrit :
> Hi Emmanuel, when I add that line to the RT_SiteConfig.pm, I get the message
> "Invalid portlet Dashboards" after restarting the webserver.
> 


copy/paste here you're config (without sensitive informations!)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] [Solved] RE: Installing RT on Centos7

2016-04-14 Thread Emmanuel Lacour
Le 12/04/2016 13:00, Yanni a écrit :
> Emmanuel
> 
> Your set of rpms sorted out my missing "File::Which" dependency.
> 
>

you're welcome :)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Save a Search in Assets

2016-04-14 Thread Emmanuel Lacour
Le 14/04/2016 15:33, Stefan Krüger a écrit :
> Hello,
> 
>  
> 
> is there a possibility to save searches for assets like for tickets (so
> that these searches could be used in dashboards)?
> 

unfortunatly, no :(


patches are welcome ;)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installed extension not working

2016-04-14 Thread Emmanuel Lacour
Le 14/04/2016 16:19, pelotek a écrit :
> For the life of me, I can't figure out why RTx::Calendar is not showing up. 
> I have installed it with cpan, cleared the mason cache, added the Plugin();
> line, and restarted the web server.  However, the extension is not showing
> up in my GUI.  Any ideas?
> 


Did you added the component "MyCalendar" in $HomepageComponents.

You should then be able to show display this calendar component in
you're "RT at a glance" configuration or in a dashboard.



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Installing RT on Centos7

2016-04-11 Thread Emmanuel Lacour

For those who may need it, I just did a quick fresh install of RT 4.4.0
on Centos 7 with only rpm dependencies. I collected some, rebuild others
and put everything here:

http://rt.easter-eggs.org/rpms/el7/README.txt


I give this without any warranty ;)
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


Re: [rt-users] Scrip to enforce maximum ticket status per person per queue?

2016-01-15 Thread Emmanuel Lacour
Le 13/01/2016 20:55, Aaron McCormack a écrit :
> Hi RT Users-
> 
> I'm looking to create a scrip which enforces a maximum number of tickets of a 
> certain status, per person, per queue.
> 
> For example:
> 
> Joe has 3 status open tickets and 4 status stalled tickets.  By policy, Joe 
> is only allowed to have 3 open tickets at once.
> 
> Joe tries to change 1 of the stalled tickets to open, but RT counts the 
> number of status open tickets that Joe already has and doesn't allow the 
> status change.  If Joe then changes 1 open ticket to resolved, then he can 
> change 1 stalled to open, maintaining his limit of 3 status open tickets.
> 
> Has anyone tried enforcing limitation like this or query the status of other 
> tickets in a scrip?
> 


I don't think you should use scrips for this because it will be asynchrone.

I would do:

- set a user or group CustomField to record each ones limits
- add a method to local/lib/RT/User_Local.pm named CheckStatusLimit,
that retrieve the user/group limit, get the list of owned tickets and
check if limit are reached, then return if the new status is allowed or not.
- use callbacks (Tickt/Display.html and other plaes where user can
change status) or override maybe ProcessTicketBasics, to use this method
before accepting status change. Display proper error to user if not allowed


I would avoid enforcing this in Ticket->SetStatus method as you may
wan't to allow others to force status or even scripts.



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] Attaque de type CSRF possible

2016-01-15 Thread Emmanuel Lacour
Le 13/01/2016 10:00, wajdi a écrit :
> 
>   Hi,
> 

hi,

> 
>   Attaque de type CSRF possible
> 
> RT a détecté qu'une attaque de type *CSRF* était possible pour cette
> requête, en raison de L'en-tête "Referrer" envoyée par votre navigateur
> (x.x.x.x:80) n'est pas autorisé par la configuration de RT
> (127.0.0.1:80). Un attaquant malicieux et peut-être en train d'essayer
> de *mettre à jour un ticket* à votre place.Si vous n'êtes pas à
> l'origine de cette requête, alors vous devriez alerter votre responsable
> sécurité.
> 
> Si vous souhaitiez vraiment visiter /Ticket/Update.html et mettre à jour
> un ticket, alors *cliquez ici pour poursuivre votre demande
> *.
> 
> Notice : i use rt4.2.12
> 
> Please help me, how can i resolve this error.
> 
>

You acceded to your RT with url http://196.203.79.151/ but you're RT
configuration as another $WebDomain set (127.0.0.1).

you should acces using the ocnfigured web domain or set
$ReferrerWhitelist or disable CRSF protection.

Explained in details here:
https://bestpractical.com/docs/rt/4.2/RT_Config.html#Extra-security
(RestrictReferrer and ReferrerWhitelist)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] RT Approvals

2015-09-14 Thread Emmanuel Lacour
Le 14/09/2015 10:27, Kobus Bensch a écrit :
> Hi
> 
> I have setup approvals following this doc:
> https://www.bestpractical.com/docs/rt/4.2.12/customizing/approvals.html.
> 
> I would like to setup multiple approvers based on a value in a custom
> field. Is this possible and if so can anybody point me in the right
> direction or to a doc that I can read that will help me to achieve this?
> 
>

you'll have to write code yourself ;)

You cannot use groups for this?


Here is sample untested code (that needs more time to think of) to get
users with a user cf corresponding to ticket cf. Just an idea ...

I would create a new method in local/lib/Ticket_Overlay.pm like:

sub GetApprovers {
my $self = shift;

my $cf_value = $self->FirstCustomFieldValue( 'CF' );

my $Users = RT::Users->new( self->CurrentUser );
$Users->LimitCUstomField( CUSTOMFIELD => 'CF', VALUE => $cf_value );

my @approvers;
while ( my $User = $Users->Next) {
push @approvers, $User->id;
}
return join(',', @approvers);

}

Then in the approval template, something like:

AdminCc: { $Tickets{TOP}->GetApprovers; }


NB:
- you can put all of the code in the template, but having an API method
is a bit better for code maintenance.
- double think of this, using groups is maybe a better idea
- not sure what arguments is accepted in AdminCc (list of users id,
email, ...), see lib/RT/Action/CreateTickets.pm


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] XLS export balks

2015-09-11 Thread Emmanuel Lacour
Le 11/09/2015 15:45, Marc Chantreux a écrit :
>> you would better use a branch for upstream and one for your (or many if
>> you have prod/staging/...).
> 
> i really would like but i don't know how to run RT from the sources
> (it seems you need to install it somewhere and run it from this place).
> 
>> It's easier when you need to upgrade RT or compare your patches with
>> upstream...
> 
> i patch the installed versions and maintain my own repos :( this is sad
> and i would be really happy to change it.  
> 
> 


I ended up storing a configured version in my upstream branch for the
same problem.

So here is the process used here:

- I do a clean ./configure ... and make install of RT (no edition of
config files)
- I put this in git in a branch upstrean/4.2 and tag the release
- I checkout this in a branch "prod"
- I make my custom configuration/patches in prod
- when I need to install an extension, I first install it in upstream
branch and merge it in prod (thus I can patch it in prod if needed)


a new RT release comes:

- I run the same ./configure...make install as previously done
- I put the result in upstream branch and commit this as upgrade to RT 4.2.x
- I merge upstream in prod


you can do it with pure sources, but you won't be able to "easily"
deploy it on servers.



And FYI our developpement rules:

For html files
- uses callback and put them in local directory
- no callback, add the missing one in share/html (patch) (submit it to
upstream if it may be of any interest for anyone else) and add the
callback file in local directory
- need a new mason component: put it in local/html directory
- need to really patch an existing one: do it in place in share/html
(*never copy the file to local dir*, upgrades will be a pain!)


For lib files
- put new methods in local/lib/RT/xxx_Local.pm
- put new objects in local/lib/RT/...
- need to patch an existing method: try to do so by creating a
local/lib/RT/xxx_Local.pm with:

my $old_method = \

*Method = sub {
my $self = shift;
my %args = ( @_ );

  

$old_method->($self, @_);
  


- if you really need to patch the method, do it inplace in lib/RT/...,
*never copy a lib file/method to local dir* or upgrades will be a pain!



et voilà ;)


tip: I just discovered git "submodules" feature that may be used for RT
extensions ... maybe

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] External module publication on CPAN?

2015-09-11 Thread Emmanuel Lacour
Le 11/09/2015 15:58, Marc Chantreux a écrit :
> Hello,
> 
> I wrote a script to supply initial datas to RT from an spreadsheet
> (excel and libreoffice are repported as working). if some advices
> can be given about publishing it (on CPAN), it would be appreciated
> (a good name for the module, a place to register it...). 
> 
> my module is on gh:
> 
> 
> https://github.com/eiro/p5-rtx-provision-read-speadsheet/blob/master/bin/rt-provision-spreadsheet
>  
> 
> and my cpan account is:
> 
> https://metacpan.org/author/MARCC
> 
> 


Have a look here (if not already) for technical aspects:

https://bestpractical.com/docs/rt/4.2/writing_extensions.html

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] RT 4.2.12 and CentOS 7

2015-09-03 Thread Emmanuel Lacour
Le 02/09/2015 19:23, Tom Misilo a écrit :
> Hi,
> 
>  
> 
> I was wondering if anyone has successfully used “make fixdeps” with
> Request Tracker on CentOS 7? As it seems like cpan only installs to the
> local users home directory in a ~/perl5 folder and not systemwide. Which
> when using Request Tracker and mod_fcgid  apache does not find any of
> the modules.
> 
>  


just did it and:

- most perl packages are available through yum with the epel repository
- for last missing cpan modules, you can either try to find them
packaged on another place on the web, build them or install through cpan.

For CPAN, make sure package "perl-homedir"  isn't installed ... Or tweak
your cpan configuration.



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] French actions menu on RT 4.0.19 (Ubuntu 14.04 LTS)

2015-06-04 Thread Emmanuel Lacour

Le 04/06/2015 12:23, Guillaume Hilt a écrit :

Hello,

I'm using RT 4.0.19 on a server running Ubuntu 14.04 LTS.
That's the last available RT release on this version.

I have a small issue.
Some actions menu entries aren't translated in French although the fr.po
file got them :
- Open It
- Stall
- Reject



on 4.0.19, they are in fr.po, but unstranslated.

to fix it on your instant, create a file fr.po in local rt directory:

local/po/fr.po (don't know the exact path for ubuntu)

with content such as:

--snip ---
msgid 
msgstr 
MIME-Version: 1.0\n
Content-Type: text/plain; charset=UTF-8\n
Content-Transfer-Encoding: 8bit\n

msgid Open It
msgstr Ouvrir

msgid Reject
msgstr Rejeter

...
--snip ---

then restart your web server.


you are also welcome on https://translations.launchpad.net/rt to update 
missing translations :)


--
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] XLS report failure

2015-01-30 Thread Emmanuel Lacour

Le 29/01/2015 22:01, Boris Epstein a écrit :

Thanks for your help Alex!

Do you know if there are any DB changes involved?




no, this extension just format standard RT search results, it doesn't 
change anything on DB side.


--
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com



Re: [rt-users] Business hour

2014-11-20 Thread Emmanuel Lacour
On Wed, Nov 19, 2014 at 05:55:09PM +, smail tahir wrote:
Could your help me please, 
 
i would like to create a script on resolve, that update custum field
called “ Type-Intevention” with one of 2 value
 
Value 1 :  “On Site” : when the resolution date time is in Business hour “
Between 09am  18pm from Monday to Friday
 
Value 2 : “Hors Site” : when the resolution date time is hors Business
Hour “ between 18pm and 09am,  Sunday  Saturday
 


You just have to use the perl module Business::Hours available on CPAN
against the ticket resolution date.

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] Closing all incidents by a specific Owner

2014-11-19 Thread Emmanuel Lacour
On Wed, Nov 19, 2014 at 11:11:53AM +0100, Tamás, Szép wrote:
 Hello all,
 
 Is there a way (script/SQL) to close all incidents owned by one specific
 user? (mass closing)
 


you can use the WEB UI, search for all tickets wiht this owner, then in
the search results, click on Bulk update  and change status for all
ticket at once.

on command line, you can use the following:


you can also use the RT cli (http://requesttracker.wikia.com/wiki/CLI),
or rt-crontool:

something like:

./bin/rt-crontool --search RT::Search::FromSQL --search-arg Owner = 'THE 
OWNER' --action RT::Action::SetStatus --action-arg resolved


or even write a small perl script using RT API



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] Hiding unused fields

2014-11-19 Thread Emmanuel Lacour
On Tue, Nov 18, 2014 at 11:30:15AM -0800, JZ wrote:
 I would like to hide some fields that we are not using:
 
 Time Estimated
 Time Worked
 Time Left
 
 I would like to hide them everywhere including the Jumbo view.
 
 
 I am using version 4.2.0.  How can I do this?
 

you can try to hide them using a custom css.


example:

go to Menu-Admin-Tools-Theme

and add to the css:

tr.time.worked {
display: none;
}




else, you have to patch RT.

Find files to modify using:

$ grep TimeEstimated share/html/ -r


I recommend using some vcs like git to track your changes.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] rt asterisk

2014-11-05 Thread Emmanuel Lacour
On Tue, Nov 04, 2014 at 11:11:53AM -0800, Shahab Sharifzadeh wrote:
Thanks...
I want to create a ticket with attachment...(callervoice.gsm)
But according to my search in web I can not use from Rest because when I
create ticket, the attach file was not sent with them...


You need to first create the ticket by rest and retrieve the user Id, then add
a correspondance or comment by rest including your gsm file as attachments. See
sample python code used here attached to this email.



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
# peephone
#
# (c) 2009 - Julien Danjou jdan...@easter-eggs.com
#

import urllib, urllib2
from poster.encode import multipart_encode
from peephoneconfig import PeephoneConfig

class PeephoneRt:
def __init__(self):
config = PeephoneConfig()
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password(realm='Ee',
  uri=config.get('rt', 'url'),
  user=config.get('rt', 'login'),
  passwd=config.get('rt', 'password'))
opener = urllib2.build_opener(authinfo)
urllib2.install_opener(opener)

def ticket_create(self, content):
values = { 'content' : content }
data = urllib.urlencode(values)
req = urllib2.Request(%s/REST/1.0/ticket/new % PeephoneConfig().get('rt', 'url'), data)
return urllib2.urlopen(req)

def ticket_get(self, tnumber):
config = PeephoneConfig()
f = urllib2.urlopen('%s/REST/1.0/ticket/%s/show' % (config.get('rt', 'url'), tnumber))
line = f.readline()
contents = {}
while line:
line = line.strip()
i = line.find(: )
if i  0:
contents[line[:i]] = line[i + 2:]
line = f.readline()
return contents

def ticket_edit(self, tnumber, field, value):
config = PeephoneConfig()
return urllib2.urlopen('%s/REST/1.0/ticket/%s/edit?content=%s:+%s' \
% (config.get('rt', 'url'), tnumber, field, value))

def ticket_steal(self, tnumber):
config = PeephoneConfig()
values = { 'content' : Action: Steal\nTicket: %s % tnumber }
data = urllib.urlencode(values)
req = urllib2.Request(%s/REST/1.0/ticket/%s/take
  % (PeephoneConfig().get('rt', 'url'), tnumber),
  data)
return urllib2.urlopen(req)

def ticket_comment(self, tnumber, comment=, attachment=None):
config = PeephoneConfig()
if attachment:
values = { 'content': Action: comment\nText: %s\nAttachment: %s \
   % (comment , attachment),
   'attachment_1': file(attachment, rb) }
else:
values = { 'content': Action: comment\nText: %s % comment }
datagen, headers = multipart_encode(values)
data = .join(datagen)
req = urllib2.Request(%s/REST/1.0/ticket/%d/comment % \
  (PeephoneConfig().get('rt', 'url'), int(tnumber)),
  data, headers)
return urllib2.urlopen(req)


Re: [rt-users] rt asterisk

2014-11-05 Thread Emmanuel Lacour
On Wed, Nov 05, 2014 at 05:20:52AM -0800, Shahab Sharifzadeh wrote:
 Thanks you...
 
 i tried according to my search in web wrote the following code by php:
 
 ?php
 
 $attachment_1 = file_get_contents('/opt/app/test/1.jpg'); 
 $content = id: 12\n; 
 $content = $content . Action: comment\n; 
 $content = $content . Text: Im adding some text\n And adding some more 
 text\n And some more\n; 
 $content = $content . TimeWorked: 30\n; 
 $content = $content . Attachment: 1.jpg\n; 

$content = $content . Attachment: 1\n;

I guess.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] rt asterisk

2014-11-05 Thread Emmanuel Lacour
On Wed, Nov 05, 2014 at 06:56:28AM -0800, Shahab Sharifzadeh wrote:
  
  Does not work :( :
  

sorry, no time to debug this now, maybe someone else on this list ...

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] how add attachment to my perl file

2014-11-05 Thread Emmanuel Lacour
Le 05/11/2014 19:47, Shahab Sharifzadeh a écrit :
 I have a perl code.
 in the code add comment on ticket (rt)..
 how can i add attach file to this code?
 

RTFM?


perldoc RT::Client::REST
[...]
comment (ticket_id = $id, message = $message, %opts)

Comment on a ticket with ID $id. Optionally takes arguments cc and
bcc which are references to lists of e-mail addresses and attachments
which is a list of filenames to be attached to the ticket.
[...]

;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] rt asterisk

2014-11-04 Thread Emmanuel Lacour
On Tue, Nov 04, 2014 at 02:55:43AM -0800, Shahab Sharifzadeh wrote:
 
 hi
 good time
 
 i want to join rt(request tracker) to asterisk by rt-soap-server.pl.
 but i dont no what to do...
 
 1- i installed- SOAP::Lite and MIME::Entity
 2-after that ,how I run ./rt-soap-server.pl ? And how configure?
 

rt soap server is rather obsolet, you would better use the REST
interface.

Here we linked asterisk to RT in the following ways:

- our heldesk dialplan ask for a ticket number
- if no ticket number is given, asterisk use RESt to create a new RT
  ticket with the requestor set using caller phone and our ldap
  directory
- if a ticket is found, nothing is done
- once the call hangup, the conversation recorder is added as a comment
  to the previous exisitng or created ticket.


On RT site, we added the ability to call people by a simple link and
component that tell asterisk via IAX to call the number from the sip
attached to the current rt user. Then again the conversation is attached
to the ticket and timeworked updated.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Getting names/values for all custom fields attached to a ticket

2014-11-04 Thread Emmanuel Lacour
On Tue, Nov 04, 2014 at 02:42:57PM +, Chris Down wrote:
 Hello,
 
 In the Perl API, how do I get the names/values of all custom fields
 attached to a ticket? I looked at the documentation, but I only see
 ways to check for custom fields globally, not how to get a list of
 all the custom fields that apply to a single ticket.
 

my $Ticket = RT::Ticket-new( $CurrentUser );
$Ticket-Load(ID);

my $CustomFields = $Ticket-CustomFields;

while (my $CustomField = $CustomFields-Next) {
print $CustomField-Name.: .$CustomField-Content.\n;
}


without testing, it should looks like this ;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Getting names/values for all custom fields attached to a ticket

2014-11-04 Thread Emmanuel Lacour
On Tue, Nov 04, 2014 at 03:44:55PM +, Chris Down wrote:
 I think I eventually found what I want[0]:
 
$ticket-CustomFieldValuesAsString($custom_field_name);

$ticket-FirstCustomFieldValue($custom_field_name);

looks what you're lookign for ;)


RT::Ticket is based on RT::Record, so you can user every methods
available on this last one on a ticket.




-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] How do you get the SQL that is generated from the ticketSQL

2014-10-28 Thread Emmanuel Lacour

do export DBI_PROFILE=2 before running your command ;)

(see also $StatementLog in RT_Config.pm)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Graphical representation of open tickets

2014-10-23 Thread Emmanuel Lacour
On Thu, Oct 23, 2014 at 03:04:29PM +0200, markus.wildb...@eu.magna.com wrote:
Hi there!
 
Has anybody done a graphical representation (line graph) of open tickets
over time? Our management forced me to create such a representation.
I'm looking for a tool doing this graphing, having an x-axis as timeline
and a graph for Created, Resolved and Open Tickets per day (per
queue, per user?!)
 
Before I start to code these things I wanted to ask you, if there are
maybe some snippets of code which I could use.
Has anybody done such things before?
 

I know two extensions:

- RT::Extension::JSGantt: not really fit your needs but may be a base
  for coding
- RTx::Timeline looks close to your needs, but pretty
  outdated/unmaintained


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Change AutoResponse Global Template based on time of the day

2014-10-16 Thread Emmanuel Lacour
Le 15/10/2014 19:50, rjandric via rt-users a écrit :


In your custom condition you should be able to finish by:

if ($hours ...) {
  $self-SetTemplate(WorkingHoursTemplateName);

} elsif ($hours ) {
  $self-SetTemplate(NonWorkingHoursTemplateName);
}

return 1;

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Send email reminder fails with undefined value

2014-10-16 Thread Emmanuel Lacour
Le 15/10/2014 20:38, fleon a écrit :
 I am having issues making your example work.
 I created
 /opt/rt4/local/html/MyCallbacks//Elements/ShowHistory/SkipTransaction and it
 contains the following:
 
 

Wrong path, it must be:

/opt/rt4/local/html/Callbacks/Whatever/Elements/ShowHistory/SkipTransaction



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Emails to Queue Alias, still merge to other queue

2014-10-16 Thread Emmanuel Lacour
Le 15/10/2014 22:59, Root Kev a écrit :
 Any chance you could point me in the right direction as to how to patch
 Email.pm to do the routing based on recipient email address?  
 


I'm sorry, not until ...some months, I'm very busy on many RT projects :(


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] hide version

2014-10-15 Thread Emmanuel Lacour
Le 15/10/2014 10:01, Cedric Pages a écrit :
 Hi there,
 
  
 
 I’m trying to hide version on login page with version 4.2.8 but without
 success.
 
 Anybody has already done it and would be any help?
 


grep for RT::VERSION in share/html and you will find which files you
have to patch ;)

Remember to hide also your ssl version if you trust security by
obscurity ;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Change AutoResponse Global Template based on time of the day

2014-10-15 Thread Emmanuel Lacour
I think (never tried) that it could be possible to write a custom scrip
action that select the template based on a time condition.

This way you have just to use this action where needed and create the
pre-defined templates without changing them dynamically.

You can also write perl conditions in your template, using {}. Thought
too much perl in templates make them often difficult to read/modify.

If you prefer to stay with a cron job you would better write it using
perl and use the RT API to change the template. Writing directly to the
RT DB is always a bad idea imho.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Reopen closed ticket

2014-10-15 Thread Emmanuel Lacour
Le 15/10/2014 09:07, Matthias Henze a écrit :
 Hi,
 
 how can an AGENT reopen a closed (NOT resolved, closed) ticket?
 


there isn't a stock closed status in standard RT. If you have one,
it's because you changed lifecycles (I expect you have a recent version).

You can use those Lifecycles (see
http://www.bestpractical.com/docs/rt/4.2/customizing/lifecycles.html) to
setup this:

an allowed transition:
transitions = {
...
closed = [ 'open', ],


a dedicated right if needed:
rights = {
'closed - open' = 'ReOpenTicket',

an action to let users do this in ticket action menu:
actions = {
...
'closed - open' = { label = 'Re-open', update = 'Comment' },

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Emails to Queue Alias, still merge to other queue

2014-10-15 Thread Emmanuel Lacour
Le 09/10/2014 21:41, Root Kev a écrit :
 Hello,
 
 We have setup aliases for sendmail that route incoming emails to the
 correct queue:
 Example:
 
 #RT Mailgate user for it
 it: |/opt/rt4/bin/rt-mailgate --queue 'it' --action correspond --url
 http://tracker.company.net/rt;
 it-comment: |/opt/rt4/bin/rt-mailgate --queue 'it' --action comment
 --url http://tracker.company.net/rt/;
 
 #RT Mailgate user for production
 production: |/opt/rt4/bin/rt-mailgate --queue 'production' --action
 correspond --url http://tracker.company.net/rt;
 production-comment: |/opt/rt4/bin/rt-mailgate --queue production
 --action comment --url http://tracker.company.net/rt/;
 
 
 We have started having an issue when an internal user forwards an email
 with [ company.com http://company.com #1234] that they have been CCed
 on, to a production support queue by changing the To address to the
 email address for that queue, but RT is seeing the original ticket
 number in the subject and is merging the email with the comment to the
 original ticket.
 
 This has caused comments meant for internal users, ie: Is this a bug?
 to be sent to a customer unintentionally.
 
 Is there any way to force RT to respect the incoming email/queue from
 rt-mailgate over merging by the ticket numbers (when this type of thing
 occurs)?
 


no, you have to patch RT (lib/RT/Interfaces/Email.pm:sub Gateway) or
disallow the user to send a mail to a queue where the ticket doesn't
belong to, by writing a MailPlugin
(http://www.bestpractical.com/docs/rt/4.2/rt-mailgate.html#WRITING-PLUGINS).


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Exporting Time spent transactions

2014-10-15 Thread Emmanuel Lacour
Le 09/10/2014 03:48, Gaston Huot a écrit :
 Hello.
 
 Is there a simple and easy way to *export *all (or some) time spent
 transactions.
 
 By simple I mean just using the basic RT functionality.
 


you cannot export transactions using RT UI. You can just export
tickets (and their timeworked value for example). To export
transactions, you have either to write a custom perl script using the RT
API (not that difficult if you know perl) or select from the
transactions table of the DB.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Date formatting

2014-10-15 Thread Emmanuel Lacour
Le 15/10/2014 10:21, Rinke Colen a écrit :
 Does anyone know how to format the date/time that {$Ticket-Created}
 returns in my email template? I want it to read Wednesday October 8,
 2014 at 5:31 PM (CET) or Woensdag 8 oktober 2014 om 17:31 (CET).
 (Second version is Dutch.)
 


Use $Ticket-CreatedObj instead of $Ticket-Created, this will give you
an RT::Date object. Then look at lib/RT/Date.pm there is many formatting
methods. If none suit your needs, you can easily write new one in
local/lib/RT/Date_Local.pm


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Date formatting

2014-10-15 Thread Emmanuel Lacour
Le 15/10/2014 10:40, Rinke Colen a écrit :
 
 
 OK, great. Problem is that my Perl knowledge is too small to fully
 understand the documentation on RT::Date or how to use the formatters
 it mentions. Could anyone give an example?
 


$Ticket-CreatedObj-LocalizedDateTime( DateFormat =
'date_format_full', TImeFormat = 'time_format_full', AbbrDay = 0,
AbbrMonth = 0, Timezone = 'user' );

Montag, 19. Mai 2014 16:04:29

is not far thant what you want


else you have to write a custom method ...

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Send email reminder fails with undefined value

2014-10-15 Thread Emmanuel Lacour
Le 15/10/2014 14:20, fleon a écrit :
 I found the thread on the list
 http://requesttracker.8502.n7.nabble.com/Suppressing-RT-System-itself-entries-in-Ticket-History-td52865.html
 that explains that a method to suppress these kind of elements in the ticket
 history is to code a callback where you can skip some transactions.
 
 What would be the name of the transaction i need to skip? I only want to
 suppress outgoing emails done by the root user itself (i have another super
 user - myself, and i don't want to skip from that)
 
 

here is a part of what I use here. I Hide most day to day useless
transaction in ticket display page, thought I allow to see all when
clicking on History link. You should find what you wan't in this sample
code :)

local/html/Callbacks/YourOrg/Elements/ShowHistory/SkipTransaction:


%init
# Hide systems transaction (except comments/corresponds) in history by
default
$$skip = 1 if ( ( $r-uri  $r-uri !~ /History.html/ )
 ( ( $Transaction-Type  $Transaction-Type =~
m/^(EmailRecord|CommentEmailRecord|CustomField)$/ )
|| ( $Transaction-Field  $Transaction-Field =~
m/^(Owner|Status|Queue|EeCustomer)$/ )
) );
/%init
%args
$Transaction = undef
$skip = undef
/%args




-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Send ticket to other queue from the actions menu

2014-10-09 Thread Emmanuel Lacour
On Wed, Oct 08, 2014 at 11:12:15PM +0200, Rinke Colen wrote:
I know how to define actions in RT_SiteConfig.pm like this:
 
  actions = [
      '* - closed' = {
          label  = 'Close',
          update = 'Respond',
      },
 
But I need something fancier now. I want to send my ticket to another
queue from the Actions menu. I want this action to be available only from
some statuses in the lifecycle. How can I do this? (I have already
configured a mapping under __maps__.)
Rinke


You have to use a callback (a file named
local/html/Callbacks/YourOrg/Elements/Tabs/Privileged). Then inside you
have to write your logic to finally add the action to the menu, example:

%init
my $request_path = $HTML::Mason::Commands::r-path_info;


# Only on ticket pages
if ( $request_path =~ qr{^/Ticket/.*\.html}  $m-request_args-{'id'}
  $m-request_args-{'id'} =~ /^\d+$/ ) {

my $Ticket = RT::Ticket-new( $session{'CurrentUser'} );
$Ticket-Load( $m-request_args-{'id'} );

# Only if status is FIXME
if ( $Ticket-Status eq 'FIXME' ) {
my $tabs = PageMenu;
my $actions = $tabs-child( 'actions' );

my $Queue = RT::Queue-new( $session{'CurrentUser'} );
$Queue-Load('YourTargetQueue');

# Add our custom action here
$actions-child(
'sendtoqueueX' = title = loc('Send to queue X'), path =
'/Ticket/Display.html?id='.$Ticket-Id.'Queue='.$Queue-id
 );
}
}
/%init

@BPS: would be nice to be able to specify an url in Lifecycle actions
with basic replacements (__id__, ...)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Send ticket to other queue from the actions menu

2014-10-09 Thread Emmanuel Lacour
On Thu, Oct 09, 2014 at 10:17:09PM +1100, Alex Peters wrote:
Does this code also actually move the ticket into the other queue?
 

by the fact that it calls the Display.html template with the Queue
attribute. Each time Display.html is called on a ticket, it first
process arguments before displaying the ticket (including the change
results).

I'm interested in doing something similar: setting up menu items to
quickly set the ticket's Starts date to predefined relative future values.

you can do this with such callback, without any doubt :)


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] Display number of tickets to each queue in last 12 months

2014-10-08 Thread Emmanuel Lacour
On Wed, Oct 08, 2014 at 07:30:49AM -0700, scott.dalzell wrote:
 What is the best way to display the number of tickets each queue has received
 over the past 12months?
 i would like to add it to the homepage so we and easily monitor which queues
 are reciving a lot of tickets
 


Do a search with term:

Field: Created
Condition: after
Value: 1 year ago

then click on chart, generate a per queue ticket count, save this chart
as a SavedChart and use it on RT at a glance configuration page or a
dashboard.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training November 4  5 Los Angeles
http://bestpractical.com/training


Re: [rt-users] HTML email with inline images.

2014-07-16 Thread Emmanuel Lacour
On Wed, Jul 16, 2014 at 03:22:20PM +0100, Derek keith wrote:
Thanks Kevin
 
That appears to have fixed Problem1.
 
Now just need to get inline pictures to show on the email.
 

you may have a look at the last patch here:

http://issues.bestpractical.com/Ticket/Display.html?id=29967



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Processing attachments outside RT

2014-07-01 Thread Emmanuel Lacour
On Tue, Jul 01, 2014 at 06:03:21PM +0800, pj loh wrote:
Hi,

Hi,

[...]

I've looked through the RT::Attachment documentation, experimented with
it, and also searched through the RT mailing list archives. The best I can
do is to display the content of the attachment, but I cannot figure out
how to 'export' an attachment to the filesystem. Is this even possible
within RT? I've not come across anyone discussing anything similar.


here is an example I used to dump tickets to files:


my $Attachments = $Transaction-Attachments;
$Attachments-OrderBy( FIELD = 'id', ORDER = 'ASC' );
while ( my $Attachment = $Attachments-Next ) {
next unless ( $Attachment-Filename );
my $filename = $Attachment-Filename;
$filename =~ s/\//-/g;
my $file_path = $attachments_dir./.$Ticket-id.-.$filename;
open( FILE, '' ,$file_path ) or die Can't open $file_path: $!\n;
print FILE $Attachment-OriginalContent;
close ( FILE );
}



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] In Line Images in Emails

2014-06-02 Thread Emmanuel Lacour
On Mon, Jun 02, 2014 at 09:48:03AM +0100, Kevin Curtis wrote:
Hi Emmanuel,
 
The test case for us was quite simple.  We use Miscrosoft Office Outlook
as the email client.
 
    1) Create a ticket
 
    2) The Ticket owner updates the ticket by sending an email to RT that
has
 
   an inline image
 
    3) RT sends an email to the Requestor and CC’s that has been converted
to plain text
 


So it looks that your Template that is used to send this email is not
using something like:


RT-Attach-Message: yes
Content-Type: text/html


[...]

{$Transaction-Content( Type = text/html)}


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Re: [rt-users] In Line Images in Emails

2014-06-02 Thread Emmanuel Lacour
On Mon, Jun 02, 2014 at 10:27:07AM +0100, Kevin Curtis wrote:
 Hi,
 The Template for Correspondence is as you show below, as does the one for 
 Transaction.  Is there another that I should check?
 


and your scrip is really using this template or the non-html one?

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] creating tickets with CF values without ModifyCustomField right

2014-06-02 Thread Emmanuel Lacour
On Mon, Jun 02, 2014 at 02:44:14PM +0200, Christian Loos wrote:
 Hi,
 
 is it possible to create tickets with CF values for users that don't
 have the ModifyCustomField right?
 Currently if fails with Permission Denied in
 RT::CustomField-AddValueForObject().
 
 We have some users that use the RT WebUI to create tickets and must
 enter on ticket create some CF values.
 The same users also have ShowTicket (and ShowQueue) right to get later
 some informations about the ticket history.
 This users are don't allowed to change CF values later on the tickets,
 so I can't give them the ModifyCustomField right.
 
 It is also not obvious that you have to grant users the
 ModifyCustomField right to be able to create tickets with CF values, as
 they want to *Create* values and not *Modify* values.
 As there isn't an CreateCustomField(Values) right I think at least for
 ticket create it would be better if SeeCustomField would be sufficient
 to create tickets with CF values.
 

Indeed there is only See/Modify customfield rights (not set).

That's a known feature request:
http://issues.bestpractical.com/Ticket/Display.html?id=14974

that is still unimplemented  ... a patch may help this feature to be present in 
a 4.4 release i suppose ;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Different template according to requestor email address

2014-05-30 Thread Emmanuel Lacour
On Fri, May 30, 2014 at 12:59:48AM -0700, andkulb wrote:
 
 How can I separate these to get different messages according to their email
 address?
 


scrips uses lib/RT/Action/SendEmail.pm which is designed to send one
template to all scrip recipients.

it's not unfaisible to send different templates to different recipients,
you have to hack this file (and maybe others) a lot ...

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] In Line Images in Emails

2014-05-30 Thread Emmanuel Lacour
On Fri, May 30, 2014 at 11:57:22AM +0100, Kevin Curtis wrote:
 
We have found that whenever RT receives an email that contains an inline
image (internally or externally), any emails that get sent out by RT (for
example to the CC list or the requestor or the owner) the email that gets
sent out has the text/html section stripped of any html formatting and the
text is encased in a pre .. /pre block.

html/body is stripped in RT::Transaction-Content, but not wrapped in
pre ...

can you send more information (test case) for this problem?

 
There is not an image either.
 

The problem appears when the image is referenced as src=cid: There is a
bug caused by the fact that RT changes multipart/related to
multipart/mixed that breaks displaying of inline images.


I worked a bit on this but did not found a beautiful fix (as a template
may makes reference to another Transaction content than the current one
...).

A quick fix is to hack RT::Transaction::Content so it looks for CIDs,
then try to find corresponding images attachments in
RT::Tickets-Attachments, then replaced the CID by
src=data:image


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Maximum recipients allowed

2014-05-19 Thread Emmanuel Lacour
On Mon, May 19, 2014 at 02:41:19PM +0200, Olivier Lumineau wrote:
 Hi,
 we are using RT 3.8.7, and to filter spam more efficiently, I wanted
 to know if there was an easy way in RT to limit ticket recipients
 (to + cc + bcc) .
 
 I don't want more than 10 or 15 recipients by ticket, to prevent
 that a spam withs hundreds mail addresses pollute our RT.
 


I suppose it's for incoming mails, right? If so, best place is in the
MTA/MDA imho.

If you wan't to limit this when people enter adresses in RT web
interface, then you have to use a callback like the one use in the
extension RT::Extension::MandatoryRequestor.



-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training


Re: [rt-users] Mail and set prio?

2014-05-12 Thread Emmanuel Lacour
On Mon, May 12, 2014 at 11:19:12AM +, Martin Petersson wrote:
Hello,
I wonder if there´s a way to set the priority in the mail when sending the
mail to RT? 
 


It depends on which condition should trigger the priority.

If you wan't to set the priority with a keyword in the body, use:
RT::Extension::CommandByMail.

If you wan't to set the priority in a queue for every emails to this
queue, you may use the Priority field's in the queue configuration (see
alos: http://requesttracker.wikia.com/wiki/Priority).

Else you can write a custom scrip that allows to do anything in this
area ;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training


Re: [rt-users] Renaming lifecycles possible?

2014-05-07 Thread Emmanuel Lacour
On Wed, May 07, 2014 at 02:51:53PM +0200, Rinke Colen wrote:
 I'm having trouble renaming a lifecycle. I had a lifecycle in use
 called 'indident_mgmt' and I want to rename it to 'incident
 management'. In RT_SiteConfig.pm I canged the following:
 
  Set(%Lifecycles,
  indident_mgmt = {
  initial = [ 'new' ],
 
 to:
 
  Set(%Lifecycles,
  'incident management' = {
  initial = [ 'new' ],
 
 After saving the file, I log in as root and open the create new queue
 form. To my surprise the lifecycle dropdown still shows
 'incident_mgmt' and doesn't show 'incident management'. I didn't
 change the lifecycle of the only queue that used 'incident_mgmt' to
 e.g. 'default' before renaming 'incident_mgmt'.
 


the proper way is to duplicate your lifecycle, setup transitions, then
restart web server, then go to queue configuration and change lifecycle.

you can after this remove the old one.

another way:

- rename lifecyle in RT_SiteConfig.pm
- rename lifecycle in database (field Lifecycle in Queues table)
- restart web service

;)

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training


Re: [rt-users] Sorting by the value of a custom field in search results *numerically*

2014-05-05 Thread Emmanuel Lacour
On Fri, May 02, 2014 at 01:52:06PM -0700, Landon Stewart wrote:
Hello,
It seems that the sorting by custom field in search results is always done
alphabetically.  
For example sorting by CF that contains only integers in descending order:
4
3
2
11
1
Is there a way to sort search results by custom field numerically?



I use the attached patch for 4.2.3 (not very efficient, but it works).


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
diff --git a/rt/local/lib/RT/CustomFieldValues_Local.pm b/rt/local/lib/RT/CustomFieldValues_Local.pm
new file mode 100644
index 000..d167f18
--- /dev/null
+++ b/rt/local/lib/RT/CustomFieldValues_Local.pm
@@ -0,0 +1,45 @@
+package RT::CustomFieldValues;
+
+use strict;
+no warnings qw(redefine);
+
+
+=head2 Array
+
+Return the values as an array
+
+=cut
+
+sub Array {
+my $self = shift;
+
+my @values;
+while (my $value = $self-Next) {
+push @values, $value;
+}
+
+return @values;
+
+}
+
+=head2 SortedArray
+
+Return the values as an array sorted by Sortorder, then by name using natural sort
+
+=cut
+
+sub SortedArray {
+my $self = shift;
+
+my @values = $self-Array;
+
+use Sort::Key;
+use Sort::Key::Natural qw(natkeysort);
+
+my @sorted = natkeysort { $_-Category. .$_-SortOrder. .$_-Name } @values;
+
+return @sorted;
+
+}
+
+1;
diff --git a/rt/share/html/Elements/EditCustomFieldSelect b/rt/share/html/Elements/EditCustomFieldSelect
index 222fcd9..e8548d8 100644
--- a/rt/share/html/Elements/EditCustomFieldSelect
+++ b/rt/share/html/Elements/EditCustomFieldSelect
@@ -110,7 +110,8 @@ jQuery(  function () {
   /div
 %   }
 %   my $CFVs = $CustomField-Values;
-%   while ( my $value = $CFVs-Next ) {
+%   my @sorted_values = $CFVs-SortedArray;
+%   foreach my $value ( @sorted_values ) {
 % my $content = $value-Name;
 % my $labelid = $name-. $value-id;
 div data-name=% $value-Category || '' %
@@ -186,9 +187,10 @@ $MaxValues = 1
 % $_ = lc $_ foreach @Default;
 % my $selected;
 % my $CFVs = $CustomField-Values;
+% my @sorted_values = $CFVs-SortedArray;
 % my @levels;
-% while ( my $value = $CFVs-Next ) {
+% foreach my $value ( @sorted_values ) {
 %   my $name = $value-Name;
 %   my $category = $value-Category || '';
 %   my $level = (split /:/, $category, 2)[0] || '';
 %   while (@levels) {
-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training

Re: [rt-users] Sorting by the value of a custom field in search results *numerically*

2014-05-05 Thread Emmanuel Lacour
On Mon, May 05, 2014 at 02:21:28PM +0200, Emmanuel Lacour wrote:
 On Fri, May 02, 2014 at 01:52:06PM -0700, Landon Stewart wrote:
 Hello,
 It seems that the sorting by custom field in search results is always 
  done
 alphabetically.  
 For example sorting by CF that contains only integers in descending 
  order:
 4
 3
 2
 11
 1
 Is there a way to sort search results by custom field numerically?
 
 
 
 I use the attached patch for 4.2.3 (not very efficient, but it works).
 


I misread your email, my patch just fix sorting on CF edit pages, not in
search results.


-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com
-- 
RT Training - Dallas May 20-21
http://bestpractical.com/training


  1   2   3   4   5   6   7   >