[rt-users] Custom Fields and Templates

Andy Harrison ah30 at harrisonfamily.com
Tue Mar 2 16:30:37 EST 2004


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Tue, 02 Mar 2004 20:57:37 +0300, Ruslan U. Zakirov wrote
Subject: "Re: [rt-users] Custom Fields and Templates"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  You've forgot about custom fields with multiply values. It break your 
>  indend, but not mine :)
>  Second 'while' specialy for this case.

Oh yes.  Here's a prettier version.  Multiple value fields are
displayed underneath the fieldname instead of beside it.

{
  my $CustomFields = $Ticket->QueueObj->CustomFields();
  while (my $CustomField = $CustomFields->Next()) {
    my $CustomFieldValues=$Ticket->CustomFieldValues($CustomField->Id);
    $OUT .= $CustomField->Name;
    if ($CustomFieldValues->Count) {
      my $spacer;
      if ( $CustomField->Type ne 'FreeformMultiple' and
           $CustomField->Type ne 'SelectMultiple' ) {
        $spacer = " " x (20 - length($CustomField->Name));
      } else {
        $spacer = "\n";
      }
      $OUT .= ":" . $spacer; 
    } else {
      $OUT .= ":\n";
      next;
    }
    while (my $CustomFieldValue = $CustomFieldValues->Next) {
      $OUT .= " " if ( $CustomField->Type eq 'FreeformMultiple' or
                        $CustomField->Type eq 'SelectMultiple' );
      $OUT .= $CustomFieldValue->Content . "\n";
    }
    $OUT .= "\n" if ( $CustomField->Type eq 'FreeformMultiple' or
                        $CustomField->Type eq 'SelectMultiple' );
  }
  $OUT;
 }


-- 
Andy Harrison
(full headers for details)




More information about the rt-users mailing list