[Rt-commit] r4407 - in rt/branches/3.5-TESTING: etc
html/Admin/Elements html/Elements/CollectionAsTable
html/Ticket lib/RT lib/RT/Action lib/RT/I18N lib/t/regression sbin
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jan 19 10:11:24 EST 2006
Author: jesse
Date: Thu Jan 19 10:11:21 2006
New Revision: 4407
Modified:
rt/branches/3.5-TESTING/ (props changed)
rt/branches/3.5-TESTING/etc/schema.mysql
rt/branches/3.5-TESTING/html/Admin/Elements/EditCustomFields
rt/branches/3.5-TESTING/html/Elements/CollectionAsTable/ParseFormat
rt/branches/3.5-TESTING/html/Ticket/ModifyAll.html
rt/branches/3.5-TESTING/lib/RT/Action/CreateTickets.pm
rt/branches/3.5-TESTING/lib/RT/Action/SendEmail.pm
rt/branches/3.5-TESTING/lib/RT/I18N.pm
rt/branches/3.5-TESTING/lib/RT/I18N/de.po
rt/branches/3.5-TESTING/lib/RT/Template_Overlay.pm
rt/branches/3.5-TESTING/lib/RT/Ticket_Overlay.pm
rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm
rt/branches/3.5-TESTING/lib/t/regression/20-sort-by-requestor.t
rt/branches/3.5-TESTING/lib/t/regression/22search_tix_by_txn.t
rt/branches/3.5-TESTING/sbin/rt-setup-database.in
Log:
r22720 at truegrounds: jesse | 2006-01-19 09:15:00 -0500
* merge up from chaldea, quebec, 3.4
Modified: rt/branches/3.5-TESTING/etc/schema.mysql
==============================================================================
--- rt/branches/3.5-TESTING/etc/schema.mysql (original)
+++ rt/branches/3.5-TESTING/etc/schema.mysql Thu Jan 19 10:11:21 2006
@@ -58,7 +58,6 @@
PRIMARY KEY (id)
) TYPE=InnoDB;
-CREATE UNIQUE INDEX Links1 ON Links (Base, Target, Type) ;
CREATE INDEX Links2 ON Links (Base, Type) ;
CREATE INDEX Links3 ON Links (Target, Type) ;
CREATE INDEX Links4 ON Links (Type,LocalBase);
Modified: rt/branches/3.5-TESTING/html/Admin/Elements/EditCustomFields
==============================================================================
--- rt/branches/3.5-TESTING/html/Admin/Elements/EditCustomFields (original)
+++ rt/branches/3.5-TESTING/html/Admin/Elements/EditCustomFields Thu Jan 19 10:11:21 2006
@@ -88,6 +88,20 @@
$ObjectCFs->LimitToObjectId($id);
$ObjectCFs->LimitToLookupType($lookup);
+# Check sanity of SortOrders
+my %SortOrders;
+$SortOrders{$_->SortOrder}++
+ while ($_ = $ObjectCFs->Next);
+
+# If there are duplicates, run though and squash them
+if (grep {$_ > 1} values %SortOrders) {
+ my $i = 1;
+ while (my $ObjectCF = $ObjectCFs->Next) {
+ $ObjectCF->SetSortOrder($i++);
+ }
+ $ObjectCFs->GotoFirstItem;
+}
+
# {{{ deal with moving sortorder of custom fields
if ($CustomField and $Move) {
my $SourceObj = RT::ObjectCustomField->new($session{'CurrentUser'});
Modified: rt/branches/3.5-TESTING/html/Elements/CollectionAsTable/ParseFormat
==============================================================================
--- rt/branches/3.5-TESTING/html/Elements/CollectionAsTable/ParseFormat (original)
+++ rt/branches/3.5-TESTING/html/Elements/CollectionAsTable/ParseFormat Thu Jan 19 10:11:21 2006
@@ -48,7 +48,7 @@
</%ARGS>
<%init>
-use Regexp::Common;
+use Regexp::Common qw/delimited/;
my @Columns;
while ($Format =~ /($RE{delimited}{-delim=>qq{\'"}}|[{}\w.]+)/go) {
Modified: rt/branches/3.5-TESTING/html/Ticket/ModifyAll.html
==============================================================================
--- rt/branches/3.5-TESTING/html/Ticket/ModifyAll.html (original)
+++ rt/branches/3.5-TESTING/html/Ticket/ModifyAll.html Thu Jan 19 10:11:21 2006
@@ -148,6 +148,16 @@
my (@wresults, @results, @dresults, @lresults, @cf_results);
unless ($OnlySearchForPeople) {
+ # There might be two owners.
+ if ( ref ($ARGS{'Owner'} )) {
+ my @owners =@{$ARGS{'Owner'}};
+ delete $ARGS{'Owner'};
+ foreach my $owner(@owners){
+ $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner);
+ }
+
+ }
+
@wresults = ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
@cf_results = ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS);
@dresults = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
Modified: rt/branches/3.5-TESTING/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Action/CreateTickets.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Action/CreateTickets.pm Thu Jan 19 10:11:21 2006
@@ -189,6 +189,8 @@
Resolved =>
Owner => Username or id of an RT user who can and should own
this ticket
+ ForceOwner => Same as Owner, but sets the owner even if the owner
+ is already set
+ Requestor => Email address
+ Cc => Email address
+ AdminCc => Email address
@@ -209,7 +211,12 @@
as content until we hit a line containing only
ENDOFCONTENT
ContentType => the content-type of the Content field
+ UpdateType => 'correspond' or 'comment'; used in conjunction with
+ 'content' if this is an update.
+
CustomField-<id#> => custom field value
+ CF-name => custom field value
+ CustomField-name => custom field value
Fields marked with an * are required.
@@ -700,11 +707,16 @@
ARGSRef => $ticketargs
);
+ if ( $ticketargs->{'ForceOwner'} ) {
+ ($id, $msg) = $T::Tickets{$template_id}->SetOwner($ticketargs->{'ForceOwner'}, "Force");
+ push @results, $msg;
+ }
+
push @results,
$self->UpdateWatchers( $T::Tickets{$template_id}, $ticketargs );
- next unless exists $ticketargs->{'UpdateType'};
- if ( $ticketargs->{'UpdateType'} =~ /^(private|public)$/ ) {
+ next unless $ticketargs->{'MIMEObj'};
+ if ( $ticketargs->{'UpdateType'} =~ /^(private|comment)$/i ) {
my ( $Transaction, $Description, $Object )
= $T::Tickets{$template_id}->Comment(
CcMessageTo => $ticketargs->{'Cc'},
@@ -717,7 +729,7 @@
->loc( "Ticket [_1]", $T::Tickets{$template_id}->id )
. ': '
. $Description );
- } elsif ( $ticketargs->{'UpdateType'} eq 'response' ) {
+ } elsif ( $ticketargs->{'UpdateType'} =~ /^(public|response|correspond)$/i ) {
my ( $Transaction, $Description, $Object )
= $T::Tickets{$template_id}->Correspond(
CcMessageTo => $ticketargs->{'Cc'},
@@ -932,6 +944,9 @@
$args{$tag} =~ s/^\s+//g;
$args{$tag} =~ s/\s+$//g;
}
+ if (($tag =~ /^(requestor|cc|admincc)$/i or grep {lc $_ eq $tag} keys %LINKTYPEMAP) and $args{$tag} =~ /,/) {
+ $args{$tag} = [ split /,\s*/, $args{$tag} ];
+ }
}
}
}
@@ -960,7 +975,8 @@
Starts => $args{'starts'},
Started => $args{'started'},
Resolved => $args{'resolved'},
- Owner => $args{'owner'},
+ Owner => $args{'forceowner'} || $args{'owner'},
+ ForceOwner => $args{'forceowner'},
Requestor => $args{'requestor'},
Cc => $args{'cc'},
AdminCc => $args{'admincc'},
@@ -988,7 +1004,6 @@
if ( $orig_tag =~ /^customfield-?(\d+)$/i ) {
$ticketargs{ "CustomField-" . $1 } = $args{$tag};
} elsif ( $orig_tag =~ /^(?:customfield|cf)-?(.*)$/i ) {
- warn $orig_tag;
my $cf = RT::CustomField->new( $self->CurrentUser );
$cf->LoadByName( Name => $1, Queue => $ticketargs{Queue} );
$ticketargs{ "CustomField-" . $cf->id } = $args{$tag};
@@ -999,7 +1014,6 @@
$ticketargs{ "CustomField-" . $cf->id } = $args{$tag};
}
- warn "We have a cf! yay "
}
$self->GetDeferred( \%args, $template_id, $links, $postponed );
@@ -1017,112 +1031,105 @@
sub _ParseXSVTemplate {
my $self = shift;
my %args = (@_);
- $RT::Logger->debug("Line: id");
- use Regexp::Common qw(delimited);
- my $first
- = substr( $args{'Content'}, 0, index( $args{'Content'}, "\n" ) );
- $first =~ s/\r$//;
-
- my $delimiter;
- if ( $first =~ /\t/ ) {
- $delimiter = "\t";
- } else {
- $delimiter = ',';
- }
- my @fields = split( /$delimiter/, $first );
- my $delimiter_re = qr[$delimiter];
+ use Regexp::Common qw(delimited);
+ my $first
+ = substr( $args{'Content'}, 0, index( $args{'Content'}, "\n" ) );
+ $first =~ s/\r$//;
+
+ my $delimiter;
+ if ( $first =~ /\t/ ) {
+ $delimiter = "\t";
+ } else {
+ $delimiter = ',';
+ }
+ my @fields = split( /$delimiter/, $first );
- my $delimited = qr[[^$delimiter]+];
- my $empty = qr[^[$delimiter](?=[$delimiter])];
- my $justquoted = qr[$RE{quoted}];
+ my $delimiter_re = qr[$delimiter];
+ my $justquoted = qr[$RE{quoted}];
- $args{'Content'}
- = substr( $args{'Content'}, index( $args{'Content'}, "\n" ) + 1 );
- $RT::Logger->debug("First: $first");
+ $args{'Content'}
+ = substr( $args{'Content'}, index( $args{'Content'}, "\n" ) + 1 );
- foreach my $line ( split( /\n/, $args{'Content'} ) ) {
- next unless $line;
- $RT::Logger->debug("Line: $line");
-
- my $queue;
- my $requestor;
- # first item is $template_id
- my $i = 0;
- my $template_id;
- while ($line
- && $line =~ s/^($justquoted|.*?)(?:$delimiter_re|$)//ix )
- {
-
-
- # If it's the first field, it must be a ticket id.
- if ( $i == 0 ) {
- $queue = 0;
- $requestor = 0;
- my $tid = $1;
- $tid =~ s/^\s*(.*?)\s*$/$1/;
- next unless $tid;
-
- if ( $tid =~ /^\d+$/ ) {
- $template_id = 'update-' . $tid;
- push @{ $self->{'update_tickets'} }, $template_id;
-
- } elsif ( $tid =~ /^#base-(\d+)$/ ) {
-
- $template_id = 'base-' . $1;
- push @{ $self->{'base_tickets'} }, $template_id;
-
- } else {
- $template_id = 'create-' . $tid;
- push @{ $self->{'create_tickets'} }, $template_id;
- }
- $RT::Logger->debug("template_id: $tid");
+ LINE:
+ while ($args{'Content'}) {
+ $args{'Content'} =~ s/^(\s*\r?\n)+//;
+
+ my $queue;
+ my $requestor;
+ # first item is $template_id
+ my $i = 0;
+ my $template_id;
+ my $EOL = 0;
+
+ COLUMN:
+ while (not $EOL and length $args{'Content'} and $args{'Content'} =~ s/^($justquoted|.*?)($delimiter_re|$)//smix) {
+ $EOL = not $2;
+ # If it's the first field, it must be a ticket id.
+ if ( $i == 0 ) {
+ $queue = 0;
+ $requestor = 0;
+ my $tid = $1;
+ $tid =~ s/^\s*(.*?)\s*$/$1/;
+ next COLUMN unless $tid;
+
+ if ( $tid =~ /^\d+$/ ) {
+ $template_id = 'update-' . $tid;
+ push @{ $self->{'update_tickets'} }, $template_id;
+ } elsif ( $tid =~ /^#base-(\d+)$/ ) {
+ $template_id = 'base-' . $1;
+ push @{ $self->{'base_tickets'} }, $template_id;
} else {
- my $value = $1;
- $value = '' if ( $value =~ /^$delimiter$/ );
- if ( $value =~ /^$RE{delimited}{-delim=>qq{\'\"}}$/ ) {
- substr( $value, 0, 1 ) = "";
- substr( $value, -1, 1 ) = "";
- }
- my $field = $fields[$i];
- next unless $field;
- $field =~ s/^\s//;
- $field =~ s/\s$//;
- if ( $field =~ /Body/i
- || $field =~ /Data/i
- || $field =~ /Message/i )
- {
- $field = 'Content';
- }
- if ( $field =~ /Summary/i ) {
- $field = 'Subject';
- }
- if ( $field =~ /Queue/i ) {
- $queue = 1;
- $value ||= $args{'Queue'};
- }
- if ( $field =~ /Requestor/i ) {
- $requestor = 1;
- $value ||= $args{'Requestor'};
- }
- $self->{'templates'}->{$template_id} .= $field . ": ";
- $self->{'templates'}->{$template_id} .= $value || "";
- $self->{'templates'}->{$template_id} .= "\n";
- $self->{'templates'}->{$template_id} .= "ENDOFCONTENT\n"
- if $field =~ /content/i;
+ $template_id = 'create-' . $tid;
+ push @{ $self->{'create_tickets'} }, $template_id;
}
- $i++;
- }
- if ( !$queue && $args{'Queue'} ) {
- $self->{'templates'}->{$template_id}
- .= "Queue: $args{'Queue'}\n";
- }
- if ( !$requestor && $args{'Requestor'} ) {
- $self->{'templates'}->{$template_id}
- .= "Requestor: $args{'Requestor'}\n";
+ } else {
+ my $value = $1;
+ if ( $value =~ /^$RE{delimited}{-delim=>qq{\'\"}}$/ ) {
+ substr( $value, 0, 1 ) = "";
+ substr( $value, -1, 1 ) = "";
+ }
+ my $field = $fields[$i];
+
+ next COLUMN unless $field;
+ $field =~ s/^\s//;
+ $field =~ s/\s$//;
+ if ( $field =~ /^Body$/i
+ || $field =~ /^Data$/i
+ || $field =~ /^Message$/i )
+ {
+ $field = 'Content';
+ }
+ if ( $field =~ /^Summary$/i ) {
+ $field = 'Subject';
+ }
+ if ( $field =~ /^Queue$/i ) {
+ $queue = 1;
+ $value ||= $args{'Queue'};
+ }
+ if ( $field =~ /^Requestor$/i ) {
+ $requestor = 1;
+ $value ||= $args{'Requestor'};
+ }
+ $self->{'templates'}->{$template_id} .= $field . ": ";
+ $self->{'templates'}->{$template_id} .= $value || "";
+ $self->{'templates'}->{$template_id} .= "\n";
+ $self->{'templates'}->{$template_id} .= "ENDOFCONTENT\n"
+ if $field =~ /^Content$/i;
}
+ $i++;
}
+ if ( !$queue && $args{'Queue'} ) {
+ $self->{'templates'}->{$template_id}
+ .= "Queue: $args{'Queue'}\n";
+ }
+ if ( !$requestor && $args{'Requestor'} ) {
+ $self->{'templates'}->{$template_id}
+ .= "Requestor: $args{'Requestor'}\n";
+ }
+ }
}
+
sub GetDeferred {
my $self = shift;
my $args = shift;
@@ -1158,7 +1165,7 @@
$string .= "Queue: " . $t->QueueObj->Name . "\n";
$string .= "Subject: " . $t->Subject . "\n";
$string .= "Status: " . $t->Status . "\n";
- $string .= "UpdateType: response\n";
+ $string .= "UpdateType: correspond\n";
$string .= "Content: \n";
$string .= "ENDOFCONTENT\n";
$string .= "Due: " . $t->DueObj->AsString . "\n";
@@ -1282,8 +1289,8 @@
next unless defined $args->{$type};
my $newaddr = $args->{$type};
- my @old = split( ', ', $oldaddr );
- my @new = split( ', ', $newaddr );
+ my @old = split( /,\s*/, $oldaddr );
+ my @new = split( /,\s*/, $newaddr );
my %oldhash = map { $_ => 1 } @old;
my %newhash = map { $_ => 1 } @new;
Modified: rt/branches/3.5-TESTING/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Action/SendEmail.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Action/SendEmail.pm Thu Jan 19 10:11:21 2006
@@ -253,12 +253,28 @@
if ( $RT::MailCommand eq 'sendmailpipe' ) {
eval {
- open( my $mail, "|$RT::SendmailPath $RT::SendmailArguments" ) || die $!;
+ # don't ignore CHLD signal to get proper exit code
+ local $SIG{'CHLD'} = 'DEFAULT';
+
+ my $mail;
+ unless( open $mail, "|$RT::SendmailPath $RT::SendmailArguments" ) {
+ die "Couldn't run $RT::SendmailPath: $!";
+ }
+
+ # if something wrong with $mail->print we will get PIPE signal, handle it
+ local $SIG{'PIPE'} = sub { die "$RT::SendmailPath closed pipe" };
$MIMEObj->print($mail);
- close($mail);
+
+ unless ( close $mail ) {
+ die "Close failed: $!" if $!; # system error
+ # sendmail exit statuses mostly errors with data not software
+ # TODO: status parsing: core dump, exit on signal or EX_*
+ $RT::Logger->warning( "$RT::SendmailPath exitted with status $?" );
+ }
};
if ($@) {
- $RT::Logger->crit( $msgid . "Could not send mail. -" . $@ );
+ $RT::Logger->crit( $msgid . "Could not send mail: " . $@ );
+ return 0;
}
}
else {
Modified: rt/branches/3.5-TESTING/lib/RT/I18N.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/I18N.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/I18N.pm Thu Jan 19 10:11:21 2006
@@ -223,7 +223,7 @@
# {{{ Convert the body
eval {
- $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". $head->get('subject'));
+ $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". ($head->get('subject') || 'Subjectless message'));
# NOTE:: see the comments at the end of the sub.
Encode::_utf8_off( $lines[$_] ) foreach ( 0 .. $#lines );
Modified: rt/branches/3.5-TESTING/lib/RT/I18N/de.po
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/I18N/de.po (original)
+++ rt/branches/3.5-TESTING/lib/RT/I18N/de.po Thu Jan 19 10:11:21 2006
@@ -4017,15 +4017,15 @@
#: html/Ticket/Elements/Tabs:172
msgid "Steal"
-msgstr "Übernehmen"
+msgstr "Stehlen"
#: lib/RT/Queue_Overlay.pm:118
msgid "Steal tickets"
-msgstr "Anfragen übernehmen"
+msgstr "Anfragen stehlen"
#: lib/RT/Queue_Overlay.pm:118
msgid "StealTicket"
-msgstr "AnfrageÜbernehmen"
+msgstr "AnfrageStehlen"
#: lib/RT/Transaction_Overlay.pm:667
#. ($Old->Name)
Modified: rt/branches/3.5-TESTING/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Template_Overlay.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Template_Overlay.pm Thu Jan 19 10:11:21 2006
@@ -103,23 +103,11 @@
sub _Set {
my $self = shift;
-
- # use super::value or we get acl blocked
- if ( ( defined $self->SUPER::_Value('Queue') )
- && ( $self->SUPER::_Value('Queue') == 0 ) )
- {
- unless ( $self->CurrentUser->HasRight( Object => $RT::System, Right => 'ModifyTemplate') ) {
- return ( 0, $self->loc('Permission Denied') );
- }
- }
- else {
-
- unless ( $self->CurrentUserHasQueueRight('ModifyTemplate') ) {
- return ( 0, $self->loc('Permission Denied') );
- }
+
+ unless ( $self->CurrentUserHasQueueRight('ModifyTemplate') ) {
+ return ( 0, $self->loc('Permission Denied') );
}
- return ( $self->SUPER::_Set(@_) );
-
+ return $self->SUPER::_Set( @_ );
}
# }}}
@@ -147,26 +135,12 @@
=cut
sub _Value {
-
my $self = shift;
- my $field = shift;
-
- #If the current user doesn't have ACLs, don't let em at it.
- #use super::value or we get acl blocked
- if ( ( !defined $self->__Value('Queue') )
- || ( $self->__Value('Queue') == 0 ) )
- {
- unless ( $self->CurrentUser->HasRight( Object => $RT::System, Right => 'ShowTemplate') ) {
- return (undef);
- }
+ unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
+ return undef;
}
- else {
- unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
- return (undef);
- }
- }
- return ( $self->__Value($field) );
+ return $self->__Value( @_ );
}
@@ -183,18 +157,12 @@
sub Load {
my $self = shift;
my $identifier = shift;
+ return undef unless $identifier;
- if ( !$identifier ) {
- return (undef);
- }
-
- if ( $identifier !~ /\D/ ) {
- $self->SUPER::LoadById($identifier);
- }
- else {
- $self->LoadByCol( 'Name', $identifier );
-
+ if ( $identifier =~ /\D/ ) {
+ return $self->LoadByCol( 'Name', $identifier );
}
+ return $self->LoadById( $identifier );
}
# }}}
@@ -260,32 +228,32 @@
Content => undef,
Queue => 0,
Description => '[no description]',
- Type => 'Action', #By default, template are 'Action' templates
- Name => undef,
+ Type => 'Action', #By default, template are 'Action' templates
+ Name => undef,
@_
);
- if ( !$args{'Queue'} ) {
+ unless ( $args{'Queue'} ) {
unless ( $self->CurrentUser->HasRight(Right =>'ModifyTemplate', Object => $RT::System) ) {
- return (undef);
+ return ( undef, $self->loc('Permission denied') );
}
$args{'Queue'} = 0;
}
else {
my $QueueObj = new RT::Queue( $self->CurrentUser );
- $QueueObj->Load( $args{'Queue'} ) || return ( 0, $self->loc('Invalid queue') );
+ $QueueObj->Load( $args{'Queue'} ) || return ( undef, $self->loc('Invalid queue') );
unless ( $QueueObj->CurrentUserHasRight('ModifyTemplate') ) {
- return (undef);
+ return ( undef, $self->loc('Permission denied') );
}
$args{'Queue'} = $QueueObj->Id;
}
my $result = $self->SUPER::Create(
- Content => $args{'Content'},
- Queue => $args{'Queue'},
+ Content => $args{'Content'},
+ Queue => $args{'Queue'},
Description => $args{'Description'},
- Name => $args{'Name'}
+ Name => $args{'Name'},
);
return ($result);
@@ -340,15 +308,16 @@
my $self = shift;
#We're passing in whatever we were passed. it's destined for _ParseContent
- my $content = $self->_ParseContent(@_);
+ my ($content, $msg) = $self->_ParseContent(@_);
+ return ( 0, $msg ) unless defined $content;
#Lets build our mime Entity
my $parser = MIME::Parser->new();
- # On some situations TMPDIR is non-writable. sad but true.
- $parser->output_to_core(1);
- $parser->tmp_to_core(1);
+ # On some situations TMPDIR is non-writable. sad but true.
+ $parser->output_to_core(1);
+ $parser->tmp_to_core(1);
#If someone includes a message, don't extract it
$parser->extract_nested_messages(1);
@@ -363,15 +332,13 @@
### Should we forgive normally-fatal errors?
$parser->ignore_errors(1);
$self->{'MIMEObj'} = eval { $parser->parse_data($content) };
- my $error = ( $@ || $parser->last_error );
-
- if ($error) {
- $RT::Logger->error("$error");
+ if ( my $error = $@ || $parser->last_error ) {
+ $RT::Logger->error( "$error" );
return ( 0, $error );
}
# Unfold all headers
- $self->{'MIMEObj'}->head->unfold();
+ $self->{'MIMEObj'}->head->unfold;
return ( 1, $self->loc("Template parsed") );
@@ -400,9 +367,13 @@
$T::rtname = $RT::rtname;
*T::loc = sub { $T::Ticket->loc(@_) };
+ my $content = $self->Content;
+ unless ( defined $content ) {
+ return ( undef, $self->loc("Permissions denied") );
+ }
+
# We need to untaint the content of the template, since we'll be working
# with it
- my $content = $self->Content();
$content =~ s/^(.*)$/$1/;
my $template = Text::Template->new(
TYPE => 'STRING',
@@ -413,11 +384,11 @@
my $retval = $template->fill_in( PACKAGE => 'T', BROKEN => sub {
my (%args) = @_;
$RT::Logger->error("Template parsing error: $args{error}")
- unless $args{error} =~ /^Died at /; # ignore intentional die()
+ unless $args{error} =~ /^Died at /; # ignore intentional die()
$is_broken++;
- return undef;
+ return undef;
} );
- return undef if $is_broken;
+ return ( undef, $self->loc('Template parsing error') ) if $is_broken;
# MIME::Parser has problems dealing with high-bit utf8 data.
Encode::_utf8_off($retval);
Modified: rt/branches/3.5-TESTING/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Ticket_Overlay.pm Thu Jan 19 10:11:21 2006
@@ -1318,7 +1318,8 @@
# {{{ Check ACLS
#If the watcher we're trying to add is for the current user
- if ( $self->CurrentUser->PrincipalId eq $args{'PrincipalId'}) {
+ if ( $self->CurrentUser->PrincipalId eq $args{'PrincipalId'}
+ or $self->CurrentUser->UserObj->EmailAddress eq $args{'Email'}) {
# If it's an AdminCc and they don't have
# 'WatchAsAdminCc' or 'ModifyTicket', bail
if ( $args{'Type'} eq 'AdminCc' ) {
Modified: rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.5-TESTING/lib/RT/Tickets_Overlay.pm Thu Jan 19 10:11:21 2006
@@ -273,7 +273,7 @@
or $op eq "!=";
my $meta = $FIELD_METADATA{$field};
- if ( defined $meta->[1] ) {
+ if ( defined $meta->[1] && defined $value && $value !~ /^\d+$/ ) {
my $class = "RT::" . $meta->[1];
my $o = $class->new( $sb->CurrentUser );
$o->Load($value);
@@ -543,8 +543,6 @@
$sb->{_sql_transalias} = $sb->NewAlias('Transactions')
unless defined $sb->{_sql_transalias};
- $sb->{_sql_trattachalias} = $sb->NewAlias('Attachments')
- unless defined $sb->{_sql_trattachalias};
my $date = RT::Date->new( $sb->CurrentUser );
$date->Set( Format => 'unknown', Value => $value );
@@ -596,15 +594,6 @@
);
}
- # Join Transactions To Attachments
-
- $sb->_SQLJoin(
- ALIAS1 => $sb->{_sql_trattachalias},
- FIELD1 => 'TransactionId',
- ALIAS2 => $sb->{_sql_transalias},
- FIELD2 => 'id',
- );
-
# Join Transactions to Tickets
$sb->_SQLJoin(
ALIAS1 => 'main',
@@ -1566,12 +1555,11 @@
@_
);
- #TODO VALUE should also take queue names and queue objects
- #TODO FIXME why are we canonicalizing to name, not id, robrt?
- if ( $args{VALUE} =~ /^\d+$/ ) {
+ #TODO VALUE should also take queue objects
+ if ( defined $args{'VALUE'} && $args{'VALUE'} !~ /^\d+$/ ) {
my $queue = new RT::Queue( $self->CurrentUser );
$queue->Load( $args{'VALUE'} );
- $args{VALUE} = $queue->Name;
+ $args{'VALUE'} = $queue->Id;
}
# What if they pass in an Id? Check for isNum() and convert to
@@ -1581,10 +1569,10 @@
$self->Limit(
FIELD => 'Queue',
- VALUE => $args{VALUE},
+ VALUE => $args{'VALUE'},
OPERATOR => $args{'OPERATOR'},
DESCRIPTION => join(
- ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{VALUE},
+ ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{'VALUE'},
),
);
Modified: rt/branches/3.5-TESTING/lib/t/regression/20-sort-by-requestor.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/20-sort-by-requestor.t (original)
+++ rt/branches/3.5-TESTING/lib/t/regression/20-sort-by-requestor.t Thu Jan 19 10:11:21 2006
@@ -128,4 +128,15 @@
$tix->OrderByCols({ FIELD => "Requestor.EmailAddress", ORDER => 'DESC' });
check_emails_order($tix, 7, 'DESC');
+{
+ my $tix = RT::Tickets->new($RT::SystemUser);
+ $tix->FromSQL("Queue = '$queue'");
+ $tix->OrderByCols({ FIELD => "Requestor.EmailAddress" });
+ $tix->RowsPerPage(30);
+ my @mails;
+ while (my $t = $tix->Next) { push @mails, $t->RequestorAddresses; }
+ is(@mails, 30, "found thirty tickets");
+ is_deeply( [grep {$_} @mails], [ sort grep {$_} @mails ], "Paging works (exclude nulls, which are db-dependant)");
+}
+
# vim:ft=perl:
Modified: rt/branches/3.5-TESTING/lib/t/regression/22search_tix_by_txn.t
==============================================================================
--- rt/branches/3.5-TESTING/lib/t/regression/22search_tix_by_txn.t (original)
+++ rt/branches/3.5-TESTING/lib/t/regression/22search_tix_by_txn.t Thu Jan 19 10:11:21 2006
@@ -1,6 +1,6 @@
#use Test::More tests => 26;
use Test::More qw/no_plan/;
-
+$ENV{'TZ'} = 'GMT';
use RT;
RT::LoadConfig();
RT::Init();
Modified: rt/branches/3.5-TESTING/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/3.5-TESTING/sbin/rt-setup-database.in (original)
+++ rt/branches/3.5-TESTING/sbin/rt-setup-database.in Thu Jan 19 10:11:21 2006
@@ -132,6 +132,7 @@
$dbh->disconnect;
if ($RT::DatabaseType eq "Oracle") {
+ $RT::DatabasePassword = $RT::DatabasePassword; #Warning avidance
$dbh = DBI->connect( $Handle->DSN, ${RT::DatabaseUser}, ${RT::DatabasePassword} ) || die $DBI::errstr;
} else {
More information about the Rt-commit
mailing list