Re: [rt-users] [bug] Message without text but with attachment(s) is not recodered

2007-08-20 Thread Alain Sips

Hello Boris,

Thanks for the reply. This works perfect for the Tickets now. The bulk 
update doesn;t seem to work yet, however we don;t really use that for 
attaching files, so that is no problem for us.


Thanks again for the great help !

Alain



Boris Lytochkin schreef:

The reason is in share/html/Ticket/Display.html:

$ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'};
if ( $ARGS{'UpdateTimeWorked'} || (
defined $ARGS{'UpdateContent'}
 $ARGS{'UpdateContent'} ne ''
 $ARGS{'UpdateContent'} ne -- \n
   . $session{'CurrentUser'}-UserObj-Signature ) )
{
$ARGS{UpdateAttachments} = $session{'Attachments'};
ProcessUpdateMessage(
ARGSRef   = \%ARGS,
Actions   = [EMAIL PROTECTED],
TicketObj = $TicketObj,
);
delete $session{'Attachments'};
}

But should be

if ( $ARGS{'UpdateTimeWorked'} || (
defined $ARGS{'UpdateContent'}
 $ARGS{'UpdateContent'} ne '' ) ||
scalar(keys(%{$session{'Attachments'}})) )
{
$ARGS{'UpdateContent'} = $ARGS{'UpdateContent'}.-- 
\n.$session{'CurrentUser'}-UserObj-Signature;
$ARGS{UpdateAttachments} = $session{'Attachments'};
ProcessUpdateMessage(
ARGSRef   = \%ARGS,
Actions   = [EMAIL PROTECTED],
TicketObj = $TicketObj,
);
delete $session{'Attachments'};
}

Additionally, 'IncludeSignature = 0' must be set in MessageBox on Update.html 
page.


The same situation is with BulkUpdate form, it must be like this:

# Prepare for ticket updates
if ($ARGS{'UpdateContent'}) {
if ( $ARGS{'UpdateContent'} ne '' || 
scalar(keys(%{$session{'Attachments'}})) ){
   $ARGS{'UpdateContent'} .= \n-- 
\n.$session{'CurrentUser'}-UserObj-Signature;
   $do_comment_reply = 1;
}
}

with  'IncludeSignature = 0' set in MessageBox.


'IncludeSignature = 0' should be used because of different wrapping
styles - make your signature be with looong lines without
hand-made wrapping (using \n) - RT will record your signature as text because
$ARGS{'UpdateContent'} ne -- \n.$session{'CurrentUser'}-UserObj-Signature )
will be true because of broken '\n' sequence.



  


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

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


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


[rt-users] Re: Slow Query

2007-08-20 Thread Asif Iqbal
I am reposting in case anyone missed my previous post

