[Rt-commit] r9145 - in rt/branches/3.6-RELEASE: bin
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Tue Sep 25 12:05:10 EDT 2007
Author: sunnavy
Date: Tue Sep 25 12:05:09 2007
New Revision: 9145
Modified:
rt/branches/3.6-RELEASE/bin/rt.in
rt/branches/3.6-RELEASE/html/REST/1.0/Forms/ticket/default
Log:
revert back for multiple cf values bug in cli, we need a branch for that
Modified: rt/branches/3.6-RELEASE/bin/rt.in
==============================================================================
--- rt/branches/3.6-RELEASE/bin/rt.in (original)
+++ rt/branches/3.6-RELEASE/bin/rt.in Tue Sep 25 12:05:09 2007
@@ -59,7 +59,6 @@
use Text::ParseWords;
use HTTP::Request::Common;
use Term::ReadLine;
-use Text::Balanced qw/extract_quotelike/;
# We derive configuration information from hardwired defaults, dotfiles,
# and the RT* environment variables (in increasing order of precedence).
@@ -1328,36 +1327,11 @@
my ($word, @words);
my @values = ref $val eq 'ARRAY' ? @$val : $val;
- foreach my $line ( map { split /\n/ } @values ) {
+ foreach my $line (map {split /\n/} @values) {
+ # XXX: This should become a real parser, à la Text::ParseWords.
$line =~ s/^\s+//;
$line =~ s/\s+$//;
- my ( $extracted, $remainder ) = extract_quotelike($line);
- while ($remainder) {
- if ($extracted) {
- if ( $extracted =~ /^q{/ ) {
- $extracted =~ s/'/\\'/g;
- $extracted =~ s/^q{/'/;
- $extracted =~ s/}$/'/;
- }
- push @words, $extracted;
- $remainder =~ s/^\s*,\s*//;
- }
- else {
- my @t = split /,/, $remainder;
- push @words, shift @t;
- last unless @t;
- $remainder =~ s/.*?,\s*//;
- }
- ( $extracted, $remainder ) = extract_quotelike($remainder);
- }
- if ( $extracted ) {
- if ( $extracted =~ /^q{/ ) {
- $extracted =~ s/'/\\'/g;
- $extracted =~ s/^q{/'/;
- $extracted =~ s/}$/'/;
- }
- push @words, $extracted;
- }
+ push @words, split /\s*,\s*/, $line;
}
return \@words;
Modified: rt/branches/3.6-RELEASE/html/REST/1.0/Forms/ticket/default
==============================================================================
--- rt/branches/3.6-RELEASE/html/REST/1.0/Forms/ticket/default (original)
+++ rt/branches/3.6-RELEASE/html/REST/1.0/Forms/ticket/default Tue Sep 25 12:05:09 2007
@@ -55,7 +55,6 @@
</%ARGS>
<%INIT>
use MIME::Entity;
-use Text::Balanced qw /extract_quotelike/;
my @comments;
my ($c, $o, $k, $e) = ("", [], {}, 0);
@@ -218,21 +217,8 @@
next unless (!%$fields || (exists $fields->{"cf-".lc $cf->Name}));
my $vals = $ticket->CustomFieldValues($cf->Id());
my @out = ();
- if ( $cf->SingleValue ) {
- my $v = $vals->Next;
- push @out, $v->Content if $v;
- }
- else {
- while (my $v = $vals->Next()) {
- my $content = $v->Content;
- $content =~ s/'/\\'/g;
- if ( $v->Content =~ /,/ ) {
- push @out, q{'} . $content . q{'};
- }
- else {
- push @out, $content;
- }
- }
+ while (my $v = $vals->Next()) {
+ push @out, $v->Content;
}
push @data, [ 'CF-' . $cf->Name => join ',', @out ];
}
@@ -327,75 +313,9 @@
$s = "Unknown custom field.";
}
else {
- my $vals = $ticket->CustomFieldValues($cf->id);
-
- if ( $cf->SingleValue ) {
- my $old = $vals->Next;
- if ( $old ) {
- if ( $val ne $old->Content ) {
- $old->Delete;
- ($n, $s) = $ticket->AddCustomFieldValue(
- Field => $cf, Value => $val );
- $s =~ s/^# // if defined $s;
- }
- }
- else {
- ($n, $s) = $ticket->AddCustomFieldValue(
+ ($n, $s) = $ticket->AddCustomFieldValue(
Field => $cf, Value => $val );
- $s =~ s/^# // if defined $s;
- }
- }
- else {
- my @new;
- my ( $extracted, $remainder ) = extract_quotelike($val);
- while ($remainder) {
- if ($extracted) {
- $extracted =~ s/\\'/'/g;
- my $length = length $extracted;
- my $first_letter = substr $extracted, 0, 1;
- push @new, substr $extracted,
- $first_letter eq 'q' ? 2 : 1,
- $first_letter eq 'q' ? $length-3 : $length-2;
- $remainder =~ s/\s*,\s*//;
- }
- else {
- my @t = split /,\s*/, $remainder;
- push @new, shift @t;
- last unless @t;
- $remainder =~ s/.*?,\s*//;
- }
- ( $extracted, $remainder ) =
- extract_quotelike($remainder);
- }
- if ( $extracted ) {
- $extracted =~ s/\\'/'/g;
- my $length = length $extracted;
- my $first_letter = substr $extracted, 0, 1;
- push @new, substr $extracted,
- $first_letter eq 'q' ? 2 : 1,
- $first_letter eq 'q' ? $length-3 : $length-2;
- }
-
- my %new;
- $new{$_}++ for @new;
-
- while (my $v = $vals->Next()) {
- my $c = $v->Content;
- if ( $new{$c} ) {
- $new{$c}--;
- }
- else {
- $v->Delete();
- }
- }
- for ( @new ) {
- while ( $new{$_} && $new{$_}-- ) {
- ($n, $s) = $ticket->AddCustomFieldValue(
- Field => $cf, Value => $_ );
- $s =~ s/^# // if defined $s;
- }
- }
- }
+ $s =~ s/^# // if defined $s;
}
}
elsif ($key ne 'id' && $key ne 'type' && $key ne 'creator') {
More information about the Rt-commit
mailing list