Commit a82f10ef authored by Jesse Vincent's avatar Jesse Vincent
Browse files

I18N patches from autrijus; bouncing to 3.0.2pre4

parent decdfb6b
......@@ -39,7 +39,7 @@ SITE_CONFIG_FILE = $(CONFIG_FILE_PATH)/RT_SiteConfig.pm
RT_VERSION_MAJOR = 3
RT_VERSION_MINOR = 0
RT_VERSION_PATCH = 2pre3
RT_VERSION_PATCH = 2pre4
RT_VERSION = $(RT_VERSION_MAJOR).$(RT_VERSION_MINOR).$(RT_VERSION_PATCH)
TAG = rt-$(RT_VERSION_MAJOR)-$(RT_VERSION_MINOR)-$(RT_VERSION_PATCH)
......
#! /bin/sh
# From configure.ac Revision: 1.1 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.54 for RT 3.0.2pre3.
# Generated by GNU Autoconf 2.54 for RT 3.0.2pre4.
#
# Report bugs to <rt-3.0-bugs@fsck.com>.
#
......@@ -266,8 +266,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='RT'
PACKAGE_TARNAME='rt'
PACKAGE_VERSION='3.0.2pre3'
PACKAGE_STRING='RT 3.0.2pre3'
PACKAGE_VERSION='3.0.2pre4'
PACKAGE_STRING='RT 3.0.2pre4'
PACKAGE_BUGREPORT='rt-3.0-bugs@fsck.com'
ac_unique_file="lib/RT.pm.in"
......@@ -725,7 +725,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures RT 3.0.2pre3 to adapt to many kinds of systems.
\`configure' configures RT 3.0.2pre4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -782,7 +782,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of RT 3.0.2pre3:";;
short | recursive ) echo "Configuration of RT 3.0.2pre4:";;
esac
cat <<\_ACEOF
......@@ -886,7 +886,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
RT configure 3.0.2pre3
RT configure 3.0.2pre4
generated by GNU Autoconf 2.54
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
......@@ -901,7 +901,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by RT $as_me 3.0.2pre3, which was
It was created by RT $as_me 3.0.2pre4, which was
generated by GNU Autoconf 2.54. Invocation command line was
$ $0 $@
......@@ -1213,7 +1213,7 @@ rt_version_major=3
rt_version_minor=0
rt_version_patch=2pre3
rt_version_patch=2pre4
test "x$rt_version_major" = 'x' && rt_version_major=0
test "x$rt_version_minor" = 'x' && rt_version_minor=0
......@@ -2263,7 +2263,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by RT $as_me 3.0.2pre3, which was
This file was extended by RT $as_me 3.0.2pre4, which was
generated by GNU Autoconf 2.54. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -2317,7 +2317,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
RT config.status 3.0.2pre3
RT config.status 3.0.2pre4
configured by $0, generated by GNU Autoconf 2.54,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
......@@ -6,7 +6,7 @@ AC_REVISION($Revision: 1.1 $)dnl
dnl Setup autoconf
AC_PREREQ(2.53)
AC_INIT(RT, [3.0.2pre3], [rt-3.0-bugs@fsck.com])
AC_INIT(RT, [3.0.2pre4], [rt-3.0-bugs@fsck.com])
AC_CONFIG_SRCDIR([lib/RT.pm.in])
dnl Extract RT version number components
......
......@@ -71,8 +71,7 @@
{ Name => 'Autoreply To Requestors', # loc
Description =>
'Always sends a message to the requestors independent of message sender'
, # loc
'Always sends a message to the requestors independent of message sender' , # loc
ExecModule => 'Autoreply',
Argument => 'Requestor' },
{ Name => 'Notify Requestors', # loc
......@@ -131,7 +130,8 @@
ExecModule => 'CreateTickets', },
{ Name => 'Open Tickets',
Description => 'Open tickets on correspondence', # loc
ExecModule => 'AutoOpen' }, );
ExecModule => 'AutoOpen' },
);
@ScripConditions = (
{ Name => 'On Create', # loc
......@@ -331,7 +331,41 @@ batch-process all your pending approvals.
-------------------------------------------------------------------------
{$Transaction->Content()}
'
}, );
},
{ Queue => '___Approvals',
Name => "Approval Passed", # loc
Description =>
"Notify Owner of their ticket has been approved by some approver", # loc
Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
Greetings,
Your ticket has been approved by somebody. Other approvals may be pending.
'
},
{ Queue => '___Approvals',
Name => "All Approvals Passed", # loc
Description =>
"Notify Owner of their ticket has been approved by all approvers", # loc
Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
Greetings,
Your ticket has been approved by somebody. Other approvals may be pending.
'
},
{ Queue => '___Approvals',
Name => "Approval Rejected", # loc
Description =>
"Notify Owner of their rejected ticket", # loc
Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
Greetings,
Your ticket has been rejected. Have a nice day.
'
},
);
# }}}
......@@ -367,8 +401,13 @@ batch-process all your pending approvals.
"When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval"
, # loc
Queue => '___Approvals',
ScripCondition => 'On Create',
ScripAction => 'Notify AdminCcs',
ScripCondition => 'User Defined',
CustomIsApplicableCode => q[
$self->TicketObj->Type eq 'approval' and
$self->TransactionObj->Field eq 'Status' and
$self->TransactionObj->NewValue eq 'open'
],
ScripAction => 'Notify Owner',
Template => 'New Pending Approval' },
{ Description =>
"If an approval is rejected, reject the original and delete pending approvals"
......@@ -376,23 +415,25 @@ batch-process all your pending approvals.
Queue => '___Approvals',
ScripCondition => 'On Status Change',
ScripAction => 'User Defined',
CustomCommitCode => q[
CustomPrepareCode => q[
# ------------------------------------------------------------------- #
return(1) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
lc($self->TransactionObj->NewValue) eq "deleted" );
my $rejected = 0;
my $links = $self->TicketObj->DependedOnBy;
foreach my $link (@{ $links->ItemsArrayRef }) {
my $obj = $link->BaseObj;
if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
if ($obj->Type eq 'ticket') {
$obj->Correspond(
$obj->Comment(
Content => $self->loc("Your request was rejected."),
);
$obj->SetStatus(
Status => 'rejected',
Force => 1,
);
$rejected = 1;
}
else {
$obj->SetStatus(
......@@ -414,63 +455,78 @@ foreach my $link (@{ $links->ItemsArrayRef }) {
}
}
return 1;
# Now magically turn myself into a Requestor Notify object...
require RT::Action::Notify; bless($self, 'RT::Action::Notify');
$self->{Argument} = 'Requestor'; $self->Prepare;
return $rejected;
# ------------------------------------------------------------------- #
],
CustomPrepareCode => '1',
Template => 'Admin Comment', },
CustomCommitCode => '"never needed"',
Template => 'Approval Rejected', },
{ Description =>
"When a ticket has been approved by any approver, add correspondence to the original ticket"
, # loc
"When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
Queue => '___Approvals',
ScripCondition => 'On Resolve',
ScripAction => 'User Defined',
CustomPrepareCode => 'return(1);',
CustomCommitCode => q[
CustomPrepareCode => q[
# ------------------------------------------------------------------- #
return(1) unless ($self->TicketObj->Type eq 'approval');
return(0) unless ($self->TicketObj->Type eq 'approval');
my $note;
my $t = $self->TicketObj->Transactions;
while (my $o = $t->Next) {
$note .= $o->Content . "\n" if $o->ContentObj;
}
foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
$obj->Correspond(
$obj->Comment(
Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
$self->TransactionObj->CreatorObj->Name,
) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
$self->TicketObj->Transactions->Last->Content,
$note
),
_reopen => 0,
);
}
# Now magically turn myself into a Requestor Notify object...
require RT::Action::Notify; bless($self, 'RT::Action::Notify');
$self->{Argument} = 'Requestor'; $self->Prepare;
return 1;
# ------------------------------------------------------------------- #
],
Template => 'Admin Comment' },
CustomCommitCode => '"never needed"',
Template => 'Approval Passed' },
{ Description =>
"When a ticket has been approved by all approvers, add correspondence to the original ticket"
, # loc
Queue => '___Approvals',
ScripCondition => 'On Resolve',
ScripAction => 'User Defined',
CustomPrepareCode => 'return(1);',
CustomCommitCode => q[
CustomPrepareCode => q[
# ------------------------------------------------------------------- #
# Find all the tickets that depend on this (that this is approving)
my $Ticket = $self->TicketObj;
my @TOP = $Ticket->AllDependedOnBy( Type => 'ticket' );
my $links = $Ticket->DependedOnBy;
my $passed = 0;
while (my $link = $links->Next) {
my $obj = $link->BaseObj;
next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
if ($obj->Type eq 'ticket') {
$obj->Correspond(
$obj->Comment(
Content => $self->loc("Your request has been approved."),
_reopen => 0,
);
$passed = 1;
}
elsif ($obj->Type eq 'approval') {
$obj->SetStatus( Status => 'open', Force => 1 );
}
elsif (0) { # code tickets can be dangerous # $obj->Type eq 'code') {
elsif ($RT::UseCodeTickets and $obj->Type eq 'code') {
my $code = $obj->Transactions->First->Content;
my $rv;
......@@ -489,10 +545,15 @@ while (my $link = $links->Next) {
}
}
return 1;
# Now magically turn myself into a Requestor Notify object...
require RT::Action::Notify; bless($self, 'RT::Action::Notify');
$self->{Argument} = 'Requestor'; $self->Prepare;
return $passed;
# ------------------------------------------------------------------- #
],
Template => 'Admin Comment', },
CustomCommitCode => '"never needed"',
Template => 'All Approvals Passed', },
);
......
......@@ -29,9 +29,11 @@
subtabs => $subtabs,
Title => $title &>
% if (!$QueueObj->Disabled) { # Global scrips does not apply to disabled queues
<h2><&|/l&>Scrips which apply to all queues</&></h2>
<& /Admin/Elements/ListGlobalScrips &>
<BR>
% }
<& /Admin/Elements/EditScrips, title => $title, %ARGS &>
<%init>
my $QueueObj = new RT::Queue($session{'CurrentUser'});
......
......@@ -21,6 +21,7 @@
%#
%#
%# END LICENSE BLOCK
<& /Elements/Callback, %ARGS, error => $error &>
<& /Elements/Header, Code => $Code, Why => $Why &>
<& /Elements/Tabs &>
<& /Elements/TitleBoxStart, class=> "error", title => $Title &>
......
......@@ -27,6 +27,7 @@
<tr>
<td>
% }
<& /Elements/Callback, %ARGS &>
<div class="bpscredits">
&#187;&#124;&#171; <&|/l, $RT::VERSION &>RT [_1] from <a href="http://bestpractical.com">Best Practical Solutions, LLC</a>.</&>
</div>
......
......@@ -23,17 +23,18 @@
%# END LICENSE BLOCK
<%INIT>
local *session;
foreach my $key (keys %ARGS) {
# if they've passed multiple values, they'll be an array. if they've passed just one, a scalar
# whatever they are, mark them as utf8
if (ref($ARGS{$key})) {
@{$ARGS{$key}} = map { Encode::decode('utf-8',$_, Encode::FB_PERLQQ)} @{$ARGS{$key}};
}
else {
$ARGS{$key} = Encode::decode('utf-8',$ARGS{$key}, Encode::FB_PERLQQ) ;
}
}
%ARGS = map {
# if they've passed multiple values, they'll be an array. if they've passed just one, a scalar
# whatever they are, mark them as utf8
my $type = ref($_);
(!$type)
? Encode::decode(utf8 => $_, Encode::FB_PERLQQ) :
($type eq 'ARRAY')
? [ map { ref($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } @$_ ] :
($type eq 'HASH')
? { map { ref($_) ? $_ : Encode::decode(utf8 => $_, Encode::FB_PERLQQ) } %$_ } : $_
} %ARGS;
if ($ARGS{'Debug'}) {
require Time::HiRes;
$m->{'rt_base_time'} = [Time::HiRes::gettimeofday()];
......
......@@ -329,24 +329,34 @@ sub Commit {
use bytes;
# Create all the tickets we care about
$T::Tickets{'TOP'} = $T::TOP = $self->TicketObj;
return(1) unless $self->TicketObj->Type eq 'ticket';
foreach my $template_id ( @{ $self->{'template_order'} } ) {
$T::Tickets{'TOP'} = $T::TOP = $self->TicketObj;
$RT::Logger->debug("Workflow: processing $template_id of $T::TOP");
$T::ID = $template_id;
my $template = Text::Template->new(
TYPE => 'STRING',
SOURCE => $self->{'templates'}->{$template_id}
TYPE => 'STRING',
SOURCE => $self->{'templates'}->{$template_id}
);
$RT::Logger->debug("Workflow: evaluating\n$self->{templates}{$template_id}");
my $err;
my $filled_in = $template->fill_in( PACKAGE => 'T', BROKEN => sub {
$err = { @_ }->{error};
} );
$RT::Logger->debug("Workflow: yielding\n$filled_in");
if ($err) {
$RT::Logger->error("Ticket creation failed for ".$self->TicketObj->Id." ".$err);
while (my ($k, $v) = each %T::X) {
$RT::Logger->debug("Eliminating $template_id from ${k}'s parents.");
delete $v->{$template_id};
}
next;
}
......@@ -357,15 +367,16 @@ sub Commit {
my $value = $2;
my $tag = lc ($1);
$tag =~ s/-//g;
if (defined ($args{$tag})) { #if we're about to get a second value, make it an array
$args{$tag} = [$args{$tag}];
}
if (ref($args{$tag})) { #If it's an array, we want to push the value
push @{$args{$tag}}, $value;
}
else { #if there's nothing there, just set the value
$args{ $tag } = $value;
}
if (ref($args{$tag})) { #If it's an array, we want to push the value
push @{$args{$tag}}, $value;
}
elsif (defined ($args{$tag})) { #if we're about to get a second value, make it an array
$args{$tag} = [$args{$tag}, $value];
}
else { #if there's nothing there, just set the value
$args{ $tag } = $value;
}
if ( $tag eq 'content' ) { #just build up the content
# convert it to an array
......@@ -376,79 +387,85 @@ sub Commit {
}
}
}
}
foreach my $date qw(due starts started resolved) {
my $dateobj = RT::Date->new($RT::SystemUser);
if ($args{$date} =~ /^\d+$/) {
$dateobj->Set(Format => 'unix', Value => $args{$date});
} else {
$dateobj->Set(Format => 'unknown', Value => $args{$date});
}
$args{$date} = $dateobj->ISO;
}
my $mimeobj = MIME::Entity->new();
$mimeobj->build(Type => $args{'contenttype'},
Data => $args{'content'});
# Now we have a %args to work with.
# Make sure we have at least the minimum set of
# reasonable data and do our thang
$T::Tickets{$template_id} ||= RT::Ticket->new($RT::SystemUser);
# Deferred processing
push @links, (
$T::Tickets{$template_id}, {
DependsOn => $args{'dependson'},
DependedOnBy => $args{'dependedonby'},
RefersTo => $args{'refersto'},
ReferredToBy => $args{'referredtoby'},
Members => $args{'members'},
MemberOf => $args{'memberof'},
}
);
}
push @postponed, (
# Status is postponed so we don't violate dependencies
$T::Tickets{$template_id}, {
Status => $args{'status'},
}
);
my %ticketargs = ( Queue => $args{'queue'},
Subject=> $args{'subject'},
Status => 'new',
Due => $args{'due'},
Starts => $args{'starts'},
Started => $args{'started'},
Resolved => $args{'resolved'},
Owner => $args{'owner'},
Requestor => $args{'requestor'},
Cc => $args{'cc'},
AdminCc=> $args{'admincc'},
TimeWorked =>$args{'timeworked'},
TimeEstimated =>$args{'timeestimated'},
TimeLeft =>$args{'timeleft'},
InitialPriority => $args{'initialpriority'},
FinalPriority => $args{'finalpriority'},
Type => $args{'type'},
MIMEObj => $mimeobj);
foreach my $date qw(due starts started resolved) {
my $dateobj = RT::Date->new($RT::SystemUser);
next unless $args{$date};
if ($args{$date} =~ /^\d+$/) {
$dateobj->Set(Format => 'unix', Value => $args{$date});
} else {
$dateobj->Set(Format => 'unknown', Value => $args{$date});
}
$args{$date} = $dateobj->ISO;
}
my $mimeobj = MIME::Entity->new();
$mimeobj->build(Type => $args{'contenttype'},
Data => $args{'content'});
# Now we have a %args to work with.
# Make sure we have at least the minimum set of
# reasonable data and do our thang
$T::Tickets{$template_id} ||= RT::Ticket->new($RT::SystemUser);
$RT::Logger->debug("Assiging $template_id with $T::Tickets($template_id)");
# Deferred processing
push @links, (
$T::Tickets{$template_id}, {
DependsOn => $args{'dependson'},
DependedOnBy => $args{'dependedonby'},
RefersTo => $args{'refersto'},
ReferredToBy => $args{'referredtoby'},
Members => $args{'members'},
MemberOf => $args{'memberof'},
}
);
map {
/^customfield-(\d+)$/
&& ( $ticketargs{ "CustomField-" . $1 } = $args{$_} );
} keys(%args);
my ($id, $transid, $msg) = $T::Tickets{$template_id}->Create(%ticketargs);
unless($id) {
$RT::Logger->error("Couldn't create a related ticket for ".$self->TicketObj->Id." ".$msg);
}
push @postponed, (
# Status is postponed so we don't violate dependencies
$T::Tickets{$template_id}, {
Status => $args{'status'},
}
);
$args{'requestor'} ||= $self->TicketObj->Requestors->MemberEmailAddresses;
my %ticketargs = ( Queue => $args{'queue'},
Subject=> $args{'subject'},
Status => 'new',
Due => $args{'due'},
Starts => $args{'starts'},
Started => $args{'started'},
Resolved => $args{'resolved'},
Owner => $args{'owner'},
Requestor => $args{'requestor'},
Cc => $args{'cc'},
AdminCc=> $args{'admincc'},
TimeWorked =>$args{'timeworked'},
TimeEstimated =>$args{'timeestimated'},
TimeLeft =>$args{'timeleft'},
InitialPriority => $args{'initialpriority'},
FinalPriority => $args{'finalpriority'},
Type => $args{'type'},
MIMEObj => $mimeobj);
map {
/^customfield-(\d+)$/
&& ( $ticketargs{ "CustomField-" . $1 } = $args{$_} );
} keys(%args);
my ($id, $transid, $msg) = $T::Tickets{$template_id}->Create(%ticketargs);
unless($id) {
$RT::Logger->error("Couldn't create a related ticket for ".$self->TicketObj->Id." ".$msg);
}
}
$T::Tickets{$template_id}->SetOriginObj($self->TicketObj)
if $T::Tickets{$template_id}->can('SetOriginObj');
}
# postprocessing: add links
while (my $ticket = shift(@links)) {
$RT::Logger->debug("Handling links for $ticket");
$RT::Logger->debug("Handling links for " . $ticket->Id);
my %args = %{shift(@links)};
foreach my $type ( keys %LINKTYPEMAP ) {
......@@ -457,8 +474,9 @@ sub Commit {
ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) )
{
$RT::Logger->debug("Building link for $link: $T::Tickets{$link}");
$link = $T::Tickets{$link}->Id if exists $T::Tickets{$link};
$RT::Logger->debug("Building $type link for $link: $T::Tickets{$link}");
next unless exists $T::Tickets{$link};
$link = $T::Tickets{$link}->Id;
my ( $wval, $wmsg ) = $ticket->AddLink(
Type => $LINKTYPEMAP{$type}->{'Type'},
......@@ -466,6 +484,7 @@ sub Commit {
Silent => 1
);
$RT::Logger->warning("AddLink thru $link failed: $wmsg") unless $wval;
# push @non_fatal_errors, $wmsg unless ($wval);
}
......
......@@ -565,6 +565,12 @@ sub SetSubjectToken {
sub SetHeaderAsEncoding {
my $self = shift;
my ( $field, $enc ) = ( shift, shift );
if ($field eq 'From' and $RT::SMTPFrom) {
$self->TemplateObj->MIMEObj->head->replace( $field, $RT::SMTPFrom );
return;
}
my $value = $self->TemplateObj->MIMEObj->head->get($field);
# don't bother if it's us-ascii
......