[Rt-commit] [svn] r1082 - rt/branches/rt-3.3/lib/RT

alexmv at pallas.eruditorum.org alexmv at pallas.eruditorum.org
Wed Jun 16 10:53:17 EDT 2004


Author: alexmv
Date: Wed Jun 16 10:53:17 2004
New Revision: 1082

Modified:
   rt/branches/rt-3.3/lib/RT/Record.pm
   rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
Log:
RT-Ticket: 5732
RT-Status: stalled
RT-Update: correspond

 * POD spacing mistake in Ticket_Overlay

 * Ticket_Overlay now overrides RT::Record's CustomFieldValues method,
   to intercept calls where the field is passed by name.  I don't have
   a way of testing this patch, so this bug is getting marked stalled
   until this patch is verified.


Modified: rt/branches/rt-3.3/lib/RT/Record.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Record.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Record.pm	Wed Jun 16 10:53:17 2004
@@ -1591,7 +1591,7 @@
 =item CustomFieldValues FIELD
 
 Return a ObjectCustomFieldValues object of all values of CustomField FIELD for this ticket.  
-Takes a field id or name.
+Takes a field id.
 
 
 =cut

Modified: rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	Wed Jun 16 10:53:17 2004
@@ -2675,6 +2675,7 @@
 # {{{ sub MergeInto
 
 =head2 MergeInto
+
 MergeInto take the id of the ticket to merge this ticket into.
 
 =cut
@@ -3632,6 +3633,22 @@
     return $self->QueueObj->TicketTransactionCustomFields;
 }
 
+# Do name => id mapping (if needed) before falling back to
+# RT::Record's CustomFieldValues
+sub CustomFieldValues {
+    my $self = shift;
+    my $field = shift;
+    unless ($field =~ /^\d+$/) {
+	my $cf = RT::CustomField->new($self->CurrentUser);
+	$cf->LoadByNameAndQueue(Name => $field, Queue => $self->QueueObj->Id);
+	unless( $cf->id ) {
+            $cf->LoadByNameAndQueue(Name => $field, Queue => '0');
+        }
+	$field = $cf->id;
+    }
+    return $self->SUPER::CustomFieldValues($field);
+}
+
 sub _LookupTypes {
     "RT::Queue-RT::Ticket";
 }


More information about the Rt-commit mailing list