diff options
author | Brian Conry <bconry@bestpractical.com> | 2022-06-01 01:17:07 +0300 |
---|---|---|
committer | Brian Conry <bconry@bestpractical.com> | 2022-06-01 01:17:07 +0300 |
commit | 88a3b3715eb25d1d5ef128ca246406e605b2075e (patch) | |
tree | e74944b5c3f57bba84cc3e7114840fbf368f2d5d | |
parent | feea28f1c0b2cd5db0fa5a2e499959ccbe02ec03 (diff) |
Fix HTML custom fields getting 'text/html' as a value5.0/allow-empty-html-cf-on-create
Commit c9d8c506ca added the HTML custom field type. One of the
mechanics for properly displaying and decoding the value for these
fields is having a '-ValuesType' hidden input associated with the CF.
The functions
RT::Interface::Web::ProcessObjectCustomFieldUpdatesForCreate and
RT::Transaction::UpdateCustomFields did not know to ignore this in the
args list and were therefore processing it as if it were a '-Value'
parameter, causing a CF that wasn't otherwise given a value to get the
value 'text/html'.
Other object types with custom fields use
_ProcessObjectCustomFieldUpdates which did know to ignore the
'ValuesType' parameter.
-rw-r--r-- | lib/RT/Interface/Web.pm | 3 | ||||
-rw-r--r-- | lib/RT/Transaction.pm | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm index c58ba20758..3c6b3ac9b6 100644 --- a/lib/RT/Interface/Web.pm +++ b/lib/RT/Interface/Web.pm @@ -3516,7 +3516,8 @@ sub ProcessObjectCustomFieldUpdatesForCreate { while (my ($arg, $value) = each %{ $custom_fields{$class}{0}{$cfid}{$groupings[0]} }) { # Values-Magic doesn't matter on create; no previous values are being removed # Category is irrelevant for the actual value - next if $arg =~ /-Magic$/ or $arg =~ /-Category$/; + # ValuesType is only used for display + next if $arg =~ /-Magic$/ or $arg =~ /-Category$/ or $arg eq 'ValuesType'; push @values, _NormalizeObjectCustomFieldValue( diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm index e6a5746ce0..e072f996b6 100644 --- a/lib/RT/Transaction.pm +++ b/lib/RT/Transaction.pm @@ -1632,7 +1632,7 @@ sub UpdateCustomFields { next unless ( $arg =~ /^(?:Object-RT::Transaction--)?CustomField-(\d+)/ ); - next if $arg =~ /-Magic$/; + next if $arg =~ /-Magic$/ or $arg =~ /-Category$/ or $arg =~ /-ValuesType$/; my $cfid = $1; my $values = $args{$arg}; my $cf = $self->LoadCustomFieldByIdentifier($cfid); |