[Rt-commit] r4504 - in rt/branches/QUEBEC-EXPERIMENTAL: .
html/Search html/Tools
alexmv at bestpractical.com
alexmv at bestpractical.com
Wed Feb 8 15:01:19 EST 2006
Author: alexmv
Date: Wed Feb 8 15:01:17 2006
New Revision: 4504
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Results.tsv
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Offline.html
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm
Log:
r8969 at zoq-fot-pik: chmrr | 2006-02-08 15:00:00 -0500
* Whitespace fixes in Results.tsv
* Spit out custom fields as CF-...
* During offline upload parsing, try to treat date as ISO first,
falling back to unknown
* Keep offline upload form from tacking on an extra newline each
submit
* Minimize yo-yo-ing of status if possible
* Allow false values as possible values, as long as they're defined
* Cc, AdminCc, and Requestor may be either email addresses or users
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Results.tsv
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Results.tsv (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Results.tsv Wed Feb 8 15:01:17 2006
@@ -55,33 +55,36 @@
Requestors->MemberEmailAddressesAsString DueObj->ISO ToldObj->ISO
CreatedObj->ISO ResolvedObj->ISO );
- $r->content_type('application/vnd.ms-excel');
- while ( my $Ticket = $Tickets->Next()) {
- my $row;
- foreach my $attr (@attrs) {
- my $method = '$Ticket->'.$attr.'()';
- $row->{$attr} = eval $method;
+$r->content_type('application/vnd.ms-excel');
+while ( my $Ticket = $Tickets->Next()) {
+ my $row;
+ foreach my $attr (@attrs) {
+ if ($attr =~ /(.*)->ISO$/ and $Ticket->$1->Unix <= 0) {
+ $row->{$attr} = "";
+ } else {
+ my $method = '$Ticket->'.$attr.'()';
+ $row->{$attr} = eval $method;
if ($@) {die "Failed to find $attr - ". $@};
- }
-
- my $cfs = $Ticket->QueueObj->TicketCustomFields();
- while (my $cf = $cfs->Next) {
- my @content;
- my $values = $Ticket->CustomFieldValues($cf->Id);
- while (my $value = $values->Next) {
- push @content, $value->Content;
- }
- $row->{'CustomField-'.$cf->Id} = join(', ', at content);
- if ($row->{'CustomField-'.$cf->Id}) {
- $known_cfs{$cf->Id} = $cf->Name;
- }
}
- push @rows, $row;
-
+ }
+ my $cfs = $Ticket->QueueObj->TicketCustomFields();
+ while (my $cf = $cfs->Next) {
+ my @content;
+ my $values = $Ticket->CustomFieldValues($cf->Id);
+ while (my $value = $values->Next) {
+ push @content, $value->Content;
+ }
+ $row->{'CustomField-'.$cf->Id} = join(', ', at content);
+ if ($row->{'CustomField-'.$cf->Id}) {
+ $known_cfs{$cf->Id} = $cf->Name;
+ }
}
+ push @rows, $row;
+}
+
{
-my @header;
+ my @header;
foreach my $attr (@attrs) {
my $label = $attr;
$label =~ s'Obj-.(?:AsString|Name|ISO)''g;
@@ -89,27 +92,25 @@
push @header, $label;
}
foreach my $id (sort keys %known_cfs) {
- push @header, $known_cfs{$id};
+ push @header, "CF-".$known_cfs{$id};
}
-
-$m->out(join("\t", @header));
-$m->out("\n");
+ $m->out(join("\t", @header));
+ $m->out("\n");
}
+
foreach my $row (@rows) {
- my @row;
- foreach my $attr(@attrs) {
- push @row, $row->{"$attr"};
- }
- foreach my $id (sort keys %known_cfs) {
- my $val = $row->{'CustomField-'.$id};
- $val =~ s/(\n|\r)//g;
- push @row, $val;
- }
-
- $m->out(join("\t", at row));
- $m->out("\n");
+ my @row;
+ foreach my $attr(@attrs) {
+ push @row, $row->{"$attr"};
+ }
+ foreach my $id (sort keys %known_cfs) {
+ my $val = $row->{'CustomField-'.$id};
+ $val =~ s/(\n|\r)//g;
+ push @row, $val;
+ }
+ $m->out(join("\t", at row));
+ $m->out("\n");
}
-
$m->abort();
</%INIT>
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Offline.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Offline.html (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Offline.html Wed Feb 8 15:01:17 2006
@@ -78,9 +78,7 @@
<&|/l&>Template</&>:
</td>
<td colspan=2>
-<textarea name=string cols=80 rows=30>
-<%$string%>
-</textarea>
+<textarea name=string cols=80 rows=30><%$string%></textarea>
</td>
</tr>
<tr><td class=label>
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Action/CreateTickets.pm Wed Feb 8 15:01:17 2006
@@ -956,7 +956,12 @@
if ( $args{$date} =~ /^\d+$/ ) {
$dateobj->Set( Format => 'unix', Value => $args{$date} );
} else {
- $dateobj->Set( Format => 'unknown', Value => $args{$date} );
+ eval {
+ $dateobj->Set( Format => 'iso', Value => $args{$date} );
+ };
+ if ($@ or $dateobj->Unix <= 0) {
+ $dateobj->Set( Format => 'unknown', Value => $args{$date} );
+ }
}
$args{$date} = $dateobj->ISO;
}
@@ -969,7 +974,7 @@
my %ticketargs = (
Queue => $args{'queue'},
Subject => $args{'subject'},
- Status => 'new',
+ Status => $args{'status'} || 'new',
Due => $args{'due'},
Starts => $args{'starts'},
Started => $args{'started'},
@@ -1117,7 +1122,7 @@
# Tack onto the end of the template
$template .= $field . ": ";
- $template .= $value || "";
+ $template .= (defined $value ? $value : "");
$template .= "\n";
$template .= "ENDOFCONTENT\n"
if $field =~ /^Content$/i;
@@ -1309,7 +1314,25 @@
my $newaddr = $args->{$type};
my @old = split( /,\s*/, $oldaddr );
- my @new = ref $newaddr ? @{$newaddr} : split( /,\s*/, $newaddr );
+ my @new;
+ for (ref $newaddr ? @{$newaddr} : split( /,\s*/, $newaddr )) {
+ # Sometimes these are email addresses, sometimes they're
+ # users. Try to guess which is which, as we want to deal
+ # with email addresses if at all possible.
+ if (/^\S+@\S+$/) {
+ push @new, $_;
+ } else {
+ # It doesn't look like an email address. Try to load it.
+ my $user = RT::User->new($self->CurrentUser);
+ $user->Load($_);
+ if ($user->Id) {
+ push @new, $user->EmailAddress;
+ } else {
+ push @new, $_;
+ }
+ }
+ }
+
my %oldhash = map { $_ => 1 } @old;
my %newhash = map { $_ => 1 } @new;
More information about the Rt-commit
mailing list