[rt-devel] use utf8 in scrip action

Christian Loos cloos at netcologne.de
Fri Jan 16 09:31:13 EST 2015


One way to avoid this would be using custom field id's instead of names.

Chris

Am 15.01.2015 um 16:40 schrieb Emmanuel Lacour:
> Maybe something I'm doing badly. I have a scrip action Foo.pm which will
> work on some CF with non-ascii names.
> 
> 
> Here is part of the code:
> 
> 
> --------------------snip-----------------------
> package RT::Action::StartNextAction;
> 
> use strict;
> use warnings;
> use base qw(RT::Action);
> use utf8;
> 
> sub Commit {
>     my $self = shift;
> 
>     ...
> 
>     my $next_phone = ...;
> 
>     my $cf_clones;
>     my $ActionCFs = $Ticket->CustomFields;
>     while ( my $CustomField = $ActionCFs->Next ) {
>         my $values = $Ticket->CustomFieldValues($CustomField->id);
>         next unless ( $values && $values->Count );
>         $cf_clones->{$CustomField->Name} = $values->First->Content;
>     }
> 
>     if ($next_phone && $next_phone ne $cf_clones->{'Numéro de
> télephone'} ) {
>         $cf_clones->{'Numéro de télephone'} = $next_phone;
>         $cf_clones->{'Nom'} = '';
>         $cf_clones->{'Adresse email'} = '';
>     }
> 
>    my $NewAction = RT::Ticket->new( $self->CurrentUser );
>    $NewAction->Create ( ...);
> 
>    foreach my $field_name (keys %{$cf_clones} ) {
>         $NewAction->AddCustomFieldValue( Field => $field_name, Value =>
> $cf_clones->{$field_name} );
>     }
> -----------------------snip--------------



More information about the rt-devel mailing list