[Rt-commit] rt branch, 4.2/txn-cfs-on-create, created. rt-4.2.2-15-ge092e23
Alex Vandiver
alexmv at bestpractical.com
Tue Feb 4 17:08:40 EST 2014
The branch, 4.2/txn-cfs-on-create has been created
at e092e23af8cd272e816a91deb3ab155dfc3e857c (commit)
- Log -----------------------------------------------------------------
commit e092e23af8cd272e816a91deb3ab155dfc3e857c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Feb 4 15:37:54 2014 -0500
Skip custom fields that do not apply to the ticket/transaction
RT::Interface::Web::CreateTicket munges the query parameters to pass
Customfield-42 to RT::Ticket::Create, as of be3529af. An important
change made in this commit is that previously, transaction custom fields
were passed through with their keys unmodified -- that is, as
Object-RT::Transaction--Customfield-42.
After be3529af, the information about if the CF was a Ticket or
Transaction custom field has been lost by the time the CFs are being
iterated. This led to attempting to add values for Transaction CFs on
Ticket objects, and vice versa -- and thus warnings in the UI of "Custom
field 42 does not apply to this object" for every applied transaction
CF.
Only attempt to add CF values to objects if they are of the correct
class.
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 961e4d0..ce20489 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -470,6 +470,8 @@ sub Create {
foreach my $arg ( keys %args ) {
next unless $arg =~ /^CustomField-(\d+)$/i;
my $cfid = $1;
+ my $cf = $self->LoadCustomFieldByIdentifier($cfid);
+ next unless $cf->ObjectTypeFromLookupType->isa(ref $self);
foreach my $value (
UNIVERSAL::isa( $args{$arg} => 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index d1be663..d2e78d8 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1405,6 +1405,8 @@ sub UpdateCustomFields {
next if $arg =~ /-Magic$/;
my $cfid = $1;
my $values = $args->{$arg};
+ my $cf = $self->LoadCustomFieldByIdentifier($cfid);
+ next unless $cf->ObjectTypeFromLookupType->isa(ref $self);
foreach
my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values )
{
-----------------------------------------------------------------------
More information about the rt-commit
mailing list