[rt-users] Custom Fields and Templates

Ruslan U. Zakirov cubic at acronis.ru
Fri Mar 5 06:31:03 EST 2004


Andy Harrison wrote:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 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;
>  }
> 
> 
I've copied it to wiki.bestpractical.com

		Best regards. Ruslan.



More information about the rt-users mailing list