[Rt-commit] r16408 - in rt/branches/3.999-DANGEROUS: lib/RT/Action
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Tue Oct 21 05:42:21 EDT 2008
Author: sunnavy
Date: Tue Oct 21 05:42:20 2008
New Revision: 16408
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT/Action/EditTicketCFs.pm
Log:
r17239 at sunnavys-mb: sunnavy | 2008-10-21 17:40:57 +0800
wikitext also needs to be compared with old values
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Action/EditTicketCFs.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Action/EditTicketCFs.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Action/EditTicketCFs.pm Tue Oct 21 05:42:20 2008
@@ -69,16 +69,7 @@
my $values = $ticket->custom_field_values( $cf->id );
my $new_values = $args->{$cfid};
- if ( $cf->type =~ /text/i ) {
- $new_values =~ s/\r+\n/\n/g;
- $new_values =~ s/^\s+//g;
- $new_values =~ s/\s+$//g;
- $ticket->add_custom_field_value(
- field => $cfid,
- value => $new_values,
- );
- }
- elsif ( $cf->type eq 'Binary' ) {
+ if ( $cf->type eq 'Binary' ) {
next unless $new_values;
my $cgi_object = Jifty->handler->cgi;
my $upload_info = $cgi_object->uploadInfo($new_values);
@@ -95,20 +86,22 @@
}
else {
- # now we deal with values like 'two', 'three' or [ 'foo', 'bar' ]
unless ( ref $new_values ) {
- $new_values = [
- grep length,
- map {
- s/\r+\n/\n/g;
- s/^\s+//;
- s/\s+$//;
- $_;
- }
- grep defined,
- split /\r*\n/,
- $new_values
- ];
+ $new_values =~ s/\r+\n/\n/g;
+ $new_values =~ s/^\s+//g;
+ $new_values =~ s/\s+$//g;
+
+ # wikitext or text
+ if ( $cf->type =~ /text/i ) {
+ $new_values = [$new_values];
+ }
+ else {
+
+ # freeform or select values like 'two', 'three'
+ $new_values = [
+ grep defined && length, split /\r*\n/, $new_values
+ ];
+ }
}
if ($values) {
More information about the Rt-commit
mailing list