[rt-users] RT2-to-RT3 migration tool question

Brian Friday brian.friday at gmail.com
Thu Nov 6 19:36:52 EST 2008


Ah Ha!


On Nov 6, 2008, at 4:03 PM, Ruslan Zakirov wrote:

> On Fri, Nov 7, 2008 at 2:16 AM, Brian Friday  
> <brian.friday at gmail.com> wrote:
>>
>> What I would like to do is using the RT2-to-RT3 migration tool take
>> the output that it is getting in preparation to dump to a file and on
>> the fly change the priority from word to numeric value. So where
>> priority = urgent, high, medium, low, or project the name is changed
>> to the value 90,70,50,20, and 10 respectively.
>>
>> So after some debugging I found the area I need to target (at least
>> for the queues so far) at line #457 in the
>> rt2-to-dumpfile program specifically the program snippet below:
>>
>>    foreach my $Queue ( @{ $Queues->ItemsArrayRef } ) {
>>        my $queue_ds;
>>        foreach my $param ( sort @{$FIELD_MAPPINGS{'RT::Queue'}} ) {
>>            $queue_ds->{$param} = $Queue->_Value($param)
>>              if ( $Queue->_Value($param) );
>>        }
>
> I think it's pretty simple. Instead of the following:
>                if ($Queue->__Value($param) eq 'urgent') {
>                    $Queue->_Set($param) = '90';
> where you try to change your RT2 DB, you can change temporary
> $queue_ds hash the tool builds before pushing data into file,
> something like that:
>
>             if ($param eq "FinalPriority") {
>                 if ($Queue->__Value($param) eq 'urgent') {
>                     $queue_ds-> {$param} = '90';
>                 } elsif ($Queue->__Value($param) eq 'high') {
>                     $queue_ds->{$param} = '70';
>                 } elsif ($Queue->__Value($param) eq 'medium') {
>                 ...
>             }
>             else {
>                $queue_ds->{$param} = $Queue->_Value($param)
>                       if ( $Queue->_Value($param) );
>             }
>

Ah Ha! I knew I was missing something glaringly obvious but somehow I  
didn't see the nose or in this case the temporary hash in front of my  
face.

For historical etc reference the code change I put in at 457 (which  
works based on a data dumper output before and after) is the following:

             if (($param eq "FinalPriority") || ($param eq  
'InitialPriority')) {
                 if ($Queue->__Value($param) eq 'urgent') {
                     $queue_ds->{$param} = '90';
                 } elsif ($Queue->__Value($param) eq 'high') {
                     $queue_ds->{$param} = '70';
                 } elsif ($Queue->__Value($param) eq 'medium') {
                     $queue_ds->{$param} = '50';
                 } elsif ($Queue->__Value($param) eq 'low') {
                     $queue_ds->{$param} = '20';
                 } elsif ($Queue->__Value($param) eq 'project') {
                     $queue_ds->{$param} = '10';
                 } elsif ($Queue->__Value($param) eq 'back burner') {
                     $queue_ds->{$param} = '5';
                 }
             } else {
             $queue_ds->{$param} = $Queue->_Value($param)
               if ( $Queue->_Value($param) );
             }

Thanks for the quick assistance Ruslan!

- Brian




More information about the rt-users mailing list