Commit 79302ae3 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

* since we don't name fields CoreField-Subject (and doing so
  would mean magic frobbing of request_args before Create)
  share the meaning of what a CoreField is with a library function
parent cc8ac9c0
......@@ -12,7 +12,8 @@ my $queue = $m->notes('queue');
my $field_type = 'custom';
my $field_label ||= $label;
my $cf;
if ( $name =~ /^(Requestors|Cc|AdminCc|Subject)$/i ) {
if ( RT::Extension::FormTools::is_core_field($name) ) {
$field_type = 'core';
my $res = $m->notes(
core_fields_on_page => [ @{$m->notes('core_fields_on_page')||[]}, $name ] );
......
......@@ -17,7 +17,7 @@ foreach my $key (keys %request_args) {
}
foreach my $key (keys %request_args) {
next unless ($key =~ /CoreField-(\d+)/ );
next unless RT::Extension::FormTools::is_core_field($key);
my $field = $1;
delete $request_args{$key} if ($core_fields{$field});
}
......
......@@ -3,4 +3,22 @@ use strict;
package RT::Extension::FormTools;
our $VERSION = '0.03';
=head2 is_core_field
passed one argument (field name) and checks if
that is a field that we consider 'core' to
RT (subject, AdminCc, etc) rather than something
which should be treated as a Custom Field.
Naming a Custom Field Subject would cause
serious pain with FormTools
=cut
sub is_core_field {
return $_[0] =~ /^(Requestors|Cc|AdminCc|Subject)$/;
}
1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment