[Bps-public-commit] r12971 - in RT-FormTools: . lib/RT/Extension

falcone at bestpractical.com falcone at bestpractical.com
Fri Jun 6 11:49:19 EDT 2008


Author: falcone
Date: Fri Jun  6 11:49:19 2008
New Revision: 12971

Modified:
   RT-FormTools/   (props changed)
   RT-FormTools/html/FormTools/Field
   RT-FormTools/html/FormTools/Form
   RT-FormTools/lib/RT/Extension/FormTools.pm

Log:
 r33861 at ketch:  falcone | 2008-06-06 11:46:09 -0400
 * 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


Modified: RT-FormTools/html/FormTools/Field
==============================================================================
--- RT-FormTools/html/FormTools/Field	(original)
+++ RT-FormTools/html/FormTools/Field	Fri Jun  6 11:49:19 2008
@@ -12,7 +12,8 @@
 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 ] );

Modified: RT-FormTools/html/FormTools/Form
==============================================================================
--- RT-FormTools/html/FormTools/Form	(original)
+++ RT-FormTools/html/FormTools/Form	Fri Jun  6 11:49:19 2008
@@ -17,7 +17,7 @@
 }
 
 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});
 }

Modified: RT-FormTools/lib/RT/Extension/FormTools.pm
==============================================================================
--- RT-FormTools/lib/RT/Extension/FormTools.pm	(original)
+++ RT-FormTools/lib/RT/Extension/FormTools.pm	Fri Jun  6 11:49:19 2008
@@ -3,4 +3,22 @@
 
 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;



More information about the Bps-public-commit mailing list