Here is a patch against 3.2.2. Please test before using for
anything important.
-Todd
Index: html/Ticket/Elements/EditCustomField
— html/Ticket/Elements/EditCustomField (revision 1949)
+++ html/Ticket/Elements/EditCustomField (working copy)
@@ -68,8 +68,8 @@
<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><%$content%>
% } elsif ($CustomField->Type =~ /^Select/) {
gic" value=“1”>
% my $CustomFieldValues = $CustomField->Values();
@@ -90,6 +90,7 @@
$TicketObj => undef
$CustomField => undef
$NamePrefix => undef
+$NameSuffix => undef
$Rows => 5
$Cols=> 15
$Default => undef
Index: html/Search/Bulk.html
— html/Search/Bulk.html (revision 1949)
+++ html/Search/Bulk.html (working copy)
@@ -171,11 +171,21 @@
% }
<%$pref%> <% $cf->Name %>
<% $cf->FriendlyType %>
+% if ($cf->Type =~ /SelectSingle/) {
+
<&|/l&>Don’t update</&>
+% }
-% if ($cf->Type ne "FreeformMultiple") {
+% if ($cf->Type eq "SelectMultiple") {
+Add Values
+<& /Ticket/Elements/EditCustomField, CustomField => $cf, NameSuffix => 'AddValue' &>
+Delete Values
+<& /Ticket/Elements/EditCustomField, CustomField => $cf, NameSuffix => 'DeleteValues' &>
+% }
+% elsif ($cf->Type ne "FreeformMultiple") {
<& /Ticket/Elements/EditCustomField, CustomField => $cf &>
-% } else {
+% }
+% else {
Add Values
|
Index: lib/RT/Interface/Web.pm
--- lib/RT/Interface/Web.pm (revision 1949)
+++ lib/RT/Interface/Web.pm (working copy)
@@ -294,8 +294,18 @@
);
foreach my $arg (%ARGS) {
if ($arg =~ /^CustomField-(\d+)(.*?)$/) {
+ my $cfid = $1;
next if ($arg =~ /-Magic$/);
- $create_args{"CustomField-".$1} = $ARGS{"$arg"};
+ my $cf = new RT::CustomField( $RT::SystemUser );
+ $cf->Load($cfid);
+ if ($cf->Type eq 'FreeformMultiple') {
+ $ARGS{$arg} =~ s/\r\n/\n/g;
+ $ARGS{$arg} = [split('\n', $ARGS{$arg})];
+ }
+ $create_args{"CustomField-".$cfid} = $ARGS{"$arg"};
}
}
@@ -1006,7 +1016,8 @@
}
}
- $ARGSRef->{‘Status’} ||= $TicketObj->Status;
-
#$ARGSRef->{‘Status’} ||= $TicketObj->Status;
-
delete $ARGSRef->{‘Status’} unless ($ARGSRef->{‘Status’});
my @results = UpdateRecordObject(
AttributesRef => @attribs,
@@ -1053,50 +1064,55 @@
my %custom_fields_to_mod;
foreach my $arg ( keys %{$ARGSRef} ) {
if ( $arg =~ /^Ticket-(\d+)-CustomField-(\d+)-/ ) {
-
my ($tick, $cf) = ($1, $2);
-
next if $ARGSRef->{"Ticket-$tick-CustomField-$cf-DoNotUpdate"};
# For each of those tickets, find out what custom fields we want to work with.
-
my $CustomFieldObj = RT::CustomField->new($session{'CurrentUser'});
-
$CustomFieldObj->LoadById($cf);
foreach my $arg ( keys %{$ARGSRef} ) {
# since http won't pass in a form element with a null value, we need
# to fake it
-
#for poor windows boxen that pass in "\r\n"
-
local $/ = "\r";
-
chomp @values;
if ( ( $arg =~ /-AddValue$/ ) || ( $arg =~ /-Value$/ ) ) {
-
my $cf_values = $Ticket->CustomFieldValues($cf);
foreach my $value (@values) {
next unless length($value);
-
next if $cf_values->HasEntry($value);
my ( $val, $msg ) = $Ticket->AddCustomFieldValue(
Field => $cf,
Value => $value
@@ -1105,8 +1121,10 @@
}
}
elsif ( $arg =~ /-DeleteValues$/ ) {
-
my $cf_values = $Ticket->CustomFieldValues($cf);
foreach my $value (@values) {
next unless length($value);
-
next unless $cf_values->HasEntry($value);
my ( $val, $msg ) = $Ticket->DeleteCustomFieldValue(
Field => $cf,
Value => $value
@@ -1148,29 +1166,30 @@
elsif ( $arg =~ /-Values$/ ) {
my $cf_values = $Ticket->CustomFieldValues($cf);
-
# keep everything up to the point of difference, delete the rest
-
my $delete_flag;
-
foreach my $old_cf (@{$cf_values->ItemsArrayRef}) {
-
if (!$delete_flag and @values and $old_cf->Content eq $values[0]) {
-
shift @values;
-
next;
-
}
-
# keep everything up to the point of difference, delete the rest
-
my $delete_flag;
-
foreach my $old_cf (@{$cf_values->ItemsArrayRef}) {
-
if (!$delete_flag and @values and $old_cf->Content eq $values[0]) {
-
shift @values;
-
next;
-
}
-
$delete_flag ||= 1;
-
$old_cf->Delete;
-
}
-
$delete_flag ||= 1;
-
$old_cf->Delete;
-
}
-
# now add/replace extra things, if any
-
foreach my $value (@values) {
-
my ( $val, $msg ) = $Ticket->AddCustomFieldValue(
-
Field => $cf,
-
Value => $value
-
);
-
push ( @results, $msg );
-
}
-
}
-
# now add/replace extra things, if any
-
foreach my $value (@values) {
-
my ( $val, $msg ) = $Ticket->AddCustomFieldValue(
-
Field => $cf,
-
Value => $value
-
);
-
push ( @results, $msg );
-
}
-
}
else {
icket " . $Ticket->id );
m
+e . " for ticket " . $Ticket->id );
}
}
}
|