On 8/17/07, Asif Iqbal [EMAIL PROTECTED] wrote:
 I have few queries that are extremely slow. I am using RT 3.4.5, Perl
 5.8.6, Solaris 10 x86, Apache/1.3.33 (Unix) mod_perl/1.29
 mod_ssl/2.8.22 OpenSSL/0.9.7g, mysql 4.0.24, DBIx::SearchBuilder 1.40.
 Is there any tweak to fix the slow querry?

 Slow Query Logs:

 # Query_time: 558  Lock_time: 0  Rows_sent: 0  Rows_examined: 2442535
 SELECT COUNT(DISTINCT main.id) FROM Tickets main , Transactions
 Transactions_1, Attachments Attachments_2  WHERE ((Transactions_1.O
 bjectType = 'RT::Ticket')) AND ((main.EffectiveId = main.id)) AND
 ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ( (
  (Attachments_2.Content LIKE
 '%txcomber%')AND(Attachments_2.TransactionId =
 Transactions_1.id)AND(main.id = Transactions_1.ObjectId
 ) ) );

 # Query_time: 535  Lock_time: 0  Rows_sent: 1  Rows_examined: 1733112
 SELECT COUNT(DISTINCT main.id) FROM Tickets main , Transactions
 Transactions_1, Attachments Attachments_2  WHERE ((Transactions_1.O
 bjectType = 'RT::Ticket')) AND ((main.EffectiveId = main.id)) AND
 ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ( (
  (Attachments_2.Content LIKE
 '%txcomber%')AND(Attachments_2.TransactionId =
 Transactions_1.id)AND(main.id = Transactions_1.ObjectId
 ) ) );

 # Query_time: 526  Lock_time: 0  Rows_sent: 1  Rows_examined: 1733130
 SELECT COUNT(DISTINCT main.id) FROM Tickets main , Transactions
 Transactions_1, Attachments Attachments_2  WHERE ((Transactions_1.O
 bjectType = 'RT::Ticket')) AND ((main.EffectiveId = main.id)) AND
 ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ( (
  (Attachments_2.Content LIKE
 '%txcomber%')AND(Attachments_2.TransactionId =
 Transactions_1.id)AND(main.id = Transactions_1.ObjectId
 ) ) );

 # Query_time: 528  Lock_time: 0  Rows_sent: 0  Rows_examined: 1733137
 SELECT DISTINCT main.* FROM Tickets main , Transactions
 Transactions_1, Attachments Attachments_2  WHERE
 ((Transactions_1.ObjectTyp
 e = 'RT::Ticket')) AND ((main.EffectiveId = main.id)) AND
 ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ( (
 (Attach
 ments_2.Content LIKE '%txcomber%')AND(Attachments_2.TransactionId =
 Transactions_1.id)AND(main.id = Transactions_1.ObjectId) ) )  O
 RDER BY main.id ASC;

 # Query_time: 2095  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
 SELECT GET_LOCK('Apache-Session-d7ca7d5da9351479f35fdc4b88daa536', 3600);

 # Query_time: 541  Lock_time: 0  Rows_sent: 1  Rows_examined: 1733137
 SELECT COUNT(DISTINCT main.id) FROM Tickets main , Transactions
 Transactions_1, Attachments Attachments_2  WHERE ((Transactions_1.O
 bjectType = 'RT::Ticket')) AND ((main.EffectiveId = main.id)) AND
 ((main.Status != 'deleted')) AND ((main.Type = 'ticket')) AND ( (
  (Attachments_2.Content LIKE
 '%txcomber%')AND(Attachments_2.TransactionId =
 Transactions_1.id)AND(main.id = Transactions_1.ObjectId
 ) ) );


 RT logs:

 [Fri Aug 17 13:16:13 2007] [warning]: Duplicate specification  for
 option  (/opt/rt3/lib/RT.pm:287)
 [Fri Aug 17 13:16:13 2007] [warning]: Queue-CustomFields is
 deprecated, use Queue-TicketCustomFields instead at
 (main:/usr/local/bin/rt:682) at /opt/rt3/lib/RT/Queue_Overlay.pm line
 524. (/opt/rt3/lib/RT.pm:287)
 [Fri Aug 17 13:16:15 2007] [warning]: Use of uninitialized value in
 pattern match (m//) at /usr/local/lib/perl5/5.8.6/Getopt/Long.pm line
 315. (/opt/rt3/lib/RT.pm:287)
 [Fri Aug 17 13:16:15 2007] [warning]: Use of uninitialized value in
 string eq at /usr/local/lib/perl5/5.8.6/Getopt/Long.pm line 317.
 (/opt/rt3/lib/RT.pm:287)
 [Fri Aug 17 13:16:15 2007] [warning]: Use of uninitialized value in
 pattern match (m//) at /usr/local/lib/perl5/5.8.6/Getopt/Long.pm line
 686. (/opt/rt3/lib/RT.pm:287)


 --
 Asif Iqbal
 PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu



-- 
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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


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


[rt-users] Attachments - size limitations?

2007-08-20 Thread Paul Goffin
Hi,

I'm having problems with my Fedora 7, RT 3.6.3 system and large 
attachments.

I've increased the max_allowed_packet value for mysql and I can now 
receive very
large emails (6MB) without attachments or normal emails with attachments 
of
a few 10s of K but larger attachments don't make it - I get EX_TEMPFAIL
from rt-mailgate.

Running rt-mailgate manually doesn't get me any extra information.

Any ideas?

Paul Goffin

_

This email message may contain privileged/confidential information and/or
copyright material.  It is intended only for the use of the person(s) to whom 
it is addressed and any unauthorised use may be unlawful.  If you receive this
email by mistake, please advise the sender immediately by using the reply
facility in your email software and delete the material from your computer.

The material contained in this message does not constitute a binding
contract with any company within the MTL Instruments Group plc.  Opinions,
conclusions and other information in this email that do not relate to the 
official
business of this organisation shall be understood as neither given nor endorsed 
by it.  Registered in England No. 1871978, VAT Reg. No 449343040, 
MTL Instruments Ltd, Power Court, Luton, LU1 3JJ

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

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


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

[rt-users] Unowned tickets on at a glance page not updating

2007-08-20 Thread Liam R. MacInnes

We're having an issue in which the X newest unowned tickets section on the at 
a glance page does not update. But if you click on the heading it shows them 
all and it's doing this for all users except the root user. Anyone have a fix 
for this? Anyone ever even seen this problem before?


--
Liam MacInnes   Network Support Specialist
[EMAIL PROTECTED]   Stargate Connections, Inc.
http://www.stargate.ca Ph. +1 (604) 606-8987


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

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


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


Re: [rt-users] Remove RT signature from subject line

2007-08-20 Thread Gene LeDuc

Hi All,
I solved my own problem and thought it might be useful to someone else.

I needed to be able to forward certain mail to an address so that it didn't 
look like it came from RT, so I needed to remove the ticket info from the 
subject line.  After poking around in the code I figured out that this 
requires customization to the SetSubjectToken method in SendEmail.pm (I 
chose to create SendEmail_Local.pm to do this).  I didn't want to make 
changes that were likely to affect other modules, so I chose to stick a 
character sequence at the front of the subject line to signal special 
handling.  If the flag is not found, the subject line is handled normally 
(RT sticks ticket info on the front of the subject).  If the flag is found, 
the ticket info is not put on the front of the subject line.  An optional 
second flag if brackets immediately following the first will be put on the 
front of the subject line instead (like Fwd: ).  For my signal I chose a 
sequence of characters that are unlikely to appear at the front of a normal 
subject line, like [__##].  The code for my SendEmail_Local.pm is at 
the end of this message.  Remember to restart apache after creating the 
_Local file.


Assumptions for the following template examples:
  Ticket Id is 1234
  Ticket subject is How can I change my password?
  Special $no_rt_flag is [__##]

Example 1.
Send an e-mail with the original subject line only, no ticket info:
  my $Subject = $Ticket-Transactions-First-Subject();
  $Subject = $no_rt_flag . $Subject; # signal to leave off the ticket id
Subject line will be How can I change my password?

Example 2.
Send an e-mail with the normal RT-modified subject line:
  my $Subject = $Ticket-Transactions-First-Subject();
Subject line will be [RT #1234] How can I change my password?

Example 3.
Send an e-mail that looks like a forwarded e-mail:
  my $Subject = $Ticket-Transactions-First-Subject();
  $Subject = $no_rt_flag . [Fwd: ] . $Subject; # signal to leave off 
ticket id and replace with something else

Subject line will be Fwd: How can I change my password?

Example 4.
Send an urgent e-mail to admin alert address:
  my $ToAddress = '[EMAIL PROTECTED]';
  my $Subject = $Ticket-Transactions-First-Subject();
  $Subject = $no_rt_flag . [Urgent: ] . $Subject; # signal to leave 
off ticket id and replace with something else

Subject line will be Urgent: How can I change my password?

This isn't a terribly sophisticated hack and I'm sure it can be 
improved.  For instance, as coded, you probably can't embed brackets in the 
special tag to get a subject like [Yowza!] How can...  It suffices for 
me, but feel free to fix it up if you want.


Enjoy!
Gene

== Begin SendEmail_Local.pm =
use strict;
no warnings qw(redefine);

sub SetSubjectToken {
my $self = shift;
my $tag  = [$RT::rtname # . $self-TicketObj-id . ] ;
my $sub  = $self-TemplateObj-MIMEObj-head-get('Subject');
my $no_rt_flag = [__##_];
unless ( $sub =~ /\Q$tag\E/ ) {
$sub =~ s/(\r\n|\n|\s)/ /gi;
chomp $sub;
if ( $sub =~ /^\Q$no_rt_flag\E/ ) {
  $sub =~ s/(\Q$no_rt_flag\E)//;
  if ( $sub =~ /^\[.*\]/ ) {
($tag) = $sub =~ /^\[(.*)\]/;
$sub =~ s/^(\[.*\])//;
  } else {
$tag = '';
  }
}
$self-TemplateObj-MIMEObj-head-replace( 'Subject', $tag$sub );
}
}

1;
=== End SendEmail_Local.pm =

--

Gene LeDuc, GSEC
Security Analyst
San Diego State University 


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

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


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


Re: [rt-users] Attachments - size limitations?

2007-08-20 Thread Paul Goffin
The problem appears to be that apache's mod_security is rejecting attachments over a certain size because of pattern matching.Anyone know how to solve this?PaulGoffin<[EMAIL PROTECTED]>_This email message may contain privileged/confidential information and/orcopyright material.  It is intended only for the use of the person(s) to whom it is addressed and any unauthorised use may be unlawful.  If you receive thisemail by mistake please advise the sender immediately by using the replyfacility in your email software and delete the material from your computer.The material contained in this message does not constitute a bindingcontract with any company within the MTL Instruments Group plc.  Opinionsconclusions and other information in this email that do not relate to the officialbusiness of this organisation shall be understood as neither given nor endorsed by it.  Registered in England No. 1871978 VAT Reg. No 449343040 MTL Instruments Ltd Power Court Luton LU1 3JJ
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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


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

RE: [rt-users] Unowned tickets on at a glance page not updating

2007-08-20 Thread Liam R. MacInnes

Well I've found out a bit more about my problem but still no idea how to solve 
it. What appears to be happening is that in the X newest unowned tickets it's 
counting tickets that the user does not have permission to see. Is there anyway 
to limit the search to tickets only in queues that the user has permissions on?

Thanks


--
Liam MacInnes   Network Support Specialist
[EMAIL PROTECTED]   Stargate Connections, Inc.
http://www.stargate.ca Ph. +1 (604) 606-8987



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Liam R. MacInnes
Sent: Monday, August 20, 2007 11:04 AM
To: 'rt-users@lists.bestpractical.com'
Subject: [rt-users] Unowned tickets on at a glance page not updating


We're having an issue in which the X newest unowned tickets section on the at 
a glance page does not update. But if you click on the heading it shows them 
all and it's doing this for all users except the root user. Anyone have a fix 
for this? Anyone ever even seen this problem before?


--
Liam MacInnes   Network Support Specialist
[EMAIL PROTECTED]   Stargate Connections, Inc.
http://www.stargate.ca Ph. +1 (604) 606-8987


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

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


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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


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


[rt-users] Need LDAP scrip help: using a switch statement

2007-08-20 Thread Tim Wilson
Hey everyone,

I'm trying to adapt the set custom field with LDAP query scrip example from 
the RT book, and I'm stuck. I'm hoping someone has a suggestion. The main 
problem, I'm afraid, is a lack of perl experience.

I've created a new scrip called Set Building CF from LDAP on Create with 
Condition On Create and Action User Defined. Here's my custom action 
preparation code:

my $email = ($self-TicketObj-RequestorAddresses)[0];
my $ldap = Net::LDAP-new( 'my.ldap.server );
$ldap-bind;
my $msg = $ldap-search( base   = 'ou=Staff,o=My-ldap-org',
 filter = '(email=$email)',
   );
my $entry = $msg-entry(0);
my $ou = $entry-get_value('ou');

# Fix up the CF names based on LDAP results
switch ($ou) {
case DISTRICT SERVICES  { $building = DO }
case HIGH SCHOOL{ $building = HS }
case JEFFERSON  { $building = JES } 
else  { $building = DO }
};

my $cf = RT::CustomField-new( $RT::SystemUser );
$cf-LoadByName( Name = 'Building' );
$self-TicketObj-AddCustomFieldValue( Field = $cf, Value = $building );

return 1;

I don't have anything in the Custom action cleanup code box.

I'm trying to use a switch because the field in our LDAP records doesn't match 
the custom field text in RT. Rather than changing everything in the LDAP, I was 
hoping to make the translation here in the scrip action.

Anyone see a problem with this scrip? It doesn't seem to break anything, but 
neither does the custom field get set when a new ticket comes in.

Running RT 3.6.3 on Ubuntu with MySQL 5.0.22 and apache-ssl 1.3.34

-Tim


-- 
Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE   Buffalo, MN  55313
ph: 763.682.8740  fax: 763.682.8743  http://www.buffalo.k12.mn.us




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

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


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